Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"cookie" module has no default export #321

Closed
cgatian opened this issue Aug 5, 2020 · 4 comments · Fixed by #322
Closed

"cookie" module has no default export #321

cgatian opened this issue Aug 5, 2020 · 4 comments · Fixed by #322
Assignees
Labels
bug Something isn't working scope:typescript

Comments

@cgatian
Copy link

cgatian commented Aug 5, 2020

Describe the bug

This is more of a convenience issue, than bug.

Performing a build with TypeScript 3.9.5 with allowSyntheticDefaultImports disabled displays:

ERROR in node_modules/msw/lib/types/context/cookie.d.ts:1:8 - error TS1192: Module '"/node_modules/@types/cookie/index"' has no default export.

Now the issue is because my TypeScript config is strict, and I can modify it to either ignore libraries or allow the synthetic import. However, it might be better to update areas of the code that are doing this:

import cookieUtils from 'cookie'

To

import { parse } from 'cookie'

Since the library definitions accurately reflect no default export on the cookie package.

I also could have all this wrong... I don't claim to be an expert in any of this

Environment

  • msw: 0.20.1
  • nodejs: 14.2.0
  • npm: 6.14.5

Please also provide your browser version.

To Reproduce

Steps to reproduce the behavior:

  1. Configure TypeScript compilation without allowSyntheticDefaultImports
  2. Import import { setupWorker, rest } from 'msw'; somewhere in code
  3. TypeScript compilation issue

Expected behavior

No compilation errors

Screenshots

If applicable, add screenshots to help explain your problem.

@kettanaito
Copy link
Member

Hey, @cgatian! Thanks for letting us know about this.

I've tackled this by setting allowSyntheticDefaultImports: false in our tsconfig.json. This change has reported this, and some other violations, which I've addressed. Expect the changes to be merged soon.

@kettanaito kettanaito self-assigned this Aug 5, 2020
@cgatian
Copy link
Author

cgatian commented Aug 5, 2020

Thanks for being open to the suggestion. This should improve the quality of life for consumers of this lib. 👍

@kettanaito kettanaito changed the title cookie has no default export "cookie" module has no default export Aug 5, 2020
@kettanaito
Copy link
Member

The changes are published in 0.20.2. Please update and let us know that it compiles without TypeScript errors now.

@cgatian
Copy link
Author

cgatian commented Aug 5, 2020

Works great. Thank you!

@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working scope:typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants