0

I define an object like this:

const obj = {
  func() {}
}

// Then I need to define some static props for the methods of this obj:

obj.func.prop1 = 1000;
obj.func.prop2 = 'some string';
obj.func.prop3 = () => {};

So, how to define the types for obj's methods?

Sunderam Dubey
  • 1
  • 11
  • 20
  • 40
JayceLin
  • 19
  • 2
  • Do you wanna define params for the methods? I am not getting your exact requirement. – rohithpoya Jun 26 '22 at 04:48
  • 2
    Does this answer your question? https://stackoverflow.com/questions/12766528/build-a-function-object-with-properties-in-typescript. In your case that would look like this: https://tsplay.dev/NDygxm – Alex Wayne Jun 26 '22 at 04:48

0 Answers0