Skip to content

Commit

Permalink
fix: improve constructor types #230
Browse files Browse the repository at this point in the history
  • Loading branch information
taoqf committed Aug 17, 2023
1 parent f0b176e commit 24fd055
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/nodes/comment.ts
Expand Up @@ -6,7 +6,7 @@ export default class CommentNode extends Node {
public clone(): CommentNode {
return new CommentNode(this.rawText, null);
}
public constructor(public rawText: string, parentNode: HTMLElement, range?: [number, number]) {
public constructor(public rawText: string, parentNode = null as HTMLElement | null, range?: [number, number]) {
super(parentNode, range);
}

Expand Down
2 changes: 1 addition & 1 deletion src/nodes/html.ts
Expand Up @@ -172,7 +172,7 @@ export default class HTMLElement extends Node {
tagName: string,
keyAttrs: KeyAttributes,
public rawAttrs = '',
parentNode: HTMLElement | null,
parentNode = null as HTMLElement | null,
range: [number, number],
private voidTag = new VoidTag(),
_parseOptions = {} as Partial<Options>
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/text.ts
Expand Up @@ -11,7 +11,7 @@ export default class TextNode extends Node {
public clone(): TextNode {
return new TextNode(this._rawText, null);
}
public constructor(rawText: string, parentNode: HTMLElement, range?: [number, number]) {
public constructor(rawText: string, parentNode = null as HTMLElement | null, range?: [number, number]) {
super(parentNode, range);
this._rawText = rawText;
}
Expand Down

0 comments on commit 24fd055

Please sign in to comment.