Warn on type override (#1985)

This commit is contained in:
Jaco Greeff
2020-03-02 09:12:25 +01:00
committed by GitHub
parent af1a3385cc
commit d9ee39f367
+1 -5
View File
@@ -92,15 +92,11 @@ export function createImports (importDefinitions: Record<string, object>, { type
Object.entries(packageDef).forEach(([name, moduleDef]): void => {
const fullName = `${packagePath}/${name}`;
if (definitions[fullName]) {
throw new Error(`Duplicated module imports ${fullName}`);
}
definitions[fullName] = moduleDef;
Object.keys(moduleDef.types).forEach((type): void => {
if (typeToModule[type]) {
throw new Error(`Duplicated type: ${type}, found in: ${fullName}, ${typeToModule[type]}`);
console.warn(`\t\tWARN: Overwriting duplicated type '${type}' ${typeToModule[type]} -> ${fullName}`);
}
typeToModule[type] = fullName;