Skip to content

Commit

Permalink
Fix compatibility with typescript 2.4+ (react-toolbox#1615)
Browse files Browse the repository at this point in the history
* Added a generic props interface to share with other components

* use the new DrawerCommonProps interface

* use the new DrawerCommonProps interface

* Fix compatibility with Typescript 2.3+
  • Loading branch information
Lucas Nascimento authored and javivelasco committed Sep 20, 2017
1 parent e1f320c commit b381db4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
13 changes: 8 additions & 5 deletions components/drawer/Drawer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface DrawerTheme {
wrapper?: string;
}

export interface DrawerProps extends ReactToolbox.Props {
export interface DrawerCommonProps {
/**
* If true, the drawer will be visible.
* @default false
Expand All @@ -47,10 +47,6 @@ export interface DrawerProps extends ReactToolbox.Props {
* Callback function to be invoked when the overlay is clicked.
*/
onOverlayClick?: Function;
/**
* Classnames object defining the component style.
*/
theme?: DrawerTheme;
/**
* Type of drawer. It can be left or right to display the drawer on the left or right side of the screen.
* @default left
Expand All @@ -63,6 +59,13 @@ export interface DrawerProps extends ReactToolbox.Props {
withOverlay?: boolean;
}

export interface DrawerProps extends ReactToolbox.Props, DrawerCommonProps {
/**
* Classnames object defining the component style.
*/
theme?: DrawerTheme;
}

export class Drawer extends React.Component<DrawerProps, {}> { }

export default Drawer;
5 changes: 1 addition & 4 deletions components/layout/Layout.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import * as React from "react";
import ReactToolbox from "../index";
import { NavDrawer } from './NavDrawer';
import { Panel } from './Panel';
import { Sidebar } from './Sidebar';

export interface LayoutTheme {
appbarFixed?: string;
Expand Down Expand Up @@ -54,7 +51,7 @@ export interface LayoutProps extends ReactToolbox.Props {
/**
* Children to pass through the component.
*/
children?: [NavDrawer | Panel | Sidebar];
children?: JSX.Element | JSX.Element[];
/**
* Classnames object defining the component style.
*/
Expand Down
4 changes: 2 additions & 2 deletions components/layout/NavDrawer.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { DrawerProps } from '../drawer/Drawer';
import { DrawerCommonProps } from '../drawer/Drawer';

export interface NavDrawerTheme {
/**
Expand All @@ -12,7 +12,7 @@ export interface NavDrawerTheme {
clipped?: string;
}

export interface NavDrawerProps extends DrawerProps {
export interface NavDrawerProps extends DrawerCommonProps {
/**
* If true, the drawer will be shown as an overlay.
* @default false
Expand Down
4 changes: 2 additions & 2 deletions components/layout/Sidebar.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { DrawerProps } from '../drawer/Drawer';
import { DrawerCommonProps } from '../drawer/Drawer';

export interface SidebarTheme {
/**
Expand All @@ -12,7 +12,7 @@ export interface SidebarTheme {
pinned?: string;
}

export interface SidebarProps extends DrawerProps {
export interface SidebarProps extends DrawerCommonProps {
/**
* If true, when the `AppBar` gets pinned, it will stand over the `Drawer`.
* @default false
Expand Down

0 comments on commit b381db4

Please sign in to comment.