Comments (14)
Using https://www.npmjs.com/package/every-ts:
$ every-ts bisect start
$ every-ts bisect bad main
$ every-ts bisect good 5.4.5
$ every-ts bisect run sh -c 'tsc -p tsconfig.json --outDir .'
c92bd16ac0e75834100ef57daa0083f161470509 is the first bad commit
commit c92bd16ac0e75834100ef57daa0083f161470509
Author: Sheetal Nandi <[email protected]>
Date: Fri Apr 26 13:14:40 2024 -0700
Exclude outDir and declarationDir even if they come from extended config (#58335)
from typescript.
This was intentional change to exclude the outDir
and declarationDir
if no excludes are specified.
from typescript.
It seems like that PR intended to change it for the case where outDir
and/or declarationDir
appear in the extend
ed tsconfig. file. Did you also instead to change the semantics for the --outDir
command-line flag?
from typescript.
For all flags we normally dont care if its in config file or passed on commandLine, so thats what this change did - always exclude outDir
and declaraitonDir
from typescript.
I think one would expect that these three tsconfigs would have identical behavior:
{
"compilerOptions": {}
}
{
"compilerOptions": {
"outDir": "."
}
}
{
"compilerOptions": {
"outDir": "."
},
"exclude": []
}
but (2) is the only one that fails with No inputs were found in config file
.
from typescript.
But they are not same:
- is without any
outDir
- Redirects output to
outDir
and there is no exclude specified so will excludeoutdir
- Has explicit excludes so it doesnt add any data to it.
from typescript.
I recognize the behavioral difference, but it seems like something that will be a source of confusion for users. Also I just wanted to get clarification, should this behavior only apply to tsconfig files that have been "extends"
ed from, or to any tsconfig files?
from typescript.
There is no change in behavior for scenario 2 with that PR. That behavior was always there
from typescript.
I believe that's not correct. Scenario 2 produced .js
outputs prior to your commit, and now it's an error.
Note, the repro is even simpler than I wrote above:
ts59036 % touch index.ts tsconfig.json
ts59036 % npx -p [email protected] tsc --outDir . -p .
ts59036 % ls
index.js index.ts tsconfig.json
ts59036 % npx -p [email protected] tsc --outDir . -p .
error TS18003: No inputs were found in config file '/Users/alexeagle/repros/ts59036/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["/Users/alexeagle/repros/ts59036"]'.
Found 1 error.
from typescript.
I believe that's not correct. Scenario 2 produced
.js
outputs prior to your commit, and now it's an error.Note, the repro is even simpler than I wrote above:
ts59036 % touch index.ts tsconfig.json ts59036 % npx -p [email protected] tsc --outDir . -p . ts59036 % ls index.js index.ts tsconfig.json ts59036 % npx -p [email protected] tsc --outDir . -p . error TS18003: No inputs were found in config file '/Users/alexeagle/repros/ts59036/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["/Users/alexeagle/repros/ts59036"]'. Found 1 error.
Thats not what i see. I believe what you ran is not scenario2 as before my change it really just looked "own config outDir" and not commandLine or extended config. Now its consistent. Wherever the outDir comes from it will be excluded if we are supposed to calculate the exclude pattern.
C:\temp\test2>dir
Volume in drive C is Local Disk
Volume Serial Number is 9EF5-3A92
Directory of C:\temp\test2
07/01/2024 12:19 PM <DIR> .
07/01/2024 12:18 PM <DIR> ..
07/01/2024 12:18 PM 13 a.ts
07/01/2024 12:19 PM <DIR> node_modules
07/01/2024 12:19 PM 567 package-lock.json
07/01/2024 12:19 PM 52 package.json
07/01/2024 12:19 PM 41 tsconfig.json
4 File(s) 673 bytes
3 Dir(s) 595,701,358,592 bytes free
C:\temp\test2>type tsconfig.json
{
"compilerOptions": { "outDir": "." } }
C:\temp\test2>node node_modules\typescript\lib\tsc.js -v
Version 5.4.5
C:\temp\test2>node node_modules\typescript\lib\tsc.js --explainFiles
error TS18003: No inputs were found in config file 'C:/temp/test2/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["."]'.
Found 1 error.
from typescript.
I'm sorry, are you saying that you can't repro the same thing I provided above?
Or that you're not interested in that repro because of CLI flags having been treated differently from tsconfig.json?
from typescript.
I am saying that the run you did is not same as scenario 2 described in #59036 (comment) that worked before that change, The change now handles outDir
and declarationDir
in same ways whether it comes from own config, command line or extended config and was intentional.
from typescript.
@alexeagle is there any additional action needed here?
from typescript.
Hey @RyanCavanaugh - I'm representing users here, rather than myself.
In our examples I was forced to add workarounds https://github.com/aspect-build/rules_ts/pull/643/files and I expect that represents the same thing our users will be forced to do. So the required action depends on how much those folks complain about the changed semantics for when --outDir
is specified as a command-line flag - I expect they'll come "upvote" this issue.
As an example user-reported issue: aspect-build/rules_ts#644 (comment)
To be fair, perhaps it's unusual that our Bazel integration passes that command-line flag at all. For reference, here's the spot where we do that. I could imagine we just omit this flag when the value is "."
as that's a no-op. However that's not commonly the case since Bazel runs with a working directory at the root of the monorepo, we typically need --outDir=packages/foo
.
from typescript.
Related Issues (20)
- spread operator infer to wrong type with method override and generic HOT 6
- Intellisense is slow and some things don't work HOT 7
- Constructor cannot access own protected instance when typed as union HOT 3
- This comparison appears to be unintentional because the types 'U[K]' and 'T[K]' have no overlap.ts(2367) HOT 3
- [isolatedDeclarations] Optional parameter in arrow function typed as imported generic type gets emitted as `any` HOT 2
- Easier use of indexed access types on nullable/optional types HOT 2
- Narrow conditional type HOT 2
- Error for path not found when ended with asterisk
- `tryGetPerformanceHooks` throws on Stackblitz with ts 5.5.3 HOT 3
- Avoid providing promise methods as completions at return positions in non-async functions
- Consider disallowing `in` operator use with arbitrary key operands on closed types for which the keys are known HOT 2
- Convert to ESM uses template strings instead of string literals HOT 1
- Running type checker produces js out of memory error HOT 2
- Callback argument type not inferred for union of interfaces HOT 1
- Como Hackear Instagram 2024 Hackear Instagram Metodos Atualizados #221857
- [transpileDeclaration API] ts.transpileDeclaration always returns empty sourceMapText
- Incorrect Error Message: "Cannot assign to 'name' because it is a constant" Instead of "Identifier 'name' is not defined" for Undefined Identifier Assignment HOT 3
- Generic with extends yields to different type than directly specifying it HOT 5
- Instantiation expressions don't reject incompatible signatures in situations with mixed call and construct signatures HOT 1
- Parameters of overridden methods are made implicit any when using JSDoc `@override` HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript.