-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any file name with .d.
in it ending with .ts
is a declaration file in 5.0.2 even without --allowArbitraryExtensions
#53319
Comments
I think the logic got a little twisted up here, it's intentional to not just look for exactly |
@RyanCavanaugh what needs to be tweaked here? I would help fix this, but I don't know what should change to fix it because maybe this is intended behaviour now. To summarize the issue, the I feel like a fix would be to have a way for the
Maybe an issue though is in the language server you probably want a way to tell if a file is a declaration file solely based on the file path I think? Maybe that could be figured out if a corresponding |
@weswigham can you weigh in? |
Nope! These are always recognized as declaration files now; the flag only controls weather we issue an error on their use to resolve an import in
WIldcard directory includes (like the compiler without any configuration) suck in all files ending in |
Nah, I don't think we'd like this. We like being able to map from declaration file path back to original source file path, and if you can mark arbitrary files as "declaration", we lose that capability. |
That's fair. I think we can close this issue then? |
Yeah, this is working as intended. |
Btw, thanks for the clarification! I will just make a few small changes on our side and this is not a big deal. |
Bug Report
See the last "or" condition:
TypeScript/src/compiler/parser.ts
Lines 10178 to 10180 in a70c409
Added as part of #51435 -- I think this was meant to be behind the
--allowArbitraryExtensions
flag?Right now the only way I see to set if a file type is ambient is through the extension. Maybe the API needs a better way for consumers to tell it "this is a declaration file"? Maybe on
CreateSourceFileOptions
? Then perhaps the code that does the arbitrary extension resolution could mark the declaration file that matches the arbitrary extension as ambient and the code here could be reverted.🔎 Search Terms
extension declaration
🕗 Version & Regression Information
🙁 Actual behavior
Declaration file specific errors
🙂 Expected behavior
No declaration file errors.
The text was updated successfully, but these errors were encountered: