fix(language-service): fix error of array-index out of bounds exception (#33928)
PR Close #33928
This commit is contained in:
@ -295,7 +295,8 @@ class TypeWrapper implements Symbol {
|
||||
if (nType) {
|
||||
// get the right tuple type by value, like 'var t: [number, string];'
|
||||
if (nType.isUnion()) {
|
||||
return new TypeWrapper(nType.types[value], this.context);
|
||||
// return undefined if array index out of bound.
|
||||
return nType.types[value] && new TypeWrapper(nType.types[value], this.context);
|
||||
}
|
||||
return new TypeWrapper(nType, this.context);
|
||||
}
|
||||
|
Reference in New Issue
Block a user