(no title)
uup | 3 years ago
Try this:
// tsconfig.json
{
"compilerOptions": {
"outDir": "dist",
"module": "es2020",
"allowJs": true
},
"files": ["index.ts"]
}
// index.ts
import('./test.mjs').then(console.log)
> npx tsc && node ./dist/index.js
[Module: null prototype] { Foo: [Function: Foo] }
kuramitropolis|3 years ago
Yes, it imports the module. No, it doesn't do even basic type inference (knowing that Foo is a class and consequently allowing it to be used as a type name) - which it would, if it was a superset of JS. Instead it seems to import everything as "any", which is... a start, I guess?