Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript signature could be improved (constructor of Node + HTMLElement) #230

Closed
xatian opened this issue Nov 20, 2022 · 1 comment
Closed

Comments

@xatian
Copy link

xatian commented Nov 20, 2022

I think the typescript-declarations in a few places could be improved.


Node
currently it is like this:

export default class TextNode extends Node {
    constructor(rawText: string, parentNode: HTMLElement, range?: [number, number]);
}

seeing in the JS-code that the parentNode is not required it should be like this:

export default class TextNode extends Node {
    constructor(rawText: string, parentNode?: HTMLElement, range?: [number, number]);
}

same issue in the constructor of CommentNode.


HTMLElement
currently it is like this:

export default class HTMLElement extends Node {
    constructor(tagName: string, keyAttrs: KeyAttributes, rawAttrs: string, parentNode: HTMLElement | null, range: [number, number], voidTag?: VoidTag, _parseOptions?: Partial<Options>);
}

seeing in the JS-code that only tagName and keyAttrs are required it should be:

export default class HTMLElement extends Node {
    constructor(tagName: string, keyAttrs: KeyAttributes, rawAttrs?: string, parentNode?: HTMLElement, range?: [number, number], voidTag?: VoidTag, _parseOptions?: Partial<Options>);
}

Thank you!
@xatian xatian changed the title Typescript signature is wrong (constructor of Node + HTMLElement) Typescript signature could be improved (constructor of Node + HTMLElement) Nov 20, 2022
taoqf added a commit that referenced this issue Aug 17, 2023
taoqf added a commit that referenced this issue Aug 17, 2023
@taoqf
Copy link
Owner

taoqf commented Aug 17, 2023

Thank you.

@taoqf taoqf closed this as completed Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants