Answer the question
In order to leave comments, you need to log in
How to use this in an arrow function in typescript?
I'm trying to use this in an arrow function, after specifying the type for this.
I get an error: An arrow function cannot have a 'this' parameter.ts(2730)
According to this PR ( https://github.com/Microsoft/TypeScript/pull/6739 ) in typescript you can use this in arrow functions in this way. There are absolutely no hints on the Internet to explain the TS2730 error. In general, I'm confused.
Answer the question
In order to leave comments, you need to log in
Judging by this PR in typescript, you can use this in arrow functions
This formulation is OK because lambda (=>) doesn't bind this, so this comes from the class instead of from the implementing function.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question