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
I think we got this technically wrong in #1704. Basically, we need a separate type definition file for each of cjs and esm. This is a common mistake and in our defence the documentation may have got clearer in the last year!
It’s important to note that the CommonJS entrypoint and the ES module entrypoint each needs its own declaration file, even if the contents are the same between them. Every declaration file is interpreted either as a CommonJS module or as an ES module, based on its file extension and the "type" field of the package.json, and this detected module kind must match the module kind that Node will detect for the corresponding JavaScript file for type checking to be correct.
Looking back, @ChocolateLoverRaj did make a second file when investigating, and just reexporting the cjs types is hopefully sufficient like in comment: #1703 (comment)
The TypeScript gurus actually suggest not having a "types" entry and just having type definition sitting beside the entry point. However, we have historically had the definitions tucked away in a folder and I'm ok with continuing with that.
I think we got this technically wrong in #1704. Basically, we need a separate type definition file for each of cjs and esm. This is a common mistake and in our defence the documentation may have got clearer in the last year!
From https://www.typescriptlang.org/docs/handbook/esm-node.html
Looking back, @ChocolateLoverRaj did make a second file when investigating, and just reexporting the cjs types is hopefully sufficient like in comment: #1703 (comment)
The TypeScript gurus actually suggest not having a
"types"
entry and just having type definition sitting beside the entry point. However, we have historically had the definitions tucked away in a folder and I'm ok with continuing with that.Related links:
The text was updated successfully, but these errors were encountered: