Pioneer Frontend Developer, currently Software Engineer at SinnerSchrader. Proactive person. Love functional and clean UI. Interest in architecture, cloud, and public speaking.
I came up with the idea, that throwing an error inside the function solely created for this purpose (in your case exhaustiveCheck) feels somehow odd. Throwing the error directly (e.g. UnsupportedValueError(x)) or declaring the output type for the function explicitly feels more natural. For interested, both cases are described in detail here: 2ality.com/2020/02/typescript-exha....
imho using a helper library that replicates the switch for exhaustive checking which is already supported by the typescript feels unnecessary.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I came up with the idea, that throwing an error inside the function solely created for this purpose (in your case
exhaustiveCheck
) feels somehow odd. Throwing the error directly (e.g.UnsupportedValueError(x)
) or declaring the output type for the function explicitly feels more natural. For interested, both cases are described in detail here: 2ality.com/2020/02/typescript-exha....imho using a helper library that replicates the switch for exhaustive checking which is already supported by the typescript feels unnecessary.