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

[Popper] Update TypeScript definitions #12161

Merged
merged 2 commits into from
Jul 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions packages/material-ui/src/Popper/Popper.d.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
import * as React from 'react';
import { PortalProps } from '../Portal';
import { TransitionProps } from '../transitions/transition';

export type PopperPlacementType =
| 'bottom-end'
| 'bottom-start'
| 'bottom'
| 'left-end'
| 'left-start'
| 'left'
| 'right-end'
| 'right-start'
| 'right'
| 'top-end'
| 'top-start'
| 'top';

export interface PopperProps extends React.HTMLAttributes<HTMLDivElement> {
anchorEl?: HTMLElement | ((element: HTMLElement) => HTMLElement);
children: () => React.ReactElement<any> | React.ReactElement<any>;
transition?: boolean;
anchorEl?: null | HTMLElement | ((element: HTMLElement) => HTMLElement);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is ? not enough?

Copy link
Contributor Author

@Slessi Slessi Jul 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With strictNullChecks or strict mode turned on, ? only allows for passing undefined, but passing null does work too.

In reality, any developer using strict should be capable of figuring out that they can just use undefined but documentation example was using null so dunno thought I'd add it.

Not really important.

children: (
props: {
placement: PopperPlacementType;
TransitionProps?: TransitionProps;
},
) => React.ReactElement<any>;
container?: PortalProps['container'];
disablePortal?: PortalProps['disablePortal'];
keepMounted?: boolean;
modifiers?: Object;
open: boolean;
placement?:
| 'bottom-end'
| 'bottom-start'
| 'bottom'
| 'left-end'
| 'left-start'
| 'left'
| 'right-end'
| 'right-start'
| 'right'
| 'top-end'
| 'top-start'
| 'top';
placement?: PopperPlacementType;
popperOptions?: Object;
}

Expand Down