Skip to content

Commit 0552a6c

Browse files
Baymax808YufJi
andauthored
fix: 修复 exactMatchShapeAgainstDef 函数中的引用类型处理逻辑 (#147) (#279)
Co-authored-by: 御风 <18012261618@126.com>
1 parent 065e221 commit 0552a6c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • packages/basic/src/init/dataTypes

packages/basic/src/init/dataTypes/tools.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,11 @@ function exactMatchShapeAgainstDef(value, def: any): boolean {
474474
// 在exactMatchShapeAgainstDef中,不应该去调用isInstanceOf。
475475
// 此时value未被绑定构造器,因此它会返回错误的值。
476476
return isInstanceOf(value, genSortedTypeKey(def));
477+
} else if (def.typeKind === 'reference') {
478+
const resolved = resolveTypeReference(def);
479+
if (resolved) {
480+
return exactMatchShapeAgainstDef(value, resolved);
481+
}
477482
} else if (def.properties) {
478483
// 此时 def 既可以为 anonymousStructure 也可以为 Structure/Entity 等等
479484
const properties = def.properties;
@@ -495,11 +500,6 @@ function exactMatchShapeAgainstDef(value, def: any): boolean {
495500
});
496501
}
497502
return false;
498-
} else if (def.typeKind === 'reference') {
499-
const resolved = resolveTypeReference(def);
500-
if (resolved) {
501-
return exactMatchShapeAgainstDef(value, resolved);
502-
}
503503
}
504504
return false;
505505
}

0 commit comments

Comments
 (0)