Skip to content

Commit

Permalink
fix(eslint-plugin): no-type-alias: fix typeof alias erroring (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
skeate authored and bradzacher committed Mar 27, 2019
1 parent bf04398 commit cebcfe6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/eslint-plugin/src/rules/no-type-alias.ts
Expand Up @@ -108,6 +108,7 @@ export default util.createRule<Options, MessageIds>({
AST_NODE_TYPES.TSArrayType,
AST_NODE_TYPES.TSTypeReference,
AST_NODE_TYPES.TSLiteralType,
AST_NODE_TYPES.TSTypeQuery,
];

type CompositionType = TSESTree.TSUnionType | TSESTree.TSIntersectionType;
Expand Down
8 changes: 8 additions & 0 deletions packages/eslint-plugin/tests/rules/no-type-alias.test.ts
Expand Up @@ -364,6 +364,14 @@ type Foo<T> = {
},
],
},
{
code: 'type Foo = typeof bar;',
options: [{ allowAliases: 'always' }],
},
{
code: 'type Foo = typeof bar | typeof baz;',
options: [{ allowAliases: 'in-unions' }],
},
],
invalid: [
{
Expand Down

0 comments on commit cebcfe6

Please sign in to comment.