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

Explicitly declare 'children' props for React.FunctionComponent #1573

Merged
merged 2 commits into from
Jun 24, 2022
Merged

Explicitly declare 'children' props for React.FunctionComponent #1573

merged 2 commits into from
Jun 24, 2022

Conversation

stkao05
Copy link
Contributor

@stkao05 stkao05 commented Jun 6, 2022

Version 18 of @types/react introduces a breaking change - removal of implicit children props (ref). This introduces type error for some of the components

error TS2559: Type '{ children: Element; }' has no properties in common with type 'IntrinsicAttributes'.

       <AnimateSharedLayout>

The PR update the type definition to reflect this change.


Reference

@stkao05 stkao05 marked this pull request as ready for review June 6, 2022 11:06
@mattgperry
Copy link
Collaborator

Can you reopen with a Codesandbox reproduction of the error? These components all have props arguments already typed with React.PropsWithChildren.

@mattgperry mattgperry closed this Jun 7, 2022
@stkao05
Copy link
Contributor Author

stkao05 commented Jun 7, 2022

These components all have props arguments already typed with React.PropsWithChildren.

Because the component variable was typed as

export const AnimateSharedLayout: React.FunctionComponent = ...

The type definition AnimateSharedLayout.d.ts is outputted as

import * as React from "react";
export declare const AnimateSharedLayout: React.FunctionComponent;

Here is also the Codesandbox that demonstrates the type issue. Note that the type error only shows with the latest typing enabled @type/react: 18.0.12

@mattgperry mattgperry reopened this Jun 8, 2022
@mattgperry
Copy link
Collaborator

Thanks for the repro!

@mergetron mergetron bot merged commit dc5128e into framer:main Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants