Fix implement interface codefix for synthetic member symbols (#35718)

This commit is contained in:
Andrew Branch 2019-12-18 07:20:01 -08:00 committed by GitHub
parent 2eb60c2cb2
commit aef2e0a238
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View File

@ -34,7 +34,7 @@ namespace ts.codefix {
}
function symbolPointsToNonPrivateMember (symbol: Symbol) {
return !(getModifierFlags(symbol.valueDeclaration) & ModifierFlags.Private);
return !symbol.valueDeclaration || !(getModifierFlags(symbol.valueDeclaration) & ModifierFlags.Private);
}
function addMissingDeclarations(

View File

@ -0,0 +1,30 @@
/// <reference path="fourslash.ts" />
////interface One {
//// a: number;
//// b: string;
////}
////
////interface Two extends Omit<One, "a"> {
//// c: boolean;
////}
////
////class TwoStore implements Two {[| |]}
verify.codeFix({
description: "Implement interface 'Two'",
newFileContent:
`interface One {
a: number;
b: string;
}
interface Two extends Omit<One, "a"> {
c: boolean;
}
class TwoStore implements Two {
c: boolean;
b: string;
}`,
});