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] deprecate Toaster in favor of OverlayToaster #6146

Merged
merged 1 commit into from
May 11, 2023

Conversation

adidahiya
Copy link
Contributor

Changes proposed in this pull request:

Properly deprecate Toaster API in favor of OverlayToaster, for forwards-compatibility with v5.0. See https://github.com/palantir/blueprint/wiki/Toaster-5.0-changes

This is most commonly referenced in user code like this:

- const myToaster = Toaster.create();
+ const myToaster = OverlayToaster.create();

Also mark IToasterProps as deprecated, to be replaced by OverlayToasterProps. We can auto-fix this type with the no-deprecated-type-references lint rule, but we don't have the no-deprecated-components rule set up to auto-fix components right now.

@adidahiya adidahiya enabled auto-merge (squash) May 11, 2023 18:22
@adidahiya
Copy link
Contributor Author

[core] deprecate Toaster in favor of OverlayToaster

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 c4162c2 into develop May 11, 2023
@adidahiya adidahiya deleted the ad/overlay-toaster-2 branch May 11, 2023 18:28
Comment on lines +278 to +279
// eslint-disable-next-line @typescript-eslint/no-redeclare
export type Toaster = ToasterInstance;
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, sorry about that, thanks for flagging. I suppose I could fix this by changing it to:

Suggested change
// eslint-disable-next-line @typescript-eslint/no-redeclare
export type Toaster = ToasterInstance;
// eslint-disable-next-line @typescript-eslint/no-redeclare
export type Toaster = typeof OverlayToaster;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened a PR: #6165

Copy link
Contributor

Choose a reason for hiding this comment

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

It should probably just be deleted until v5 to avoid complications.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think removing this line will be backwards-compatible.

Before, Toaster was a class, so it could be referenced as a type or a value.

After this change, it's re-exported as a value with const Toaster = OverlayToaster. But that will break existing usage of Toaster as a type (you could work around this with typeof Toaster).

To restore Toaster as a type in the public API, I think we need an export type Toaster = ... statement.

Copy link
Contributor

@dlech dlech May 16, 2023

Choose a reason for hiding this comment

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

👍 makes sense.

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.

None yet

2 participants