-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Description
TypeScript Version: 4.1.0-dev.20200921
Search Terms:
auto-import paths, auto-import suggestions without baseUrl
Code
Here is a repo with a reproduction. It's a cut down version of a monorepo I redesigned to use paths (then hit the unfortunate auto-import behavior pre-4.1).
https://github.com/jakebailey/ts-41-autoimport-paths
The main file to look at is https://github.com/jakebailey/ts-41-autoimport-paths/blob/master/packages/test-package-1/src/something/index.ts where I've described the different behaviors.
Expected behavior:
When no baseUrl is specified, auto-import suggestions should not be offered for paths like src/foo/bar if they aren't valid. This should work as a result of #40546 and associated changes, and is mentioned in the TS 4.1 beta blog post. In this example, I expect there to be no absolute import because baseUrl is missing, no absolute import via paths as I have not defined one for the current package, leaving me with a relative path suggestion (what I want for consistency with the codebase).
Actual behavior:
These suggestions are still offered. When accepted, TS immediately marks the import as invalid.
Playground Link:
I'm not sure the playground would allow me to have multiple files, hence the repro repo.
Related Issues:
#31869 is related, but I believe my issue to be a bug in that implementation.

