Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 9b5f677

Browse files
giladgrayFezVrasta
authored andcommitted
feat(type): more interfaces in typescript typings (#153)
* fix(type): invalid type syntax * fix(type): placement is not optional
1 parent cd248e7 commit 9b5f677

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

typings/react-popper.d.ts

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,36 @@ interface ManagerProps {
66
}
77
export class Manager extends React.Component<ManagerProps, {}> { }
88

9+
type RefHandler = (ref: HTMLElement | null) => void;
10+
11+
interface ReferenceChildrenProps {
12+
ref: RefHandler;
13+
}
14+
915
interface ReferenceProps {
10-
children: (props: ({
11-
ref: (ref: HTMLElement | null) => void,
12-
})) => React.ReactNode;
16+
children: (props: ReferenceChildrenProps) => React.ReactNode;
1317
}
1418
export class Reference extends React.Component<ReferenceProps, {}> { }
1519

20+
interface PopperArrowProps {
21+
ref: RefHandler;
22+
style: React.CSSProperties;
23+
}
24+
25+
interface PopperChildrenProps {
26+
arrowProps: PopperArrowProps;
27+
outOfBoundaries: boolean | null;
28+
placement: PopperJS.Placement;
29+
ref: RefHandler;
30+
scheduleUpdate: () => void;
31+
style: React.CSSProperties;
32+
}
33+
1634
interface PopperProps {
35+
children: (props: PopperChildrenProps) => React.ReactNode;
36+
eventsEnabled?: boolean;
1737
modifiers?: PopperJS.Modifiers;
1838
placement?: PopperJS.Placement;
19-
eventsEnabled?: boolean;
2039
positionFixed?: boolean;
21-
children: (props: ({
22-
ref: (ref: HTMLElement | null) => void,
23-
style: React.CSSProperties,
24-
placement?: PopperJS.Placement,
25-
outOfBoundaries: boolean | null,
26-
scheduleUpdate: () => void,
27-
arrowProps: {
28-
ref: (ref: HTMLElement | null) => void,
29-
style: React.CSSProperties,
30-
},
31-
})) => React.ReactNode;
3240
}
3341
export class Popper extends React.Component<PopperProps, {}> { }

0 commit comments

Comments
 (0)