js: fix type error

This commit is contained in:
pengfei.zhou
2022-12-29 09:02:55 +08:00
committed by osborn
parent be4fb05f91
commit 37d2df9eea
2 changed files with 9 additions and 4 deletions

View File

@@ -23,7 +23,7 @@ export function obj2Model(obj: Model, convertor: (v: Function) => string): Model
return obj.map(e => obj2Model(e, convertor)) as Model
} else if (obj instanceof Object) {
if (Reflect.has(obj, 'toModel') && Reflect.get(obj, 'toModel') instanceof Function) {
obj = Reflect.apply(Reflect.get(obj, 'toModel'), obj, [])
obj = Reflect.apply(Reflect.get(obj, 'toModel') as Function, obj, [])
return obj
} else {
for (let key in obj) {