-
-
Notifications
You must be signed in to change notification settings - Fork 542
Description
Expected Behavior
Compiling a project which contains a file and the project also includes an import of a symlink of that file in node_modules
completes successfully, even if the file declares a global identifier which would cause a "duplicate identifier" error if they were two separate files.
Common monorepo setups such as Yarn workspaces create symlinks from node_modules
to files in the source. Typescript treats a symbolic link from node_modules
to a file as the same file it links to in order to prevent these issues. Note that this behaviour is only when the file is in node_modules
.
Actual Behavior
ts-node emits a "duplicate identifier" error for this case.
Steps to reproduce the problem
Create a Yarn workspaces project and import a file from another package which declares an identifier globally, such as:
declare module "http" {
class X {}
}
Minimal reproduction
https://github.com/jakzo/ts-node-symlink-issue
Specifications
- ts-node version: ts-node v8.10.2
- node version: node v12.16.3
- TypeScript version: compiler v3.9.3
- tsconfig.json, if you're using one:
{
"include": ["./"],
"exclude": ["node_modules"],
"compilerOptions": {
"moduleResolution": "node",
"outDir": "./dist/",
"types": ["node"]
}
}
- Operating system and version: Mac 15.5