Remove extra checkDefined in visitEachChildOfJsxExpression#52482
Remove extra checkDefined in visitEachChildOfJsxExpression#52482jakebailey merged 1 commit intomicrosoft:mainfrom
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