From 59934d009e024df939ec0de2fffd845d9e5040c6 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Thu, 27 Aug 2020 22:23:41 +0300 Subject: [PATCH] fix: improve namespace parsing by removing generics --- npm/ng-packs/packages/schematics/src/utils/namespace.ts | 4 ++-- npm/ng-packs/packages/schematics/src/utils/type.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/schematics/src/utils/namespace.ts b/npm/ng-packs/packages/schematics/src/utils/namespace.ts index 78ee91a02a..88c574db8a 100644 --- a/npm/ng-packs/packages/schematics/src/utils/namespace.ts +++ b/npm/ng-packs/packages/schematics/src/utils/namespace.ts @@ -1,7 +1,7 @@ -import { createTypeParser } from './type'; +import { createTypeParser, removeGenerics } from './type'; export function parseNamespace(solution: string, type: string) { - const parseType = createTypeParser(); + const parseType = createTypeParser(removeGenerics); let namespace = parseType(type)[0] .split('.') .slice(0, -1) diff --git a/npm/ng-packs/packages/schematics/src/utils/type.ts b/npm/ng-packs/packages/schematics/src/utils/type.ts index 9734b96af5..25751f475d 100644 --- a/npm/ng-packs/packages/schematics/src/utils/type.ts +++ b/npm/ng-packs/packages/schematics/src/utils/type.ts @@ -51,6 +51,10 @@ export function normalizeTypeAnnotations(type: string) { return type.replace(/\?/g, ''); } +export function removeGenerics(type: string) { + return type.replace(/<.+>/g, ''); +} + export function removeTypeModifiers(type: string) { return type.replace(/\[\]/g, ''); }