Skip to content

Commit cebcfe6

Browse files
skeatebradzacher
authored andcommitted
fix(eslint-plugin): no-type-alias: fix typeof alias erroring (#380)
1 parent bf04398 commit cebcfe6

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

packages/eslint-plugin/src/rules/no-type-alias.ts

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export default util.createRule<Options, MessageIds>({
108108
AST_NODE_TYPES.TSArrayType,
109109
AST_NODE_TYPES.TSTypeReference,
110110
AST_NODE_TYPES.TSLiteralType,
111+
AST_NODE_TYPES.TSTypeQuery,
111112
];
112113

113114
type CompositionType = TSESTree.TSUnionType | TSESTree.TSIntersectionType;

packages/eslint-plugin/tests/rules/no-type-alias.test.ts

+8
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,14 @@ type Foo<T> = {
364364
},
365365
],
366366
},
367+
{
368+
code: 'type Foo = typeof bar;',
369+
options: [{ allowAliases: 'always' }],
370+
},
371+
{
372+
code: 'type Foo = typeof bar | typeof baz;',
373+
options: [{ allowAliases: 'in-unions' }],
374+
},
367375
],
368376
invalid: [
369377
{

0 commit comments

Comments
 (0)