react-native-html-parser
react-native-html-parser copied to clipboard
QuerySelect is named as QuerySelector in the official documentation
I'm using Type Script, and there's already the types for the official DOMParser types.
Here are the types for QuerySelector
function:
And this is the official documentation https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector
The problem is that for some reason in this package we have querySelect
instead of querySelector
, and this fact breaks type checking:
Any reason for having a different name? Can this be fixed?
similar issue with getElementsByAttribute
in typescript (although code works it does not compile in ts)
const doSomethingWithDocument = (document: HTMLDocument): void => {
const styledElements: HTMLCollectionOf<Element> = document.getElementsByAttribute('style');
...
error TS2339: Property 'getElementsByAttribute' does not exist on type 'HTMLDocument'.
Slightly off topic, but I tried yarn add --dev @types/react-native-html-parser
and it didn't work. Were you guys able to get TypeScript working with this package?
Created advanced-html-parser and added more feature and typescript support. Please check it out.