From f540ed503f5a7c140b9b5abd71dbb3a66cd0e79e Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Fri, 4 Sep 2020 14:00:56 +0300 Subject: [PATCH] fix: skip property if ref is same as interface ref --- npm/ng-packs/packages/schematics/src/utils/model.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/schematics/src/utils/model.ts b/npm/ng-packs/packages/schematics/src/utils/model.ts index 2ac5949050..0e472e64d3 100644 --- a/npm/ng-packs/packages/schematics/src/utils/model.ts +++ b/npm/ng-packs/packages/schematics/src/utils/model.ts @@ -133,7 +133,11 @@ export function createImportRefToInterfaceReducerCreator(params: ModelGeneratorP return _interface.properties .reduce((refs, prop) => { - prop.refs.forEach(type => !types[type]?.isEnum && refs.push(type)); + prop.refs.forEach(type => { + if (types[type]?.isEnum || type === _interface.ref) return; + refs.push(type); + }); + return refs; }, []) .concat(base ? parseGenerics(typeDef.baseType!).toGenerics() : [])