diff --git a/.all-contributorsrc b/.all-contributorsrc index 9302be7a782e..83cf734ca4ed 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -400,6 +400,13 @@ "avatar_url": "https://avatars.githubusercontent.com/u/16860535?v=4", "profile": "https://github.com/soobing", "contributions": [] + }, + { + "login": "RebeccaStevens", + "name": "Rebecca Stevens", + "avatar_url": "https://avatars.githubusercontent.com/u/7224206?v=4", + "profile": "https://github.com/RebeccaStevens", + "contributions": [] } ], "contributorsPerLine": 5 diff --git a/packages/eslint-plugin/src/util/isTypeReadonly.ts b/packages/eslint-plugin/src/util/isTypeReadonly.ts index b10f00006ec5..4a42c90c1e05 100644 --- a/packages/eslint-plugin/src/util/isTypeReadonly.ts +++ b/packages/eslint-plugin/src/util/isTypeReadonly.ts @@ -23,7 +23,12 @@ function isTypeReadonlyArrayOrTuple( seenTypes: Set, ): Readonlyness { function checkTypeArguments(arrayType: ts.TypeReference): Readonlyness { - const typeArguments = checker.getTypeArguments(arrayType); + const typeArguments = + // getTypeArguments was only added in TS3.7 + checker.getTypeArguments + ? checker.getTypeArguments(arrayType) + : arrayType.typeArguments ?? []; + // this shouldn't happen in reality as: // - tuples require at least 1 type argument // - ReadonlyArray requires at least 1 type argument