Skip to content

Commit ed72d94

Browse files
devversionandrewseguin
authored andcommitted
build: ambiguous imports in IDEs (#4958)
Recently the Universal App has been added to the repository. The universal-app contains a script that runs inside of Node and therefore uses Node APIs. The global tsconfig file that is used to provide proper autocompletion in IDEs includes every TS file inside of `src/` and therefore the `prerender.ts` file is also included. This is problematic because now the NodeJS @types are being loaded as well and ambiguous imports appear in editors. Causing for example `setTimeout` calls to return a `Timer` instead of a number (error in your IDEs)
1 parent 6601e3d commit ed72d94

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/tsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,10 @@
1616
"@angular/material": ["./lib/public_api.ts"],
1717
"@angular/cdk": ["./cdk/public_api.ts"]
1818
}
19-
}
19+
},
20+
"exclude": [
21+
// Exclude files that depend on Node APIs because those depend on the Node types and therefore
22+
// cause ambiguous imports. For example `setTimeout()` will return a Timer instead of a number.
23+
"universal-app/prerender.ts"
24+
]
2025
}

0 commit comments

Comments
 (0)