Skip to content

Commit aef2e0a

Browse files
authored
Fix implement interface codefix for synthetic member symbols (#35718)
1 parent 2eb60c2 commit aef2e0a

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace ts.codefix {
3434
}
3535

3636
function symbolPointsToNonPrivateMember (symbol: Symbol) {
37-
return !(getModifierFlags(symbol.valueDeclaration) & ModifierFlags.Private);
37+
return !symbol.valueDeclaration || !(getModifierFlags(symbol.valueDeclaration) & ModifierFlags.Private);
3838
}
3939

4040
function addMissingDeclarations(
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////interface One {
4+
//// a: number;
5+
//// b: string;
6+
////}
7+
////
8+
////interface Two extends Omit<One, "a"> {
9+
//// c: boolean;
10+
////}
11+
////
12+
////class TwoStore implements Two {[| |]}
13+
14+
verify.codeFix({
15+
description: "Implement interface 'Two'",
16+
newFileContent:
17+
`interface One {
18+
a: number;
19+
b: string;
20+
}
21+
22+
interface Two extends Omit<One, "a"> {
23+
c: boolean;
24+
}
25+
26+
class TwoStore implements Two {
27+
c: boolean;
28+
b: string;
29+
}`,
30+
});

0 commit comments

Comments
 (0)