You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto import paths dont handle source of projectReferenceRedirect in editor #34677
The auto import path seems to be affected by this change. E.g. previously I have a module of which the auto import path is shared but now it's shared/src/library.
The shared module is a linked module which is also one of the referenced projects, it has package.json with types set to bld/library/index.d.ts and I guess that's why the auto import path worked as shared instead of shared/bld/library.
vilic the repro you provided has some issues.. I don't see module resolution happening..
c:\temp\bug-repros>node node_modules\typescript\lib\tsc.js -v
Version 3.8.0-dev.20191023
c:\temp\bug-repros>node node_modules\typescript\lib\tsc.js -b -v --traceResolution
[11:10:54 AM] Projects in this build:
* shared/src/library/tsconfig.json
* app/src/program/tsconfig.json
* tsconfig.json
[11:10:54 AM] Project 'shared/src/library/tsconfig.json' is out of date because output file 'shared/bld/library/index.js' does not exist
[11:10:54 AM] Building project 'c:/temp/bug-repros/shared/src/library/tsconfig.json'...
[11:10:55 AM] Project 'app/src/program/tsconfig.json' is out of date because output file 'app/bld/program/bar.js' does not exist
[11:10:55 AM] Building project 'c:/temp/bug-repros/app/src/program/tsconfig.json'...
======== Resolving module 'shared' from 'c:/temp/bug-repros/app/src/program/bar.ts'. ========
Module resolution kind is not specified, using 'NodeJs'.
Loading module 'shared' from 'node_modules' folder, target file type 'TypeScript'.
Directory 'c:/temp/bug-repros/app/src/program/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/temp/bug-repros/app/src/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/temp/bug-repros/app/node_modules' does not exist, skipping all lookups in it.
File 'c:/temp/bug-repros/node_modules/shared.ts' does not exist.
File 'c:/temp/bug-repros/node_modules/shared.tsx' does not exist.
File 'c:/temp/bug-repros/node_modules/shared.d.ts' does not exist.
Directory 'c:/temp/bug-repros/node_modules/@types' does not exist, skipping all lookups in it.
Directory 'c:/temp/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/node_modules' does not exist, skipping all lookups in it.
Loading module 'shared' from 'node_modules' folder, target file type 'JavaScript'.
Directory 'c:/temp/bug-repros/app/src/program/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/temp/bug-repros/app/src/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/temp/bug-repros/app/node_modules' does not exist, skipping all lookups in it.
File 'c:/temp/bug-repros/node_modules/shared.js' does not exist.
File 'c:/temp/bug-repros/node_modules/shared.jsx' does not exist.
Directory 'c:/temp/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/node_modules' does not exist, skipping all lookups in it.
======== Module name 'shared' was not resolved. ========
app/src/program/bar.ts:1:19 - error TS2307: Cannot find module 'shared'.
1 import {foo} from 'shared';
~~~~~~~~
app/src/program/index.ts:1:1 - error TS2304: Cannot find name 'foo'.
1 foo;
~~~
Found 2 errors.
c:\temp\bug-repros>
Is there any way to get intellisence proposals across referenced projects when the "shared" project has a directory of type declarations? So multiple d.ts files instead of just index.d.ts.
This is a really awesome cool fix! Looks like, at last, In April 2020, TS & VSCode become both monorepo-friendly!
I also prepared a repro steps where IntelliSense incorrectly proposes to auto-import files from src/ instead of dist/, but I can confirm that in 3.9.1-rc it stopped reproducing.
A screenshot from default/ folder from there (TS 3.8.3, wrong behavior):
And a screenshot from disableSourceOfProjectReferenceRedirect-true folder which sets disableSourceOfProjectReferenceRedirect=true (TS 3.8.3 still, the above behavior disappeared):
In TS 3.9.1-rc, the 1st screenshot stopped reproducing - and it's great!
Activity
sheetalkamat commentedon Oct 23, 2019
Also from the issue comment
sheetalkamat commentedon Oct 23, 2019
vilic the repro you provided has some issues.. I don't see module resolution happening..
vilicvane commentedon Oct 23, 2019
Sheetal Nandi (@sheetalkamat) Are you using yarn or npm? The repro is using yarn workspaces linking projects.
sheetalkamat commentedon Oct 23, 2019
I have cloned and ran the tsc with nightly. If those aren't the steps to repro, please provide correct repro steps.
vilicvane commentedon Oct 23, 2019
Sheetal Nandi (@sheetalkamat) Steps after clone:
yarnunder the project directory.yarn tsc --build(Expecting errorCannot find name 'foo'.)app/src/program/index.ts, and try auto fixes on identifierfoo.BTW just confirmed that setting
disableSourceOfProjectReferenceRedirectastruebrings back the old behavior.dinofx commentedon Mar 19, 2020
Is there any way to get intellisence proposals across referenced projects when the "shared" project has a directory of type declarations? So multiple
d.tsfiles instead of just index.d.ts.Add test for project reference and auto import
Add test for project reference and auto import
Handle auto import scenarios when using project references (#37482)
dimikot commentedon Apr 30, 2020
This is a really awesome cool fix! Looks like, at last, In April 2020, TS & VSCode become both monorepo-friendly!
I also prepared a repro steps where IntelliSense incorrectly proposes to auto-import files from src/ instead of dist/, but I can confirm that in 3.9.1-rc it stopped reproducing.
Just in case, here are these repro examples: https://github.com/DmitryKoterov/intellisense-composite
A screenshot from default/ folder from there (TS 3.8.3, wrong behavior):
And a screenshot from disableSourceOfProjectReferenceRedirect-true folder which sets disableSourceOfProjectReferenceRedirect=true (TS 3.8.3 still, the above behavior disappeared):
In TS 3.9.1-rc, the 1st screenshot stopped reproducing - and it's great!
Don't auto import with the /dist folder fpr TS projects
Don't auto import with the /dist folder fpr TS projects
dko-slapdash commentedon Nov 24, 2020
dko-slapdash commentedon Nov 24, 2020
Don't auto import with the /dist folder fpr TS projects