From 107aa169cd04d9f2fe2b70f89dec0b37e9feef16 Mon Sep 17 00:00:00 2001 From: so1ve Date: Mon, 31 Jul 2023 23:44:12 +0800 Subject: [PATCH] fix: make sure typeAnnotation exists --- source/is.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/is.ts b/source/is.ts index 848564a..dd291c0 100644 --- a/source/is.ts +++ b/source/is.ts @@ -8,7 +8,7 @@ import { TSESTree as es } from "@typescript-eslint/experimental-utils"; export function hasTypeAnnotation( node: T ): node is T & { typeAnnotation: es.TSTypeAnnotation } { - return node.hasOwnProperty("typeAnnotation"); + return "typeAnnotation" in node && !!node.typeAnnotation; } export function isArrayExpression(node: es.Node): node is es.ArrayExpression {