Skip to content

Commit

Permalink
fix(core/dom): fix selector generic type
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaodong2008 committed Jul 15, 2024
1 parent be75b54 commit 91f8930
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/dom/dom-list-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function createMethods(list: FastjsDomList): FastjsDomListAPI {
return list[key];
},
next<
T extends FastjsDom | FastjsDomList | null =
T extends FastjsDom<any> | FastjsDomList | null =
| FastjsDom
| FastjsDomList
| null
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/dom/dom-list-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface FastjsDomListAPI {
getElement(key?: number): ElementList;
getDom(key?: number): FastjsDom;
next<
T extends FastjsDom | FastjsDomList | null =
T extends FastjsDom<any> | FastjsDomList | null =
| FastjsDom
| FastjsDomList
| null
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/dom/dom-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function createMethods<ElementType extends ElementList>(
const children = () => createFastjsDomList([...dom._el.children]);

const next = <
T extends FastjsDom | FastjsDomList | null =
T extends FastjsDom<any> | FastjsDomList | null =
| FastjsDom
| FastjsDomList
| null
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/dom/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { FastjsDomList } from "./dom-list-types";

interface DomModule {
<
T extends FastjsDom | FastjsDomList | null =
T extends FastjsDom<any> | FastjsDomList | null =
| FastjsDom
| FastjsDomList
| null
Expand All @@ -20,7 +20,10 @@ interface DomModule {
}

const dom: DomModule = function <
T extends FastjsDom | FastjsDomList | null = FastjsDom | FastjsDomList | null
T extends FastjsDom<any> | FastjsDomList | null =
| FastjsDom
| FastjsDomList
| null
>(
target: string = "body",
parent: Document | HTMLElement | HTMLElement[] = document
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/dom/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createFastjsDom } from "./dom";
import { createFastjsDomList } from "./dom-list";

function selector<
T extends FastjsDom | FastjsDomList | null = FastjsDom | FastjsDomList | null
T extends FastjsDom<any> | FastjsDomList | null = FastjsDom | FastjsDomList | null
>(
target: string = "body",
parent: Document | ElementList | ElementList[] = document
Expand Down

0 comments on commit 91f8930

Please sign in to comment.