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

Fix import issue with React InertiaHeadProps type #1460

Closed
wants to merge 1 commit into from

Conversation

jessarcher
Copy link
Member

@jessarcher jessarcher commented Feb 21, 2023

In #1448, the InertiaHeadProps type was updated to include React's children prop.

While the adapters built fine, this caused an issue when building the React playground:

../../packages/react/types/Head.d.ts:1:8 - error TS1259: Module '"/home/jess/Code/inertiajs/inertia/node_modules/@types/react/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

1 import React, { FunctionComponent } from 'react';
         ~~~~~

Although #1448 didn't change the import of React in Head.ts, the change did result in the generated types for that file now also needing to import React when it previously didn't.

Rather than use the allowSyntheticDefaultImports flag, I've changed the InertiaHeadProps type to not depend on the React import directly. Also, rather than manually typing the children prop, I've used React's PropsWithChildren type which has the same end result.

@jessarcher jessarcher force-pushed the build-playgrounds branch 2 times, most recently from 441e12c to 7cf7f22 Compare February 21, 2023 01:08
@jessarcher jessarcher changed the title Build playgrounds in CI Fix import issue with React InertiaHeadProps type Feb 21, 2023
@jessarcher
Copy link
Member Author

This error doesn't seem to occur any longer, and I've merged #1647, which adds the playground builds to CI.

@jessarcher jessarcher closed this Aug 16, 2023
@jessarcher jessarcher deleted the build-playgrounds branch August 16, 2023 03:39
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.

1 participant