From 0627096ce80849fceb0b445ddc01e16717826585 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Fri, 1 Sep 2017 12:55:42 +0900 Subject: [PATCH 1/8] Expose components props, fix imports --- types/react-bootstrap/index.d.ts | 94 +--- types/react-bootstrap/lib/Accordion.d.ts | 26 +- types/react-bootstrap/lib/Alert.d.ts | 21 +- types/react-bootstrap/lib/Badge.d.ts | 14 +- types/react-bootstrap/lib/Breadcrumb.d.ts | 14 +- types/react-bootstrap/lib/BreadcrumbItem.d.ts | 18 +- types/react-bootstrap/lib/Button.d.ts | 24 +- types/react-bootstrap/lib/ButtonGroup.d.ts | 20 +- types/react-bootstrap/lib/ButtonToolbar.d.ts | 20 +- types/react-bootstrap/lib/Carousel.d.ts | 49 +- .../react-bootstrap/lib/CarouselCaption.d.ts | 12 +- types/react-bootstrap/lib/CarouselItem.d.ts | 23 +- types/react-bootstrap/lib/Checkbox.d.ts | 20 +- types/react-bootstrap/lib/Clearfix.d.ts | 20 +- types/react-bootstrap/lib/Col.d.ts | 52 +- types/react-bootstrap/lib/Collapse.d.ts | 22 +- types/react-bootstrap/lib/ControlLabel.d.ts | 16 +- types/react-bootstrap/lib/Dropdown.d.ts | 38 +- types/react-bootstrap/lib/DropdownButton.d.ts | 25 +- types/react-bootstrap/lib/DropdownMenu.d.ts | 20 +- types/react-bootstrap/lib/DropdownToggle.d.ts | 23 +- types/react-bootstrap/lib/Fade.d.ts | 18 +- types/react-bootstrap/lib/Form.d.ts | 18 +- types/react-bootstrap/lib/FormControl.d.ts | 26 +- .../lib/FormControlFeedback.d.ts | 10 +- .../lib/FormControlStatic.d.ts | 14 +- types/react-bootstrap/lib/FormGroup.d.ts | 18 +- types/react-bootstrap/lib/Glyphicon.d.ts | 14 +- types/react-bootstrap/lib/Grid.d.ts | 16 +- types/react-bootstrap/lib/HelpBlock.d.ts | 12 +- types/react-bootstrap/lib/Image.d.ts | 18 +- types/react-bootstrap/lib/InputGroup.d.ts | 18 +- .../react-bootstrap/lib/InputGroupAddon.d.ts | 10 +- .../react-bootstrap/lib/InputGroupButton.d.ts | 10 +- types/react-bootstrap/lib/Jumbotron.d.ts | 12 +- types/react-bootstrap/lib/Label.d.ts | 14 +- types/react-bootstrap/lib/ListGroup.d.ts | 16 +- types/react-bootstrap/lib/ListGroupItem.d.ts | 22 +- types/react-bootstrap/lib/Media.d.ts | 24 +- types/react-bootstrap/lib/MediaBody.d.ts | 12 +- types/react-bootstrap/lib/MediaHeading.d.ts | 12 +- types/react-bootstrap/lib/MediaLeft.d.ts | 12 +- types/react-bootstrap/lib/MediaList.d.ts | 10 +- types/react-bootstrap/lib/MediaListItem.d.ts | 12 +- types/react-bootstrap/lib/MediaRight.d.ts | 12 +- types/react-bootstrap/lib/MenuItem.d.ts | 30 +- types/react-bootstrap/lib/Modal.d.ts | 66 +-- types/react-bootstrap/lib/ModalBody.d.ts | 13 +- types/react-bootstrap/lib/ModalDialog.d.ts | 26 +- types/react-bootstrap/lib/ModalFooter.d.ts | 13 +- types/react-bootstrap/lib/ModalHeader.d.ts | 17 +- types/react-bootstrap/lib/ModalTitle.d.ts | 13 +- types/react-bootstrap/lib/Nav.d.ts | 41 +- types/react-bootstrap/lib/NavDropdown.d.ts | 18 +- types/react-bootstrap/lib/NavItem.d.ts | 46 +- types/react-bootstrap/lib/Navbar.d.ts | 58 +- types/react-bootstrap/lib/NavbarBrand.d.ts | 10 +- types/react-bootstrap/lib/NavbarCollapse.d.ts | 7 +- types/react-bootstrap/lib/NavbarHeader.d.ts | 9 +- types/react-bootstrap/lib/NavbarToggle.d.ts | 12 +- types/react-bootstrap/lib/Overlay.d.ts | 30 +- types/react-bootstrap/lib/OverlayTrigger.d.ts | 48 +- types/react-bootstrap/lib/PageHeader.d.ts | 9 +- types/react-bootstrap/lib/PageItem.d.ts | 9 +- types/react-bootstrap/lib/Pager.d.ts | 14 +- types/react-bootstrap/lib/PagerItem.d.ts | 22 +- types/react-bootstrap/lib/Pagination.d.ts | 36 +- .../react-bootstrap/lib/PaginationButton.d.ts | 24 +- types/react-bootstrap/lib/Panel.d.ts | 30 +- types/react-bootstrap/lib/PanelGroup.d.ts | 22 +- types/react-bootstrap/lib/Popover.d.ts | 26 +- types/react-bootstrap/lib/ProgressBar.d.ts | 30 +- types/react-bootstrap/lib/Radio.d.ts | 19 +- .../react-bootstrap/lib/ResponsiveEmbed.d.ts | 16 +- types/react-bootstrap/lib/Row.d.ts | 12 +- types/react-bootstrap/lib/SafeAnchor.d.ts | 20 +- types/react-bootstrap/lib/SplitButton.d.ts | 20 +- types/react-bootstrap/lib/SplitToggle.d.ts | 9 +- types/react-bootstrap/lib/Tab.d.ts | 28 +- types/react-bootstrap/lib/TabContainer.d.ts | 16 +- types/react-bootstrap/lib/TabContent.d.ts | 18 +- types/react-bootstrap/lib/TabPane.d.ts | 20 +- types/react-bootstrap/lib/Table.d.ts | 24 +- types/react-bootstrap/lib/Tabs.d.ts | 30 +- types/react-bootstrap/lib/Thumbnail.d.ts | 14 +- types/react-bootstrap/lib/Tooltip.d.ts | 26 +- types/react-bootstrap/lib/Well.d.ts | 14 +- types/react-bootstrap/lib/index.d.ts | 519 ++++++++++++------ 88 files changed, 1257 insertions(+), 1158 deletions(-) diff --git a/types/react-bootstrap/index.d.ts b/types/react-bootstrap/index.d.ts index b59403cc39..dcb5998f7a 100644 --- a/types/react-bootstrap/index.d.ts +++ b/types/react-bootstrap/index.d.ts @@ -8,11 +8,15 @@ // Cheng Sieu Ly , // Kat Busch , // Vito Samson +// Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import * as React from 'react'; +export type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; +export type Omit = Pick>; + export type Sizes = 'xs' | 'xsmall' | 'sm' | 'small' | 'medium' | 'lg' | 'large'; export interface SelectCallback extends React.EventHandler { @@ -34,92 +38,4 @@ export interface TransitionCallbacks { onExiting?(node: HTMLElement): any; } -export { - Accordion, - Alert, - Badge, - Breadcrumb, - BreadcrumbItem, - Button, - ButtonGroup, - ButtonToolbar, - Carousel, - CarouselCaption, - CarouselItem, - Checkbox, - Clearfix, - Col, - Collapse, - ControlLabel, - Dropdown, - DropdownButton, - DropdownMenu, - DropdownToggle, - Fade, - Form, - FormControl, - FormControlFeedback, - FormControlStatic, - FormGroup, - Glyphicon, - Grid, - HelpBlock, - Image, - InputGroup, - InputGroupAddon, - InputGroupButton, - Jumbotron, - Label, - ListGroup, - ListGroupItem, - Media, - MediaBody, - MediaHeading, - MediaLeft, - MediaList, - MediaListItem, - MediaRight, - MenuItem, - Modal, - ModalBody, - ModalDialog, - ModalFooter, - ModalHeader, - ModalTitle, - Nav, - Navbar, - NavbarBrand, - NavbarCollapse, - NavbarHeader, - NavbarToggle, - NavDropdown, - NavItem, - Overlay, - OverlayTrigger, - PageHeader, - PageItem, - Pager, - PagerItem, - Pagination, - PaginationButton, - Panel, - PanelGroup, - Popover, - ProgressBar, - Radio, - ResponsiveEmbed, - Row, - SafeAnchor, - SplitButton, - SplitToggle, - Tab, - TabContainer, - TabContent, - Table, - TabPane, - Tabs, - Thumbnail, - Tooltip, - Well, - utils, -} from './lib'; +export * from './lib'; diff --git a/types/react-bootstrap/lib/Accordion.d.ts b/types/react-bootstrap/lib/Accordion.d.ts index a438514645..28b15ab1de 100644 --- a/types/react-bootstrap/lib/Accordion.d.ts +++ b/types/react-bootstrap/lib/Accordion.d.ts @@ -1,17 +1,19 @@ import * as React from 'react'; import { Sizes } from 'react-bootstrap'; -declare class Accordion extends React.Component { } -declare namespace Accordion { } +declare namespace Accordion { + export interface AccordionProps extends React.HTMLProps { + bsSize?: Sizes; + bsStyle?: string; + collapsible?: boolean; + defaultExpanded?: boolean; + eventKey?: any; + expanded?: boolean; + footer?: React.ReactNode; + header?: React.ReactNode; + } +} +declare class Accordion extends React.Component { } export = Accordion; -interface AccordionProps extends React.HTMLProps { - bsSize?: Sizes; - bsStyle?: string; - collapsible?: boolean; - defaultExpanded?: boolean; - eventKey?: any; - expanded?: boolean; - footer?: any; // TODO: Add more specific type - header?: any; // TODO: Add more specific type -} + diff --git a/types/react-bootstrap/lib/Alert.d.ts b/types/react-bootstrap/lib/Alert.d.ts index 538984daa5..913619101f 100644 --- a/types/react-bootstrap/lib/Alert.d.ts +++ b/types/react-bootstrap/lib/Alert.d.ts @@ -1,14 +1,15 @@ import * as React from 'react'; import { Sizes } from 'react-bootstrap'; -declare class Alert extends React.Component { } -declare namespace Alert { } -export = Alert - -interface AlertProps extends React.HTMLProps { - bsSize?: Sizes; - bsStyle?: string; - closeLabel?: string; - /** @deprecated since v0.29.0 */ dismissAfter?: number; - onDismiss?: Function; +declare namespace Alert { + export interface AlertProps extends React.HTMLProps { + bsSize?: Sizes; + bsStyle?: string; + closeLabel?: string; + /** @deprecated since v0.29.0 */dismissAfter?: number; + // TODO: Add more specific type + onDismiss?: Function; + } } +declare class Alert extends React.Component { } +export = Alert; diff --git a/types/react-bootstrap/lib/Badge.d.ts b/types/react-bootstrap/lib/Badge.d.ts index 174cebacbd..bcac7dfa17 100644 --- a/types/react-bootstrap/lib/Badge.d.ts +++ b/types/react-bootstrap/lib/Badge.d.ts @@ -1,10 +1,10 @@ import * as React from 'react'; -declare class Badge extends React.Component { } -declare namespace Badge { } -export = Badge - -interface BadgeProps extends React.HTMLProps { - bsClass?: string; - pullRight?: boolean; +declare namespace Badge { + export interface BadgeProps extends React.HTMLProps { + bsClass?: string; + pullRight?: boolean; + } } +declare class Badge extends React.Component { } +export = Badge; diff --git a/types/react-bootstrap/lib/Breadcrumb.d.ts b/types/react-bootstrap/lib/Breadcrumb.d.ts index 2f5d895172..3bff967487 100644 --- a/types/react-bootstrap/lib/Breadcrumb.d.ts +++ b/types/react-bootstrap/lib/Breadcrumb.d.ts @@ -1,12 +1,12 @@ import * as React from 'react'; import * as BreadcrumbItem from './BreadcrumbItem'; -declare class Breadcrumb extends React.Component { - public static Item: typeof BreadcrumbItem; +declare namespace Breadcrumb { + interface BreadcrumbProps extends React.HTMLProps { + bsClass?: string; + } } -declare namespace Breadcrumb { } -export = Breadcrumb - -interface BreadcrumbProps extends React.HTMLProps { - bsClass?: string; +declare class Breadcrumb extends React.Component { + public static Item: typeof BreadcrumbItem; } +export = Breadcrumb; diff --git a/types/react-bootstrap/lib/BreadcrumbItem.d.ts b/types/react-bootstrap/lib/BreadcrumbItem.d.ts index 2e64aac615..b4b0f741a3 100644 --- a/types/react-bootstrap/lib/BreadcrumbItem.d.ts +++ b/types/react-bootstrap/lib/BreadcrumbItem.d.ts @@ -1,12 +1,12 @@ import * as React from 'react'; -declare class BreadcrumbItem extends React.Component { } -declare namespace BreadcrumbItem { } -export = BreadcrumbItem - -interface BreadcrumbItemProps extends React.Props { - active?: boolean; - href?: string; - title?: React.ReactNode; - target?: string; +declare namespace BreadcrumbItem { + export interface BreadcrumbItemProps extends React.Props { + active?: boolean; + href?: string; + title?: React.ReactNode; + target?: string; + } } +declare class BreadcrumbItem extends React.Component { } +export = BreadcrumbItem; diff --git a/types/react-bootstrap/lib/Button.d.ts b/types/react-bootstrap/lib/Button.d.ts index 1c5504dbe6..367eea78cc 100644 --- a/types/react-bootstrap/lib/Button.d.ts +++ b/types/react-bootstrap/lib/Button.d.ts @@ -1,16 +1,16 @@ import * as React from 'react'; import { Sizes } from 'react-bootstrap'; -declare class Button extends React.Component { } -declare namespace Button { } -export = Button - -interface ButtonProps extends React.HTMLProps