This shows how exported types cannot also be used as package-scope types.
Re:
curl https://webi.sh/node | sh
source ~/.config/envman/PATH.sh
npm install --location=global jshint prettier uglify-js typescript fixjson
git clone https://gist.github.com/coolaj86/aaaf1a5c469a47d40f5f57d37ea4484f
cd ./aaaf1a5c469a47d40f5f57d37ea4484f/
tsc -p tsconfig.json
❌
main.js:4:19 - error TS2306: File '/private/tmp/aaaf1a5c469a47d40f5f57d37ea4484f/node_modules/foo/types.js' is not a module.
4 * @param {import('foo/types.js').Foo} foo
~~~~~~~~~~~~~~
Found 1 error in main.js:4
(
cd ./node_modules/foo/
tsc -p tsconfig.json
)
✅
(
cd ./node_modules/bar/
tsc -p tsconfig.json
)
❌
bar.js:3:12 - error TS2552: Cannot find name 'Bar'. Did you mean 'bar'?
3 /** @type {Bar} */
~~~
bar.js:4:5
4 let bar = {
~~~
'bar' is declared here.
Found 1 error in bar.js:3
To any random wanderers, try https://github.com/BeyondCodeBootcamp/js-with-types-jsdoc-tsc-starter instead.