scripts/check-type-dependencies: fix handling of duplicate imports

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-06-15 14:36:16 +02:00
parent e58e8bf572
commit 908750b472
+2 -1
View File
@@ -85,9 +85,10 @@ function checkTypes(pkg) {
resolvePath(pkg.location, 'dist/index.d.ts'),
'utf8',
);
const deps = (typeDecl.match(/from '.*'/g) || [])
const allDeps = (typeDecl.match(/from '.*'/g) || [])
.map(match => match.replace(/from '(.*)'/, '$1'))
.filter(n => !n.startsWith('.'));
const deps = Array.from(new Set(allDeps));
const errors = [];
const typeDeps = [];