Commit 4e0b386e authored by nanahira's avatar nanahira

dont transform to schema of already schema

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