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

rdp v8 types require allowSyntheticDefaultImports to compile #1909

Closed
adidahiya opened this issue Sep 21, 2023 · 6 comments · Fixed by #1926
Closed

rdp v8 types require allowSyntheticDefaultImports to compile #1909

adidahiya opened this issue Sep 21, 2023 · 6 comments · Fixed by #1926
Assignees
Labels
Accepted Changes have been accepted and will go in one of the next releases. bug Bug or Bug fixes

Comments

@adidahiya
Copy link
Contributor

Mostly filing this for others to discover if they run into the same issue. I understand that you probably won't make a change to the typings to address this issue, but it would be nice to update the v8.x migration guide to mention this additional breaking change.

Bug description

When upgrading to react-day-picker v8.x in a TypeScript project, I encountered this compilation error:

node_modules/.pnpm/react-day-picker@8.8.2_67dtbe47ihz5epdhb3oajtg74u/node_modules/react-day-picker/dist/index.d.ts:2:8 - error TS1259: Module '"/home/circleci/project/node_modules/.pnpm/@types+react@16.14.32/node_modules/@types/react/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

2 import React$1, { ReactNode, HTMLProps } from 'react';
         ~~~~~~~

  node_modules/.pnpm/@types+react@16.14.32/node_modules/@types/react/index.d.ts:61:1
    61 export = React;
       ~~~~~~~~~~~~~~~
    This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.

Note that I am currently using @types/react v16.x, but the same issue would apply to the latest v18.x types.

To reproduce

https://codesandbox.io/p/sandbox/react-daypicker-forked-vcg8w5?file=%2Ftsconfig.json%3A8%2C21

Need these tsconfig options:

{
  "compilerOptions": {
    "skipLibCheck": false,
    "esModuleInterop": false,
    "allowSyntheticDefaultImports": false,
    "isolatedModules": false
  }
}

Expected behavior

Either:

@adidahiya adidahiya added the bug Bug or Bug fixes label Sep 21, 2023
@gpbl gpbl added Accepted Changes have been accepted and will go in one of the next releases. Type: Build labels Sep 24, 2023
@gpbl gpbl self-assigned this Sep 24, 2023
@gpbl
Copy link
Owner

gpbl commented Sep 24, 2023

Thanks @adidahiya, this looks like something we can easily fix. Thanks for your heads up.

@adidahiya
Copy link
Contributor Author

@gpbl does that mean you'll try to change the emitted react-day-picker/dist/index.d.ts to use import * as React from "react" instead of import React from "react"? or will you update the breaking changes documentation?

@gpbl
Copy link
Owner

gpbl commented Sep 25, 2023

@adidahiya I'd prefer to fix the breaking change. I already started working on this, will update...

@adidahiya
Copy link
Contributor Author

@gpbl Hi, any update on this? Has it been more difficult than anticipated to fix this breaking change?

@adidahiya
Copy link
Contributor Author

thanks @gpbl!

@gpbl
Copy link
Owner

gpbl commented Oct 13, 2023

@adidahiya sorry for the delay, we are going to release on npm soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Changes have been accepted and will go in one of the next releases. bug Bug or Bug fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants