Skip to content

Conversation

@pavelfeldman
Copy link
Member

Fixes #14348

Copy link
Member

@yury-s yury-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test for this.

@pavelfeldman
Copy link
Member Author

I won't need a test once we move to TS 4.7. We have the opposite problem though, we might need bots for earlier versions of TS.

@AviVahl
Copy link

AviVahl commented Jun 21, 2022

any chance for a bugfix release with this change? just noticed it didn't resolve types in native esm mode (node16 module/moduleResolution)... 😮

was going to report it using the following reproduction steps:

mkdir playwright-node16-bug
cd playwright-node16-bug
npm init -y
npm i playwright-core typescript -D
npx tsc --init --module node16 --moduleResolution node16
echo "import playwright from 'playwright-core'; console.log(playwright);" > bug.mts
npx tsc

@mxschmitt
Copy link
Contributor

@AviVahl you can use the next version npm install playwright-core@next!

@AviVahl
Copy link

AviVahl commented Jun 21, 2022

thanks for the tip. 👍 would be useful in own projects, but my team is using some dependencies with stable playwright peerDeps.

I'm currently using "module": "esnext", "moduleResolution": "node", but wanted to switch to "node16", as it actually works as I'd expect (picks up "exports").

TxHawks added a commit to TxHawks/react-polymorphic-types that referenced this pull request Jun 26, 2022
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Types not compatible with TS4.7 Node ESM support

5 participants