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

Commit0a6d4db

Browse files
committed
fix(typescript-estree): Report duplicateextends caluse forinterface
1 parentbe558e5 commit0a6d4db

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

‎packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/1-TSESTree-Error.shot

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/3-Alignment-Error.shot

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎packages/ast-spec/tests/fixtures-with-differences-errors.shot

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎packages/typescript-estree/src/convert.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3025,14 +3025,23 @@ export class Converter {
30253025
constinterfaceExtends:TSESTree.TSInterfaceHeritage[]=[];
30263026

30273027
for(constheritageClauseofinterfaceHeritageClauses){
3028-
if(heritageClause.token!==SyntaxKind.ExtendsKeyword){
3028+
constisExtendsClause=
3029+
heritageClause.token===SyntaxKind.ExtendsKeyword;
3030+
3031+
if(!isExtendsClause){
30293032
this.#throwError(
30303033
heritageClause,
30313034
heritageClause.token===SyntaxKind.ImplementsKeyword
30323035
?"Interface declaration cannot have 'implements' clause."
30333036
:'Unexpected token.',
30343037
);
30353038
}
3039+
if(isExtendsClause&&interfaceExtends.length!==0){
3040+
this.#throwUnlessAllowInvalidAST(
3041+
heritageClause,
3042+
"'extends' clause already seen.",
3043+
);
3044+
}
30363045

30373046
for(constheritageTypeofheritageClause.types){
30383047
interfaceExtends.push(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp