microsoft / microsoft/TypeScript
Investigate altering extension priorities for wildcard loading
@weswigham is already working on this.
Since Sep 26, 2019.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Our rules for loading files from wildcard matches prioritize .d.ts files over .json files (and at the same priority as .js files). Now that we support declaration files for .json and .js files, this is undesirable, as when declarations are emitted in-place (ie, with emitDeclarationsOnly), subsequent compilations using wildcard lookups will load the generated declaration files over the original source .js (maybe) and .json (definitely) files. Fixing this would require rejiggering the extension priority machinery in src\compiler\utilities.ts, so that declaration files are truly the lowest priority extension to load. This comment thread has a bit more discussion on the topic. A cursory glance also leads me to believe that extension priorities for extraFileExtensions as passed into getSupportedExtensions are largely unhandled, so there's probably a fair chunk of work here to revisit this system.
In the meantime, if you encounter an issue likely caused by this discrepancy, the workaround is pretty simple: Use the outDir compiler option.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.