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

compat PureComponent parity with upstream react type definitions #4056

Merged
merged 2 commits into from
Nov 6, 2023

Conversation

HK47196
Copy link
Contributor

@HK47196 HK47196 commented Jun 30, 2023

PureComponent parity with react type definitions, fixes palantir/blueprint#5498 + similar issues in blueprint when using preact, as many of the components extend PureComponent.

cf https://github.com/DefinitelyTyped/DefinitelyTyped/blob/b28468368df0b6ed8d4cf33683cc46087004d4f4/types/react/index.d.ts#L537

Type parity with upstream for PureComponent
@@ -106,7 +106,7 @@ declare namespace React {
component: preact.Component | Element
): Element | null;

export abstract class PureComponent<P = {}, S = {}> extends preact.Component<
export abstract class PureComponent<P = {}, S = {}, SS = any> extends preact.Component<
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we then also accept this on Component to orchestrate typings for getSnapshotBeforeUpdate as React does

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I actually have no idea about any of that as I'm pretty new to using React/Preact, just thought I'd contribute a fix to get Blueprint working since it's just a small issue with types.

@ricardobeat
Copy link

@JoviDeCroock any chance this will be merged? Looking into using Blueprint with Preact as well.

@coveralls
Copy link

Coverage Status

coverage: 99.429%. remained the same
when pulling e13cd64 on Blufords:patch-2
into 3c5aad6 on preactjs:main.

@JoviDeCroock JoviDeCroock merged commit 046af87 into preactjs:main Nov 6, 2023
2 checks passed
@JoviDeCroock JoviDeCroock mentioned this pull request Nov 10, 2023
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.

Type errors when using Preact with Typescript
4 participants