Skip to content

Commit

Permalink
fix(eslint-plugin): [no-unsafe-return] error with <TS3.7 (#1815)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Mar 28, 2020
1 parent 1e29e69 commit f3160b4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/eslint-plugin/src/util/types.ts
Expand Up @@ -323,7 +323,12 @@ export function isAnyOrAnyArrayTypeDiscriminated(
}
if (
checker.isArrayType(type) &&
isTypeAnyType(checker.getTypeArguments(type)[0])
isTypeAnyType(
// getTypeArguments was only added in TS3.7
checker.getTypeArguments
? checker.getTypeArguments(type)[0]
: (type.typeArguments ?? [])[0],
)
) {
return AnyType.AnyArray;
}
Expand Down

0 comments on commit f3160b4

Please sign in to comment.