TS2683 (TS) 'this' implicitly has type 'any' because it does not have a type annotation

As some of the comments indicated, your this reference is not typed because you are using the function () {} syntax to define your function. The this object inside such a function will inherently be of type any , because this will be the caller of the function (unknowable at design-time).

If you change your syntax to an arrow function, like

pages = () => {

or simply omit the function keyword and arrow altogether, like

pages() {

then the this object inside the function will reference the class instance this instead of type any.

See the TypeScript handbook for more explanation.


Use explicit this annotation: pages = function(this: BaseResult) {

Tags:

Typescript