Skip to content

Commit f3160b4

Browse files
authored
fix(eslint-plugin): [no-unsafe-return] error with <TS3.7 (typescript-eslint#1815)
1 parent 1e29e69 commit f3160b4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/eslint-plugin/src/util/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,12 @@ export function isAnyOrAnyArrayTypeDiscriminated(
323323
}
324324
if (
325325
checker.isArrayType(type) &&
326-
isTypeAnyType(checker.getTypeArguments(type)[0])
326+
isTypeAnyType(
327+
// getTypeArguments was only added in TS3.7
328+
checker.getTypeArguments
329+
? checker.getTypeArguments(type)[0]
330+
: (type.typeArguments ?? [])[0],
331+
)
327332
) {
328333
return AnyType.AnyArray;
329334
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy