Skip to content

Commit

Permalink
test(typescript-estree): add missing test for union and intersection (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Feb 5, 2021
1 parent ee927ee commit 214b11b
Show file tree
Hide file tree
Showing 4 changed files with 2,091 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let union: number | null | undefined;
let intersection: number & string;
let precedence1: number | string & boolean;
let precedence2: number & string | boolean;

type unionLeading = | number | string;
type intersectionLeading = | number & string;
type unionLeadingSingle = | number;
type intersectionLeadingSingle = & number;
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,13 @@ tester.addFixturePatternConfig('typescript/basics', {
/**
* [BABEL ERRORED, BUT TS-ESTREE DID NOT]
* babel hard fails on computed string enum members, but TS doesn't
* TODO: report this to babel
* https://github.com/babel/babel/issues/12683
*/
'export-named-enum-computed-string',
/**
* Babel: TSTypePredicate includes `:` statement in range
* ts-estree: TSTypePredicate does not include `:` statement in range
* TODO: report this to babel
* https://github.com/babel/babel/issues/12676
*/
'type-assertion-in-arrow-function',
'type-assertion-in-function',
Expand All @@ -395,6 +395,11 @@ tester.addFixturePatternConfig('typescript/basics', {
'catch-clause-with-invalid-annotation',
'export-type-star-from',
'import-type-error',
/**
* babel does not take into account leading character into union and intersection
* https://github.com/babel/babel/pull/12758
*/
'union-intersection',
],
ignoreSourceType: [
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/union-intersection.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/unique-symbol.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/unknown-type-annotation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
Expand Down

0 comments on commit 214b11b

Please sign in to comment.