Skip to content

Commit

Permalink
fix(typescript-estree): support override modifier for parameter prope…
Browse files Browse the repository at this point in the history
…rty (#3485)
  • Loading branch information
sosukesuzuki committed Jun 9, 2021
1 parent 44452dd commit 33b9f69
Show file tree
Hide file tree
Showing 16 changed files with 1,249 additions and 0 deletions.
Expand Up @@ -12,6 +12,7 @@ export interface TSParameterProperty extends BaseNode {
readonly?: boolean;
static?: boolean;
export?: boolean;
override?: boolean;
parameter: AssignmentPattern | BindingName | RestElement;
decorators?: Decorator[];
}
@@ -0,0 +1,3 @@
class SpecializedComponent extends SomeComponent {
constructor(protected override readonly param: string) {}
}
@@ -0,0 +1,5 @@
class SpecializedComponent extends SomeComponent {
constructor(override param: string) {
super();
}
}
2 changes: 2 additions & 0 deletions packages/typescript-estree/src/convert.ts
Expand Up @@ -1585,6 +1585,8 @@ export class Converter {
hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined,
static: hasModifier(SyntaxKind.StaticKeyword, node) || undefined,
export: hasModifier(SyntaxKind.ExportKeyword, node) || undefined,
override:
hasModifier(SyntaxKind.OverrideKeyword, node) || undefined,
parameter: result,
});
}
Expand Down
Expand Up @@ -386,6 +386,12 @@ tester.addFixturePatternConfig('typescript/basics', {
* This is intentional; babel is not checking types
*/
'catch-clause-with-invalid-annotation',
/**
* [BABEL ERRORED, BUT TS-ESTREE DID NOT]
* SyntaxError: Unexpected token, expected ","
*/
'class-with-constructor-and-parameter-property-with-modifiers',
'class-with-constructor-and-parameter-proptery-with-override-modifier',
],
ignoreSourceType: [
/**
Expand Down
Expand Up @@ -1746,6 +1746,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e

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

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

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

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

0 comments on commit 33b9f69

Please sign in to comment.