Typescript type errors
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- web-dev
Hướng nghiên cứu
Tái hiện các lỗi bằng TypeScript và kiểm tra các khai báo trong types/dom/parser.d.ts, types/html/anchor-element.d.ts và types/html/document.d.ts cùng với lib.dom.d.ts của TypeScript. So sánh các chữ ký kế thừa và được triển khai đã được báo cáo để xác định liệu các kiểu có thể được điều chỉnh cho phù hợp với các giao diện DOM toàn cục hay không. Được xem là hoàn tất khi các lỗi kiểu đã báo cáo không còn yêu cầu tsc --skipLibCheck.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- HTML
- Star
- 2.1k
- Fork
- 104
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của WebReflection/linkedom
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
WebReflection/linkedom#329 · 5 bình luận ·
-
`el.style.property = ''` and `e.style.setProperty('property', '')` should delete the property Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
WebReflection/linkedom#327 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
WebReflection/linkedom#326 · 5 bình luận ·
-
Build Apps For AI Agent. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
WebReflection/linkedom#321 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
WebReflection/linkedom#318 · 5 bình luận ·
Tất cả issue của WebReflection/linkedom
Issue tương tự
-
area/profiles comp/cli comp/dashboard P2 sweeper:risk-session-state type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NousResearch/hermes-agent#122365 ·
-
docs web/
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
select の共通部品を作り、旅プランのエリア欄を置き換える Đang mởdesign phase:2 size:S
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
poker-hack-stage/anaba#75 ·
-
bug confirmed issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
open-webui/open-webui#31373 · 1 bình luận ·