Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(ts-estree): align typeArguments and typeParameters across nodes#223

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JamesHenry merged 1 commit intotypescript-eslint:masterfromarmano2:type-arguments-parameters
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes fromall 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
2,284 changes: 2,284 additions & 0 deletionspackages/parser/tests/lib/__snapshots__/typescript.ts.snap
View file
Open in desktop

Large diffs are not rendered by default.

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
foo<>();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
new Foo<>()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
function f1<>() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
class foo {
constructor<>() {}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
const foo = function<>() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
interface foo {
test<>();
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
class foo {
test<>() {}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
function f1<>() {}
22 changes: 11 additions & 11 deletionspackages/typescript-estree/src/convert.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -690,7 +690,7 @@ export class Converter {
}

// Process typeParameters
if (node.typeParameters && node.typeParameters.length) {
if (node.typeParameters) {
result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
node.typeParameters
);
Expand DownExpand Up@@ -897,7 +897,7 @@ export class Converter {
}

// Process typeParameters
if (node.typeParameters && node.typeParameters.length) {
if (node.typeParameters) {
method.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
node.typeParameters
);
Expand DownExpand Up@@ -1003,7 +1003,7 @@ export class Converter {
});

// Process typeParameters
if (node.typeParameters && node.typeParameters.length) {
if (node.typeParameters) {
constructor.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
node.typeParameters
);
Expand DownExpand Up@@ -1060,7 +1060,7 @@ export class Converter {
}

// Process typeParameters
if (node.typeParameters && node.typeParameters.length) {
if (node.typeParameters) {
result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
node.typeParameters
);
Expand DownExpand Up@@ -1159,7 +1159,7 @@ export class Converter {
}

// Process typeParameters
if (node.typeParameters && node.typeParameters.length) {
if (node.typeParameters) {
result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
node.typeParameters
);
Expand DownExpand Up@@ -1368,7 +1368,7 @@ export class Converter {
}
}

if (node.typeParameters && node.typeParameters.length) {
if (node.typeParameters) {
result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
node.typeParameters
);
Expand DownExpand Up@@ -1640,7 +1640,7 @@ export class Converter {
callee: this.convertChild(node.expression),
arguments: node.arguments.map(el => this.convertChild(el))
});
if (node.typeArguments && node.typeArguments.length) {
if (node.typeArguments) {
result.typeParameters = this.convertTypeArgumentsToTypeParameters(
node.typeArguments
);
Expand All@@ -1656,7 +1656,7 @@ export class Converter {
? node.arguments.map(el => this.convertChild(el))
: []
});
if (node.typeArguments && node.typeArguments.length) {
if (node.typeArguments) {
result.typeParameters = this.convertTypeArgumentsToTypeParameters(
node.typeArguments
);
Expand DownExpand Up@@ -2060,7 +2060,7 @@ export class Converter {
}

// Process typeParameters
if (node.typeParameters && node.typeParameters.length) {
if (node.typeParameters) {
result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
node.typeParameters
);
Expand DownExpand Up@@ -2216,7 +2216,7 @@ export class Converter {
expression: this.convertChild(node.expression)
});

if (node.typeArguments && node.typeArguments.length) {
if (node.typeArguments) {
result.typeParameters = this.convertTypeArgumentsToTypeParameters(
node.typeArguments
);
Expand All@@ -2236,7 +2236,7 @@ export class Converter {
id: this.convertChild(node.name)
});

if (node.typeParameters && node.typeParameters.length) {
if (node.typeParameters) {
result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
node.typeParameters
);
Expand Down
5 changes: 4 additions & 1 deletionpackages/typescript-estree/tests/ast-alignment/utils.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -262,7 +262,10 @@ export function preprocessBabylonAST(ast: any): any {
/**
* babel issue: ranges of typeParameters are not included in FunctionExpression range
*/
if (node.typeParameters) {
if (
node.typeParameters &&
node.typeParameters.range[0] < node.range[0]
) {
node.range[0] = node.typeParameters.range[0];
node.loc.start = Object.assign({}, node.typeParameters.loc.start);
}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2075,6 +2075,22 @@ Object {

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

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

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

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/enum-with-keywords.src 1`] = `
Object {
"column": 7,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp