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

feat(type): specify a stricter type for the type argument #222

Open
Char2sGu opened this issue Oct 1, 2021 · 0 comments
Open

feat(type): specify a stricter type for the type argument #222

Char2sGu opened this issue Oct 1, 2021 · 0 comments
Labels
BREAKING CHANGE Indicates a breaking change type: feature Indicates a feature or enhancement

Comments

@Char2sGu
Copy link

Char2sGu commented Oct 1, 2021

The current type of the type argument is string, which may cause errors if we typed a wrong value.

But if we specify the type to 'default' | 'info' | 'success' | 'warning' | 'error', we can have not only stricter type checks but also auto-completion support from the editor.

type NotificationType = 'default' | 'info' | 'success' | 'warning' | 'error';

class NotifierService {
  ...
  notify(type: NotificationType, ...) {
    ...
  }
  ...
}
@dominique-mueller dominique-mueller added BREAKING CHANGE Indicates a breaking change type: feature Indicates a feature or enhancement labels Feb 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BREAKING CHANGE Indicates a breaking change type: feature Indicates a feature or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants