Reputation: 6964
Problem
For example, the parameter has the following type { component: any; element: ElementRef; }
, of which I only want the element:
onTextBoxInit({ element }) { }
Question: How can I set the type of this destructured element?
Tried
I thought of something like this: onTextBoxInit({ element: ElementRef }) { }
, however this is not working.
Upvotes: 13
Views: 10160
Reputation: 249486
You need to specify the type of the argument after the destructuring expression
onTextBoxInit({ element }: {element: ElementRef }){}
Upvotes: 26