Description
This error occurs after vSCode is updated.
code example:
views/view.model.ts
export class View$Model {
get closestModelView(this: View): View {
return this.closest(x => x.isModel == true || x.isTemplate);
}
get closestModel(this: View): Model {
var view = this.closestModelView;
if (view) {
return view.model;
}
return null;
}
}
view.ts
///<reference path='views/view.model.ts'/>
export class View extends ViewParse.Plug.BaseControl{ ... }
export interface View {
on(name:'click',fn:(view:View)=>void)
....
}
export interface View extends View$Model { }
Util.inherit(View, View$Model)
tsconfig.json
{
"compilerOptions": {
"outFile": "../ts/view.js",
"declaration": true,
"target": "es6",
"removeComments": true,
"sourceMap": true
}
}
current typescript version:3.9.5
current @types/node version:14.0.14
current vscode version:1.45.1
the "this: View" Will report an error, prompt: 'get' and 'set' accessors cannot declare 'this' parameters.
I know what this error message means, but it's always been written like this.
Has Typescript tweaked its rules?
I don't want to change the code. I don't like code that is too long for a single file, and I have a lot of code to change.This pattern simulates partial classes.
I want to know what to do about it, the reduced version, the special quote statement, or what?
I have checked the sample question, but no one mentioned it。
This happens every time you compile, which is bad. To seek help