@rauschma I love TypeScript but I don't like additional build steps. IMHO, JavaScript with JSDoc comments and TypeScript as a linter is a much simpler approach. Hopefully, we will see JavaScript type annotations one day.
Conversation
Notices
-
Embed this notice
Sergey on FunctionalScript (functionalscript@techhub.social)'s status on Monday, 22-Jan-2024 10:55:46 JST Sergey on FunctionalScript -
Embed this notice
Axel Rauschmayer (rauschma@fosstodon.org)'s status on Monday, 22-Jan-2024 10:55:47 JST Axel Rauschmayer 1/ #TypeScript & ESM—modern approach that works for me (feedback appreciated!)
## package.json
– Only "exports"—no more "main", "module", "types", "typesVersions"
– Pairings:
– m.d.ts next to m.js
– m.d.mts next to m.mjsTree of files:
"exports": {
"./*": "./dist/src/*"
},Single file:
"exports": {
".": "./dist/src/library.js"
},## tsconfig.json
"module": "NodeNext",
"moduleResolution": "NodeNext",## Documentation
– https://nodejs.org/api/packages.html#package-entry-points
– https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports
-
Embed this notice