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

Feature request: do not generate default clause. #5

Open
safareli opened this issue Oct 18, 2020 · 2 comments
Open

Feature request: do not generate default clause. #5

safareli opened this issue Oct 18, 2020 · 2 comments

Comments

@safareli
Copy link

First of all thanks for this extension it's very useful!

Curious what's the point of default clause in generated code? As this plugin is listing out all the cases I don't see one. Default is just unreachable. I would like to propose to remove the default clause, or add a flag that would allow to override this behavior.

Thanks!

@heroboy
Copy link
Owner

heroboy commented Oct 20, 2020

Although typescript is a strict language. But due to any, type cast and being called from javascript, we should always write the default for safety.
And typescript compiler doesn't tell the default clause is unreachable, when the case clauses enumerate all possible values.

@safareli
Copy link
Author

I use strict mode and do not use any. and I don't need to use default. It's ok if you want this plugin to be opinionated, but I think if you were to add flag to toggle this feature, this plugin would be more attractive to people who do not want default clause.

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

No branches or pull requests

2 participants