-1
@Bind()
sdffsf() {
 this.sdffsf.fff = 'sdfsd';
}

like this, typescript always reminds me fff didn't exist wanna know how to declare the interface of this method

4

1 Answer 1

0

I learned something new here.

I found this answer https://stackoverflow.com/a/28920916/13257176:

they also linked to TS this doc: https://www.typescriptlang.org/docs/handbook/2/functions.html#declaring-this-in-a-function

sdffsf(this: {sdffsf:{fff:string}}) {
   this.sdffsf.fff = 'sdfsd';
}

I did not test this, you might have to make this a function or class method. Ie:

function sdffsf(this: {sdffsf:{fff:string}}) {
   this.sdffsf.fff = 'sdfsd';
}

or

class x {
  sdffsf(this: {sdffsf:{fff:string}}) {
    this.sdffsf.fff = 'sdfsd';
  }
}
Sign up to request clarification or add additional context in comments.

1 Comment

really appreciate it, bro

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.