-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Codefix for implementing interfaces #11547
Changes from 1 commit
1438f9a
7a5cb5f
bf3e487
6b4f6b5
151f940
d1cea73
c2feab6
f74872d
2abf906
132b746
ecc029f
a66b0ae
5d9a4e3
3ac9ffa
d24236b
7758e6d
7272833
834245c
c89b97b
16dc834
cbaea99
bc21346
99ae5d9
aa6ecd4
3240000
0380f3f
1b60a97
e5279fd
04968ab
d02eb6c
3b0b696
36c5bef
1b8486d
b7b30aa
71d1744
8c35185
bc1bb0e
0ce53f0
b26ba83
11cea6a
7141a2a
55bf3e3
4441380
1ec234a
6bd35fb
4973852
1d6ef6a
d842a6f
b1e97b3
c650c33
0591e1b
263734f
4b202ab
357ed7e
f6fc320
efd16c7
bba96da
cfe50d1
ad3035d
d8b359f
6400d53
c010a0e
395d736
d7d4bf6
a94d955
43afb80
6ed8d18
389959a
69118cd
4af0e2a
680af0f
16b146f
f37640a
5d6a714
bf48564
ba80ce6
8134d64
0c1772b
f0c7713
c511aea
5cd0ea3
c22e47d
c1a41b9
2f51b36
97b3d7a
819a654
5e48e33
1338b94
b9ae36c
d724517
469745b
1ba6c86
ad01110
3cfac08
4673812
4b02099
8be8819
d75d548
4af3937
97f18c9
3fc94bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,6 @@ namespace ts.codefix { | |
}]; | ||
} | ||
} | ||
|
||
return undefined; | ||
} | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -372,7 +372,7 @@ namespace ts { | |
export function isThis(node: Node): boolean { | ||
switch (node.kind) { | ||
case SyntaxKind.ThisKeyword: | ||
// case SyntaxKind.ThisType: TODO: GH#9267 | ||
// case SyntaxKind.ThisType: TODO: GH#9267 | ||
return true; | ||
case SyntaxKind.Identifier: | ||
// 'this' as a parameter | ||
|
@@ -1360,11 +1360,6 @@ namespace ts { | |
} | ||
|
||
export function getMissingAbstractMemberInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { | ||
const baseTypeNode: ExpressionWithTypeArguments = getClassExtendsHeritageClauseElement(classDecl); | ||
if (!baseTypeNode) { | ||
return ""; | ||
} | ||
|
||
const classSymbol = checker.getSymbolOfNode(classDecl); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It shouldn't return undefined. I've checked the case of exporting a default class (there is a symbol named However, I found an issue with the latter case where we don't get the implements type nodes correctly. Looking into this further. |
||
|
||
const InstantiatedExtendsType = <InterfaceType>checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl)); | ||
|
@@ -1377,9 +1372,6 @@ namespace ts { | |
|
||
export function getMissingInterfaceMembersInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { | ||
const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); | ||
if (!implementedTypeNodes || implementedTypeNodes.length === 0) { | ||
return ""; | ||
} | ||
|
||
const classSymbol = checker.getSymbolOfNode(classDecl); | ||
|
||
|
@@ -1445,7 +1437,6 @@ namespace ts { | |
function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { | ||
const name = symbol.getName(); | ||
const type = checker.getTypeOfSymbol(symbol); | ||
|
||
const decls = symbol.getDeclarations(); | ||
if (!(decls && decls.length)) { | ||
return ""; | ||
|
@@ -1465,7 +1456,7 @@ namespace ts { | |
return ""; | ||
} | ||
// TODO: (arozga) Deal with multiple signatures. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this todo in plan? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That will be a separate PR. |
||
const sigString = checker.signatureToString(sigs[0], enclosingDeclaration, TypeFormatFlags.WriteTypeArgumentsOfSignature | TypeFormatFlags.supressAnyReturnType, SignatureKind.Call); | ||
const sigString = checker.signatureToString(sigs[0], enclosingDeclaration, TypeFormatFlags.supressAnyReturnType, SignatureKind.Call); | ||
|
||
return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; | ||
default: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The format is a little hard to read