This repo demonstrates the lack of auto complete, within VS Code, of sub folder when used in conjunction with typeVersions
.
cd package
npm i
npx tsc
cd ..\project
npm i
We have an internal package, written in TS, transpiled to a sub folder called 'dest'. The package.json of the package looks like:
{
...
"type": "module",
"exports": {
"./*": "./dest/*"
},
"typesVersions": {
"*": {
"*": [
"dest/*"
]
}
},
...
}
We're able to consume the package in our projects, like this:
import { something } from 'test-package/something'; // Actual file './dest/something.js'
This works. Our code is transpiled correctly. We get autocomplete on the import path, and typing on the imported whatever, within VS Code.
Until, we attempt to access a sub folder within the 'dest' folder. Within a subfolder, like:
import { somethingElse } from 'test-package/sub-folder/something-else'; // Actual file './js/sub-folder/something-else.js'
In this instance, we get everything from above, except autocomplete on the import path. The file still resolves, and we get typing. Our build script still runs, the files is just invisible.
This is using Visual Studio Code 1.64.2 and TypeScript 4.5.5. Both project and package have the following tsconfig.json:
{
...
"target": "ES2016",
"module": "ESNext",
...
}