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
When using Node in ESM mode and TypeScript 4.5 with compilerOptions.module set to "node12" OR "nodenext" ESModuleInteropt is no longer needed and the MJS export can be used directly with TypeScript.
The problem comes when we use @types/koa... which doesn't define a default type export! Therefore Koa effectively has no types in this situation.
Related to #1513
When using Node in ESM mode and TypeScript 4.5 with
compilerOptions.module set to "node12" OR "nodenext"
ESModuleInteropt is no longer needed and the MJS export can be used directly with TypeScript.The problem comes when we use @types/koa... which doesn't define a default type export! Therefore Koa effectively has no types in this situation.
Solution #1
Make a named export called Application in the MJS wrapper.
Solution #2
Add types to the MJS export with dist/koa.d.ts that references the DefinitelyTyped Koa definitions
Solution #3
Rename mod to Application in dist/koa.mjs... then export Application as default
Details
The text was updated successfully, but these errors were encountered: