react-native-html-parser icon indicating copy to clipboard operation
react-native-html-parser copied to clipboard

QuerySelect is named as QuerySelector in the official documentation

Open rzinnatullin opened this issue 4 years ago • 3 comments

I'm using Type Script, and there's already the types for the official DOMParser types. Here are the types for QuerySelector function: image 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: image

Any reason for having a different name? Can this be fixed?

rzinnatullin avatar Feb 05 '21 07:02 rzinnatullin

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'.

mpestka avatar Feb 22 '21 16:02 mpestka

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?

adbalits avatar Jun 04 '21 01:06 adbalits

Created advanced-html-parser and added more feature and typescript support. Please check it out.

AlenToma avatar Feb 02 '22 23:02 AlenToma