-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Remove extra checkDefined in visitEachChildOfJsxExpression #52482
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
Conversation
Checked all of the other EDIT: No, that's the opposite of the problem; we would need something which checks whether or not a result of a checkDefined is used only in a place which already accepts undefined. That's not really easily doable. (I was able to find one other place that calls |
export function checkDefined<T, U extends T | null | undefined>(
value: T | null | undefined,
message?: string,
stackCrawlMark?: AnyFunction
): U extends NonNullable<U> ? U : unknown {
assertIsDefined(value, message, stackCrawlMark || checkDefined);
return (value satisfies NonNullable<T> as any);
} |
FWIW, if I do that, here are the errors I see in
|
The first three appear to be cases where our factories accept string or The last one is this bug, so it did catch that at least. But I'm guessing if there were more, it would have caught them too (with the false positives present). |
Another way to do this would be to transform all |
I wrote the above transform and then ran eslint; this is in fact the only place we use checkDefined on a definitely defined value. Good to know that we don't have any more of these kinds of potential bugs. |
Fixes #52479