Typescript type errors
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- web-dev
Direzione di ricerca
Riproduci gli errori con TypeScript ed esamina le dichiarazioni in types/dom/parser.d.ts, types/html/anchor-element.d.ts e types/html/document.d.ts insieme a lib.dom.d.ts di TypeScript. Confronta le firme ereditate e implementate segnalate per determinare se i tipi possono essere riconciliati con le interfacce DOM globali. Il lavoro è completato quando gli errori di tipo segnalati non richiedono più tsc --skipLibCheck.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hi there,
I'm running into loads of type errors from linkedom when using the library in a typescript project.
These type errors appear to all be either missing properties or incorrect implementations of base class methods (due to parameter types or return types not matching).
The errors are too long to send but I will send a few:
node_modules/linkedom/types/dom/parser.d.ts:12:5 - error TS2416: Property 'parseFromString' in type 'DOMParser' is not assignable to the same property in base type 'DOMParser'.
Type '<MIME extends "image/svg+xml" | "text/html" | "text/xml">(markupLanguage: string, mimeType: MIME) => { "text/html": HTMLDocument; "image/svg+xml": SVGDocument; "text/xml": XMLDocument; }[MIME]' is not assignable to type '(string: string, type: DOMParserSupportedType) => Document'.
Type 'HTMLDocument | SVGDocument | XMLDocument' is not assignable to type 'Document'.
Type 'HTMLDocument' is missing the following properties from type 'Document': URL, alinkColor, anchors, applets, and 181 more.
12 parseFromString<MIME extends keyof {
~~~~~~~~~~~~~~~
node_modules/linkedom/types/html/anchor-element.d.ts:4:14 - error TS2420: Class 'import("C:/Users/felis/home/projects/test-linkedom/node_modules/linkedom/types/html/anchor-element").HTMLAnchorElement' incorrectly implements interface 'HTMLAnchorElement'.
Type 'HTMLAnchorElement' is missing the following properties from type 'HTMLAnchorElement': charset, coords, hreflang, name, and 132 more.
4 export class HTMLAnchorElement extends HTMLElement implements globalThis.HTMLAnchorElement {
~~~~~~~~~~~~~~~~~
...
node_modules/linkedom/types/html/document.d.ts:6:9 - error TS2416: Property 'all' in type 'HTMLDocument' is not assignable to the same property in base type 'HTMLDocument'.
Property 'namedItem' is missing in type 'NodeList' but required in type 'HTMLAllCollection'.
6 get all(): NodeList;
~~~
../../../AppData/Roaming/npm/node_modules/typescript/lib/lib.dom.d.ts:5953:5
5953 namedItem(name: string): HTMLCollection | Element | null;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'namedItem' is declared here.
node_modules/linkedom/types/html/document.d.ts:15:9 - error TS2416: Property 'title' in type 'HTMLDocument' is not assignable to the same property in base type 'HTMLDocument'.
Type 'HTMLTitleElement' is not assignable to type 'string'.
15 set title(arg: HTMLTitleElement);
~~~~~
...
Workaround: tsc --skipLibCheck
It'd be great to get the types correct here so --skipLibCheck isn't needed. I would make a PR for this however it seems design decisions would need to be made to fix the types. I'm not sure if the types can be reconciled while still extending / implementing globalThis.DOMParser, globalThis.HTMLElement, /globalThis\.HTML.*Element/, etc.
- Lingua principale
- HTML
- Stelle
- 2.1k
- Fork
- 108
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di WebReflection/linkedom
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
WebReflection/linkedom#329 · 5 commenti ·
-
`el.style.property = ''` and `e.style.setProperty('property', '')` should delete the propertyAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
WebReflection/linkedom#327 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
WebReflection/linkedom#326 · 5 commenti ·
-
Build Apps For AI Agent.Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
WebReflection/linkedom#321 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
WebReflection/linkedom#318 · 6 commenti ·
Tutte le issue di WebReflection/linkedom
Issue simili
-
accessibility area:ai-suggestions bug good first issue P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
uttrflow/uttrflow-swift#1893 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
wcag-intro
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
w3c/wai-website#2353 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
amponce/archive-movie-browser#353 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
saayam-for-all/webapp#1870 ·
I maintainer di solito rispondono entro 1 giorno