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

[core] fix Toaster type backcompat, better OverlayToaster docs #6165

Merged
merged 6 commits into from
May 17, 2023

Conversation

adidahiya
Copy link
Contributor

Fixes a regression in the Toaster type. Previously, this was assignable to the type of the whole class component, which includes more methods than simply ToasterInstance.

See https://github.com/palantir/blueprint/pull/6146/files#r1195378467

@adidahiya
Copy link
Contributor Author

[core] fix: backwards-compatibility of Toaster type

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@adidahiya
Copy link
Contributor Author

Here's a demo of the difference between the old type and the new (fixed for backcompat) type:

old

image

new:

2023-05-16 14 19 52

@adidahiya
Copy link
Contributor Author

adjust type

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@adidahiya
Copy link
Contributor Author

@adidahiya
Copy link
Contributor Author

6b5d423 was still problematic and had this compatibility issue:

Type 'AbstractPureComponent2<OverlayToasterProps, {}, {}> & ToasterInstance' is missing the following properties from type 'OverlayToaster': toastId, isNewToastKey, dismissIfAtLimit, renderToast, and 4 more.ts(2322)

the correct fix is to use the simplest type alias: type Toaster = OverlayToaster 🤦🏽

@adidahiya
Copy link
Contributor Author

adjust type again, add regresison test

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@adidahiya
Copy link
Contributor Author

distinguish between ref callbacks and objects

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@adidahiya adidahiya changed the title [core] fix: backwards-compatibility of Toaster type [core] fix Toaster type backcompat, better OverlayToaster docs May 17, 2023
@adidahiya
Copy link
Contributor Author

fix code example, add one test

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@adidahiya adidahiya merged commit b9d7d5f into develop May 17, 2023
@adidahiya adidahiya deleted the ad/fix-toaster-type-regression branch May 17, 2023 04:54
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