Reputation: 13
Is it possible to use parse5 in a typescript project? parse5 home page It was written in javascript and the documentation only uses javascript as well.
const parse5 = require('parse5')
If not I have had trouble finding anything that is as fully featured as that for typescript. The main feature I need is keeping track of the location in the DOM.
Upvotes: 0
Views: 939
Reputation: 14078
You can use any JavaScript package in TypeScript, as long as you have type definitions.
Many npm packages have corresponding type definitions (thanks to Definitely Typed) at @types/packagename
(example: @types/parse5
). Simply install the package (npm i -D @types/parse5
) and TypeScript will automatically find the type definitions for parse5
.
Upvotes: 1