We need a name for the option described in #13778
The exact behavior that this flag would enable is, briefly:
expr[i]
will now be T | undefined
where T
is the index signature typeexpr.prop
will now be T | undefined
where T
is the index signature type if an index signature on expr
exists but not a declared property named prop
string
and number
index signatures are both subjected to this treatmentexpr[i] = v
and expr.prop = v
are unaffectedTypeName[number]
and TypeName["prop"]
are unaffectedGood candidate flag names should follow these rules and goals:
strict
since this flag would not get turned on by the global --strict
setting--strictFoo
!I will seed this with some of the names suggested at our last meeting. We may also cull options that aren't receiving a lot of votes to help keep the comment count manageable.
--pedanticIndexSignatures
--noUncheckedIndexedAccess
--undefinedIndexSignatures
--skepticalIndexAccesses
--noImplicitBounds
--rigorousIndexAccess
--carefulIndexAccess
--partialIndexedAccess
--maybeIndexAccess
--indexNullChecks
(like --strictNullChecks
but for index access)
--safeIndexAccess
--soundIndexedAccess
--uncertainIndexAccess
Personally I feel the name should highlight the aspect of uncertainty introduced here, rather than the aspect of strictness.
--includeUndefinedInIndexSignatures
--includeUndefinedInIndexAccess
--noUncheckedIndexedAccess
I think this one nails it, however I'd adjust it to --noUncheckedIndexAccess
(uncheck-ed and index-ed it a feels a bit too much of -ed).
--checkIndexedAccess
We have a winner 馃
Are you rolling with --noUncheckedIndexedAccess
or @alex-okrushko's suggested tweak of --noUncheckedIndexAccess
?
Most helpful comment
--noUncheckedIndexedAccess