File tree 3 files changed +34
-2
lines changed
3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ namespace ts.codefix {
47
47
48
48
startPosition = baseProp . valueDeclaration . pos ;
49
49
endPosition = baseProp . valueDeclaration . end ;
50
+ file = getSourceFileOfNode ( baseProp . valueDeclaration ) ;
50
51
}
51
52
else {
52
53
Debug . fail ( "fixPropertyOverrideAccessor codefix got unexpected error code " + code ) ;
Original file line number Diff line number Diff line change @@ -229,8 +229,11 @@ namespace ts.codefix {
229
229
while ( decl ) {
230
230
const superElement = getClassExtendsHeritageElement ( decl ) ;
231
231
const superSymbol = superElement && checker . getSymbolAtLocation ( superElement . expression ) ;
232
- const superDecl = superSymbol && find ( superSymbol . declarations , isClassLike ) ;
233
- if ( superDecl ) { res . push ( superDecl ) ; }
232
+ if ( ! superSymbol ) break ;
233
+ const symbol = superSymbol . flags & SymbolFlags . Alias ? checker . getAliasedSymbol ( superSymbol ) : superSymbol ;
234
+ const superDecl = find ( symbol . declarations , isClassLike ) ;
235
+ if ( ! superDecl ) break ;
236
+ res . push ( superDecl ) ;
234
237
decl = superDecl ;
235
238
}
236
239
return res ;
Original file line number Diff line number Diff line change
1
+ /// <reference path='fourslash.ts' />
2
+
3
+ // @strict : true
4
+
5
+ // @Filename : foo.ts
6
+ //// import { A } from './source'
7
+ //// class B extends A {
8
+ //// get x() { return 2 }
9
+ //// }
10
+ // @Filename : source.ts
11
+ //// export class A {
12
+ //// x = 1
13
+ //// }
14
+
15
+ verify . codeFix ( {
16
+ description : `Generate 'get' and 'set' accessors` ,
17
+ newFileContent : {
18
+ '/tests/cases/fourslash/source.ts' : `export class A {
19
+ private _x = 1;
20
+ public get x() {
21
+ return this._x;
22
+ }
23
+ public set x(value) {
24
+ this._x = value;
25
+ }
26
+ }` } ,
27
+ index : 0
28
+ } )
You can’t perform that action at this time.
0 commit comments