Skip to content

Commit e91aa36

Browse files
committed
refactor: replace direct type check with isLiteral utility in isStringLiteral function
1 parent 42278fe commit e91aa36

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/node-utils/accessors.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
type TSESTree,
55
} from '@typescript-eslint/utils';
66

7+
import { isLiteral } from './is-node-of-type';
8+
79
/**
810
* A `Literal` with a `value` of type `string`.
911
*/
@@ -22,7 +24,7 @@ const isStringLiteral = <V extends string>(
2224
node: TSESTree.Node,
2325
value?: V
2426
): node is StringLiteral<V> =>
25-
node.type === AST_NODE_TYPES.Literal &&
27+
isLiteral(node) &&
2628
typeof node.value === 'string' &&
2729
(value === undefined || node.value === value);
2830

0 commit comments

Comments
 (0)