Skip to content

Commit

Permalink
fix: missing types with "moduleResolution":"Node16"
Browse files Browse the repository at this point in the history
Since the filename pointed at by `default` and `import` (`empty`) is not identical to the filename of the `d.ts` file (`index`), the top level `types` field is not enough when using `"moduleResolution":"Node16"` and TypeScript `4.7`. 

To fix this, `types` must be explicitly specified inside the `exports` object in addition to the top level `types` field.

See [firebase/firebase-js-sdk#6300](/firebase/firebase-js-sdk/issues/6300) and [microsoft/playwright#14428](/microsoft/playwright/pull/14428)
  • Loading branch information
TxHawks authored Jun 26, 2022
1 parent 0da9a47 commit a5c3594
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"sideEffects": false,
"exports": {
"default": "./empty.js",
"import": "./empty.js"
"import": "./empty.js",
"types": "./index.d.ts"
},
"main": "./empty.js",
"types": "./index.d.ts",
Expand Down

0 comments on commit a5c3594

Please sign in to comment.