From aebaf7965face5d46dd06fa3ef7bc65fd295836b Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Sun, 16 Mar 2025 23:34:03 +0800 Subject: [PATCH] feat!: turn on noUncheckedIndexedAccess for libraries See https://www.semver-ts.org/formal-spec/5-compiler-considerations.html#strictness for the arguments for turning on noUncheckedIndexedAccess for libraries. In short, it helps prevent shipping accidental breaking type changes to library consumers. (Note the link also suggests turning on `exactOptionalPropertyTypes`, but I still have doubts about it, as it would not be helpful without a specific coding style, which is hard to enforce.) --- tsconfig.lib.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tsconfig.lib.json b/tsconfig.lib.json index 964598a..3ce7121 100644 --- a/tsconfig.lib.json +++ b/tsconfig.lib.json @@ -8,6 +8,8 @@ // Libraries generally require more strict type accuracy. // For example, its types must be compatible with the Vue types. // So we don't want to skip the type checking of its dependencies. - "skipLibCheck": false + "skipLibCheck": false, + + "noUncheckedIndexedAccess": true } }