TypeScript: Poll: Name a compiler option for including `undefined` when a property resolves to an index signature
We need a name for the option described in #13778
The exact behavior that this flag would enable is, briefly:
- Read expressions of the form
expr[i]will now beT | undefinedwhereTis the index signature type - Read expressions of the form
expr.propwill now beT | undefinedwhereTis the index signature type if an index signature onexprexists but not a declared property namedprop stringandnumberindex signatures are both subjected to this treatment- Write expressions
expr[i] = vandexpr.prop = vare unaffected - Type expressions
TypeName[number]andTypeName["prop"]are unaffected
Good candidate flag names should follow these rules and goals:
- Do not start with
strictsince this flag would not get turned on by the global--strictsetting - Follow an existing convention (see the list at (https://aka.ms/tsconfig.json)
- Convey the intent of the flag along with its behavior, somehow
- Avoid problematic terms (e.g. do not reference mental illnesses)
This is an open-ended approval voting issue. Rules:
- Use 👍 reaction on as many as you like
- Top-upvoted options will be given the most consideration
- This is an advisory vote; final say is still up to the TypeScript team
- You may propose new options; comments must be of exactly the form `–proposedOptionName`
- Follow the above guidance - no
--strictFoo!
- Follow the above guidance - no
- No discussion here; discuss in #13778. Non-option comments will be deleted
- Sharing this link on social media is encouraged!
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.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 19 (10 by maintainers)
--noUncheckedIndexedAccess--safeIndexAccess--pedanticIndexSignaturesI 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).--indexNullChecks(like--strictNullChecksbut for index access)--includeUndefinedInIndexAccess--noImplicitBounds--undefinedIndexSignatures--includeUndefinedInIndexSignatures--skepticalIndexAccesses--checkIndexedAccess--soundIndexedAccess--rigorousIndexAccessWe have a winner 🥇
--uncertainIndexAccessPersonally I feel the name should highlight the aspect of uncertainty introduced here, rather than the aspect of strictness.
--partialIndexedAccess