TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

fix55816: exclude files with re-exports if excluded by preferences.autoImportFileExcludePatterns

Open iisaduan opened this issue 1 year ago • 2 comments

Fixes #55816

This failure happened when a file foo.ts that re-exports some variable T is ignored by "typescript.preferences.autoImportFileExcludePatterns". foo.ts was properly ignored by exportMap, but the autoImports still attempted to generate the import with foo.ts instead of the file that originally exported T, which lead to a failure.

This PR allows the moduleSymbol found by autoImports to not match the moduleSymbol found by exportInfoMap if the moduleSymbol found by autoimports is excluded.

iisaduan avatar May 14 '24 19:05 iisaduan

Fixes https://github.com/microsoft/TypeScript/issues/55816

Is that the right issue? It seems unrelated.

fatcerberus avatar May 14 '24 19:05 fatcerberus

It is the correct issue, see the call stack here. The quick fix is not offered because getting autoimports fails when the file is excluded in preferences

iisaduan avatar May 14 '24 21:05 iisaduan

@typescript-bot pack this

iisaduan avatar Jun 06 '24 06:06 iisaduan

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
pack this ✅ Started

typescript-bot avatar Jun 06 '24 06:06 typescript-bot

I added a debug statement to only exit quietly if preferences.autoImportFileExcludePatterns is provided, like @andrewbranch mentioned. It seems that otherwise, if the import was unresolved, autoimports goes through other functions to try to generate imports.

iisaduan avatar Jun 17 '24 22:06 iisaduan