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

Fix for React+TypeScript #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
19 changes: 13 additions & 6 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,35 @@ declare module 'react-data-export' {
filename?: string;
fileExtension?: string;
element?: any; //Download Element
children?: Array<React.ReactChild> | React.ReactChild; // Array<ExcelSheetProps>;
children?: Array<React.ReactElement> | React.ReactElement; // Array<ExcelSheetProps>;
}

export interface ExcelSheetProps {
name: string;
data?: Array<object>;
dataSet?: Array<ExcelSheetData>;
value?: Array<string> | Function;
children?: Array<React.ReactChild> | React.ReactChild; // Array<ExcelColumnProps>
children?: Array<React.ReactElement> | React.ReactElement; // Array<ExcelColumnProps>
}

export interface ExcelSheetData {
xSteps?: number;
ySteps?: number;
columns: Array<string>;
data: Array<ExcelCellData>;
columns: Array<string> | Array<ExcelCellHeader>;
data: Array<Array<ExcelCellData>>;
}

export type ExcelCellData = ExcelValue | ExcelCell | Array<ExcelValue>;
export type ExcelValue = string | number | Date | boolean;

export interface ExcelCellHeader {
title: string;
style?: ExcelStyle;
}

export interface ExcelCell {
value: ExcelCell;
style: ExcelStyle;
value: ExcelValue;
style?: ExcelStyle;
}

export interface ExcelColumnProps {
Expand Down Expand Up @@ -131,6 +136,8 @@ declare module 'react-data-export' {

export namespace ReactExport {
export class ExcelFile extends React.Component<ExcelFileProps, any> {
static ExcelSheet: React.ElementType<ExcelSheetProps>;
static ExcelColumn: React.ElementType<ExcelColumnProps>;
}
}
export default ReactExport
Expand Down