Skip to content

Commit

Permalink
Increase type safety on accessing arrays by index
Browse files Browse the repository at this point in the history
  • Loading branch information
MWhite-22 committed Jun 27, 2022
1 parent 755121f commit 030d19b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"useUnknownInCatchVariables": true,
"noUncheckedIndexedAccess": true, // TLDR - Checking an indexed value (array[0]) now forces type <T | undefined> as there is no confirmation that index exists
// THE BELOW ARE EXTRA STRICT OPTIONS THAT SHOULD ONLY BY CONSIDERED IN VERY SAFE PROJECTS
// "exactOptionalPropertyTypes": true, // TLDR - Setting to undefined is not the same as a property not being defined at all
// "noPropertyAccessFromIndexSignature": true, // TLDR - Use dot notation for objects if youre sure it exists, use ['index'] notaion if unsure
// "noUncheckedIndexedAccess": true, // TLDR - Assigning an indexed value to a variable will force a <T | undefined> type if the param isn't confirmed to exist

/* OTHER OPTIONS */
"allowSyntheticDefaultImports": true,
Expand Down

0 comments on commit 030d19b

Please sign in to comment.