String.prototype.split()
with a regex containing a capturing group can return an array of string | undefined
.
#60941
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
⚙ Compilation target
any
⚙ Library
esnext, dom
Missing / Incorrect Definition
Using split with a negative lookahead and a capturing group can return undefined. See the attached screenshot. When iterating over the array, we lose type safety and encounter runtime errors.
Sample Code
Documentation Link
No response
The text was updated successfully, but these errors were encountered: