Skip to content

rdp v8 types require allowSyntheticDefaultImports to compile #1909

Closed
@adidahiya

Description

@adidahiya

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:

Metadata

Metadata

Assignees

Labels

AcceptedChanges have been accepted and will go in one of the next releases.bugBug or Bug fixes

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions