TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Include paths evaluate to no files when tsconfig.json is in a sandbox (regression in 5.5)

Open alexeagle opened this issue 1 week ago • 9 comments

🔎 Search Terms

symlink tsconfig includes

🕗 Version & Regression Information

  • This changed between versions 5.4.5 and 5.5.2

⏯ Playground Link

No response

💻 Code

No response

🙁 Actual behavior

Under Bazel, builds are made more hermetic by creating a dedicated folder (an "execroot") and symlinking files into it.

Starting in TS 5.5, we see the following minimal reproduction:

% npm init -y
% npm install [email protected]
% echo "export const a = 1;" > index.ts
% echo "{}" > tsconfig.json
% mkdir execroot
% cd execroot
execroot % ln -s ../index.ts . 
execroot % ln -s ../tsconfig.json .
execroot % ../node_modules/.bin/tsc -p tsconfig.json --outDir .
error TS18003: No inputs were found in config file '/Users/alexeagle/repros/ts55/execroot/tsconfig.json'. 
Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["/Users/alexeagle/repros/ts55/execroot"]'.


Found 1 error.

Note that if --outDir . is removed, then this command instead succeeds and writes index.js.

This red PR to Bazel's TypeScript rules demonstrates the problem in the context of running the bazel tool: https://github.com/aspect-build/rules_ts/pull/643

🙂 Expected behavior

In the prior TypeScript release this was working.

Additional information about the issue

https://github.com/microsoft/TypeScript/pull/58042 seems like a likely explanation as it touched the resolution logic for locating files to be in the program, fyi @sheetalkamat

alexeagle avatar Jun 26 '24 13:06 alexeagle