Reputation: 787
What type I should use for jQuery elements?
Without jQuery I go on like this:
export class Modal {
constructor(protected element:HTMLElement) {
}
}
But, lets say element
will be a jQuery selector like $('.myDiv')
for example. What type should element
then have?
Upvotes: 26
Views: 15488
Reputation: 40642
After installing the types needed (npm install --save-dev @types/jquery
), you can type it as just JQuery
:
constructor(protected element: JQuery) {
}
Upvotes: 33