Commit d3b2473f authored by nanahira's avatar nanahira

fix metadata overwrite

parent 2f985da0
...@@ -22,14 +22,18 @@ function applyMixin( ...@@ -22,14 +22,18 @@ function applyMixin(
} }
visited.add(sourceClass); visited.add(sourceClass);
Object.getOwnPropertyNames(sourceClass.prototype).forEach((name) => { Object.getOwnPropertyNames(sourceClass.prototype).forEach((name) => {
if (!mixedClass.prototype[name]) { if (mixedClass.prototype[name] != null) {
mixedClass.prototype[name] = sourceClass.prototype[name]; mixedClass.prototype[name] = sourceClass.prototype[name];
} }
}); });
const schemaKeys = reflector.getArray('SchemaMetaKey', sourceClass); const schemaKeys = reflector.getArray('SchemaMetaKey', sourceClass);
for (const name of schemaKeys) { for (const name of schemaKeys) {
const schemaMeta = reflector.get('SchemaMeta', sourceClass, name); const schemaMeta = reflector.get('SchemaMeta', sourceClass, name);
if (!schemaMeta) { if (!schemaMeta == null) {
continue;
}
const existingMetadata = reflector.get('SchemaMeta', mixedClass, name);
if (existingMetadata != null) {
continue; continue;
} }
Metadata.set( Metadata.set(
......
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