Thanks to visit codestin.com
Credit goes to github.com

Skip to content

test(typescript-estree): add missing test for union and intersection #2999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading