You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
strictNullCheck Errors caused by accessing array attributes like .pop in a while loop #23403
Relevant Information
This is a pretty common practice in webpack to use a queue to perform breadth first search traversals of our dependency graph in the fastest means possible. So it would be nice to not have to @ts-ignore this line
Seems like there are two ways to go here, either change the definition of pop to be "optimistic" and not return undefined, that will be inline with array indexing not containing undefined, or go with the more explicit option in #23405. The first approach seems rather targeted, and i am sure this will come up again. so #23405 seems like a better investment here.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
jack-williams commentedon Apr 13, 2018
Seems like a good use-case for a definite assignment assertion.I think applying narrowing to this case might be tricky because of possible side effects.DanielRosenwasser commentedon Apr 13, 2018
Sean didn't mention it, but this was in a JavaScript file, and we don't have non-null assertion syntax there.
DanielRosenwasser commentedon Apr 13, 2018
Just opened up #23405.
jack-williams commentedon Apr 13, 2018
Ah sorry. Then my suggestion is redundant.
mhegazy commentedon Apr 16, 2018
Seems like there are two ways to go here, either change the definition of
popto be "optimistic" and not returnundefined, that will be inline with array indexing not containingundefined, or go with the more explicit option in #23405. The first approach seems rather targeted, and i am sure this will come up again. so #23405 seems like a better investment here.The underlying issue is discussed in #9998.
Closing in favor of #23405.
typescript-bot commentedon May 1, 2018
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.