Typescript type errors
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- web-dev
調査の方向性
TypeScript でエラーを再現し、types/dom/parser.d.ts、types/html/anchor-element.d.ts、types/html/document.d.ts の宣言を TypeScript の lib.dom.d.ts と併せて調査します。報告された継承シグネチャと実装シグネチャを比較し、型をグローバルな DOM インターフェースと整合させられるかどうかを判断します。報告された型エラーで tsc --skipLibCheck が不要になれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- HTML
- スター
- 2.1k
- フォーク
- 104
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
WebReflection/linkedom のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
WebReflection/linkedom#329 · コメント 5 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
WebReflection/linkedom#327 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
WebReflection/linkedom#326 · コメント 5 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
WebReflection/linkedom#321 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
WebReflection/linkedom#318 · コメント 6 件 ·
WebReflection/linkedom の issue をすべて見る
似ている issue
-
[Type] Bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
bug Needs: Triage :mag:
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/fluentui-contrib#671 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
UX
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
AllenInstitute/biofile-finder#970 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信