Skip to content

Investigate altering extension priorities for wildcard loading #33623

Open
@weswigham

Description

@weswigham

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.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions