You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
declare global {namespaceglobalThis{var__IS_CI__: boolean;}}export{};
🙁 Actual behavior
On TS 5.4, the command passes.
On TS 5.5 or newer, the command fails with the error:
src/test.spec.ts:5:12 - error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
5 globalThis.__IS_CI__ = true;
🙂 Expected behavior
I expect both commands to pass.
Additional information about the issue
I'm trying to migrate a large codebase off of Typescript 5.3, and this is the last blocker remaining.
--outDir src is passed to tsc via a Bazel build rule.
If {"outDir": "src"} is added to tsconfig.json, then typechecking will fail on both versions of TypeScript.
As I understand it, according to #58327, outDir causes source files to be excluded because otherwise, we'll overwrite the .d.ts files we're using as source files.
But if you don't specify outDir at all, your output directory will be the same as your source directory anyway, and somehow this won't be a problem. According to the TypeScript docs:
If [outDir is] not specified, .js files will be emitted in the same directory as the .ts files they were generated from.
Since we already have default behavior where the source and output directories are the same, why does specifyingoutDir cause such a different behavior?
The text was updated successfully, but these errors were encountered:
Unless explicitly specified, exclude includes outDir as a default value. If you don't specify outDir then it has no value (since it has no default value) and is not part of exclude, that's why you see different behaviors.
🔎 Search Terms
outDir globalThis declarations exclude include not found error
🕗 Version & Regression Information
5.5.0-dev.20240426
and5.5.0-dev.20240427
⏯ Playground Link
https://github.com/jthemphill/ts-5.5-repro
💻 Code
Run with
tsc --outDir src
.tsconfig.json
:src/test.spec.ts
:common.ts
:🙁 Actual behavior
On TS 5.4, the command passes.
On TS 5.5 or newer, the command fails with the error:
🙂 Expected behavior
I expect both commands to pass.
Additional information about the issue
--outDir src
is passed totsc
via a Bazel build rule.{"outDir": "src"}
is added totsconfig.json
, then typechecking will fail on both versions of TypeScript.--outDir src
on the command line.As I understand it, according to #58327,
outDir
causes source files to be excluded because otherwise, we'll overwrite the.d.ts
files we're using as source files.But if you don't specify
outDir
at all, your output directory will be the same as your source directory anyway, and somehow this won't be a problem. According to the TypeScript docs:Since we already have default behavior where the source and output directories are the same, why does specifying
outDir
cause such a different behavior?The text was updated successfully, but these errors were encountered: