Commit 4e0b386e authored by nanahira's avatar nanahira

dont transform to schema of already schema

parent a0691e93
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
"typescript": "^4.5.2" "typescript": "^4.5.2"
}, },
"peerDependencies": { "peerDependencies": {
"schemastery": "^3.3.2" "schemastery": "^3.3.3"
} }
}, },
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
...@@ -1886,9 +1886,9 @@ ...@@ -1886,9 +1886,9 @@
} }
}, },
"node_modules/cosmokit": { "node_modules/cosmokit": {
"version": "1.1.1", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.1.1.tgz", "resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.1.2.tgz",
"integrity": "sha512-+f8x9pFGIc7I6HTObS90dq2K5YsI4U3Me4l9OminU9woVtF9Sv3CAHb5vKbFZ93XpTFctAQ6qAVSGjkGvGI9iw==", "integrity": "sha512-cSNrcyxZ3GT+tjSlUzWIzMiK7Wndq1Nm/2tlRhT65RXltSIcH5zaHdmnz1TnIhLuOViaO9qfSdnRPzxNkxMv0g==",
"peer": true "peer": true
}, },
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
...@@ -4551,12 +4551,12 @@ ...@@ -4551,12 +4551,12 @@
} }
}, },
"node_modules/schemastery": { "node_modules/schemastery": {
"version": "3.3.2", "version": "3.3.3",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.3.2.tgz", "resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.3.3.tgz",
"integrity": "sha512-Z1C850OPtNEBs+D4QBPdC+Wu1t6Fn1BrOJILRHs2b+I/u61hUKP2vIPMAXFLvmmONnwqAW8ksPdCD6Zz9n8zhg==", "integrity": "sha512-DwRsse6C+Qao90P/Bz+4G3gmAjM3he/VgHk3TykmEWv3KFqvwmqEn61SF3BPaTPP0L77a5Kc6q4+KQvdN1bBqA==",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"cosmokit": "^1.1.0" "cosmokit": "^1.1.2"
} }
}, },
"node_modules/semver": { "node_modules/semver": {
...@@ -6715,9 +6715,9 @@ ...@@ -6715,9 +6715,9 @@
} }
}, },
"cosmokit": { "cosmokit": {
"version": "1.1.1", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.1.1.tgz", "resolved": "https://registry.npmjs.org/cosmokit/-/cosmokit-1.1.2.tgz",
"integrity": "sha512-+f8x9pFGIc7I6HTObS90dq2K5YsI4U3Me4l9OminU9woVtF9Sv3CAHb5vKbFZ93XpTFctAQ6qAVSGjkGvGI9iw==", "integrity": "sha512-cSNrcyxZ3GT+tjSlUzWIzMiK7Wndq1Nm/2tlRhT65RXltSIcH5zaHdmnz1TnIhLuOViaO9qfSdnRPzxNkxMv0g==",
"peer": true "peer": true
}, },
"cross-spawn": { "cross-spawn": {
...@@ -8726,12 +8726,12 @@ ...@@ -8726,12 +8726,12 @@
} }
}, },
"schemastery": { "schemastery": {
"version": "3.3.2", "version": "3.3.3",
"resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.3.2.tgz", "resolved": "https://registry.npmjs.org/schemastery/-/schemastery-3.3.3.tgz",
"integrity": "sha512-Z1C850OPtNEBs+D4QBPdC+Wu1t6Fn1BrOJILRHs2b+I/u61hUKP2vIPMAXFLvmmONnwqAW8ksPdCD6Zz9n8zhg==", "integrity": "sha512-DwRsse6C+Qao90P/Bz+4G3gmAjM3he/VgHk3TykmEWv3KFqvwmqEn61SF3BPaTPP0L77a5Kc6q4+KQvdN1bBqA==",
"peer": true, "peer": true,
"requires": { "requires": {
"cosmokit": "^1.1.0" "cosmokit": "^1.1.2"
} }
}, },
"semver": { "semver": {
......
...@@ -59,6 +59,6 @@ ...@@ -59,6 +59,6 @@
"testEnvironment": "node" "testEnvironment": "node"
}, },
"peerDependencies": { "peerDependencies": {
"schemastery": "^3.3.2" "schemastery": "^3.3.3"
} }
} }
...@@ -217,6 +217,9 @@ function applySchemaForClass<T>( ...@@ -217,6 +217,9 @@ function applySchemaForClass<T>(
} }
export function SchemaClass<T>(originalClass: ClassType<T>) { export function SchemaClass<T>(originalClass: ClassType<T>) {
if (originalClass[kSchema]) {
return originalClass as ClassType<T> & Schema<Partial<T>, T>;
}
const schema = schemaFromClass(originalClass); const schema = schemaFromClass(originalClass);
const newClass = function (...args: any[]): T { const newClass = function (...args: any[]): T {
const instance = new originalClass(...args); const instance = new originalClass(...args);
......
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