Skip to content

Commit

Permalink
marked optional params
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Hedger committed Jan 13, 2019
1 parent d78e394 commit a69165c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions packages/alert-dialog/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ declare module "@reach/alert-dialog" {
import { DialogProps, DialogContentProps } from "@reach/dialog";

type AlertDialogProps = {
isOpen: boolean;
onDismiss: () => void;
leastDestructiveRef: React.RefObject<HTMLElement>;
isOpen?: boolean;
onDismiss?: () => void;
leastDestructiveRef?: React.RefObject<HTMLElement>;
children: React.ReactNode;
} & DialogProps;

Expand Down
10 changes: 6 additions & 4 deletions packages/component-component/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ declare module "@reach/component-component" {

type Refs = { [key: string]: React.RefObject<HTMLElement> };

type StateProps = Pick<Args<{}, {}>, "state" | "props">;
type StateProps<P, S> = Pick<Args<{}, {}>, "state" | "props">;

export type ComponentProps<P, S> = {
initialState?: S;
Expand All @@ -22,11 +22,13 @@ declare module "@reach/component-component" {
getRefs?(): Refs;
didMount?(args: Args<P, S> & Refs): void;
didUpdate?(args: Args<P, S> & Refs & { prevProps: P; prevState: S }): void;
willUnmount?(args: StateProps & Refs): void;
willUnmount?(args: StateProps<P, S> & Refs): void;
getSnapshotBeforeUpdate?(
args: StateProps & Refs & { prevProps: P; prevState: S }
args: StateProps<P, S> & Refs & { prevProps: P; prevState: S }
): any;
shouldUpdate?(args: StateProps & { nextProps: P; nextState: S }): boolean;
shouldUpdate?(
args: StateProps<P, S> & { nextProps: P; nextState: S }
): boolean;
children?(
args: Args<P, S> & Refs
): Args<P, S> & Refs | React.ReactNode | null;
Expand Down
4 changes: 2 additions & 2 deletions packages/dialog/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare module "@reach/dialog" {
type DialogProps = {
isOpen: boolean;
export type DialogProps = {
isOpen?: boolean;
onDismiss?: () => void;
children: React.ReactNode;
} & HTMLDivElement;
Expand Down
2 changes: 1 addition & 1 deletion packages/portal/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
declare module "@reach/portal" {
type PortalProps = {
type?: string;
children: React.ReactNode;
type: string;
};

export const Portal: React.SFC<PortalProps>;
Expand Down
8 changes: 4 additions & 4 deletions packages/rect/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare module "@reach/rect" {
type IClientRect = {
interface IClientRect {
x: number;
y: number;
width: number;
Expand All @@ -8,12 +8,12 @@ declare module "@reach/rect" {
right: number;
bottom: number;
left: number;
};
}

type IRectProps = {
observe?: boolean;
onChange?: (rect: IClientRect) => void;
children: React.ReactNode;
observe: boolean;
onChange: (rect: IClientRect) => void;
};

const Rect: React.SFC<IRectProps>;
Expand Down

0 comments on commit a69165c

Please sign in to comment.