I'm implementing a library in TypeScript and some functions are as follows:
constructor(type: TypeEnum, params: {[id:string]: any})
The thing is, whenever I use the library using js, I would like my IDE to display every single valid id
of params
. I have seen some libraries already do this, how do I achieve it?
CodePudding user response:
You can just set them explicitly as properties:
constructor(type: TypeEnum, params: { option1?: any, option2?: any })