Open
Description
There is a common TypeScript issue where a property on an object is assumed to exists.
// allUserTokensList is type Token[]
const tokenIndex = allUserTokensList.findIndex(matchTokenDenom(denom));
// token is of type Token not Token | undefined
const token = allUserTokensList[tokenIndex];
This is a long and divisive issue in TypeScript microsoft/TypeScript#13778 because flagged all items found by index can be problematic in many places that they are expected to be known. However as a resolution, a --noUncheckedIndexedAccess flag can be used to turn on checking for this.
This has caused runtime errors in the past and I would prefer to be able to see these errors if feasible.
Metadata
Metadata
Assignees
Labels
No labels