TypeScript: How to set type of destructured object?

后端 未结 1 1488
别那么骄傲
别那么骄傲 2020-12-11 07:02

Problem

For example, the parameter has the following type { component: any; element: ElementRef; }, of which I only want the element:

1条回答
  •  醉酒成梦
    2020-12-11 07:32

    You need to specify the type of the argument after the destructuring expression

     onTextBoxInit({ element }: {element: ElementRef }){} 
    

    0 讨论(0)
提交回复
热议问题