Commit 7fb9e0c5 authored by nanahira's avatar nanahira

improves

parent 1f42abcc
Pipeline #6334 passed with stages
in 1 minute and 9 seconds
{ {
"name": "koishi-utils-schemagen", "name": "koishi-utils-schemagen",
"version": "1.1.4", "version": "1.1.5",
"description": "在 Koishi.js 中,使用类装饰器定义 Schema", "description": "在 Koishi.js 中,使用类装饰器定义 Schema",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
"koishijs", "koishijs",
"utils-schema" "utils-schema"
], ],
"author": "Nanahira", "author": "Nanahira <nanahira@momobako.com>",
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"koishi": "^4.0.0-alpha.10", "koishi": "^4.0.0-alpha.10",
......
export const SchemaMetaKey = '_koishi_schema_meta'; export const SchemaMetaKey = Symbol('_koishi_schema_meta');
export const SchemaKeysMetaKey = '_koishi_schemakeys_meta'; export const SchemaKeysMetaKey = Symbol('_koishi_schemakeys_meta');
export const SchemaClassKey = '_koishi_schema_class_meta'; export const SchemaClassKey = Symbol('_koishi_schema_class_meta');
...@@ -34,12 +34,7 @@ function getStringFromNativeType(nativeType: any) { ...@@ -34,12 +34,7 @@ function getStringFromNativeType(nativeType: any) {
if (!nativeTypeString.startsWith('function ')) { if (!nativeTypeString.startsWith('function ')) {
return; return;
} }
const firstLeftBracketPos = nativeTypeString.indexOf('()'); return nativeType.name?.toLowerCase();
if (firstLeftBracketPos === -1) {
return;
}
const typeString = nativeTypeString.slice(9, firstLeftBracketPos);
return typeString.toLowerCase();
} }
export function DefineSchema(options: SchemaOptions = {}): PropertyDecorator { export function DefineSchema(options: SchemaOptions = {}): PropertyDecorator {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment