Skip to content

Fix typescript type #122

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -890,11 +890,7 @@ Latest version 4.0.2 (2022-01-26):

* Fix onUploadAccepted signature when a preview is set

Version 4.0.1 (2022-01-21):

* Fix config props does not work in CSVReader

Version 4.0.0 (2022-01-18):
BREAKING CHANGE Version 4.0.0 (2022-01-18):

* Improve code performance
* Rewrite any existing based components to hooks
Expand Down
8 changes: 4 additions & 4 deletions src/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ const styles = {
bottom: 14,
width: '100%',
// position: 'absolute',
} as CSSProperties,
},
button: {
position: 'inherit',
width: '100%',
} as CSSProperties,
},
fill: {
backgroundColor: DEFAULT_PROGRESS_BAR_COLOR,
borderRadius: 3,
height: 10,
transition: 'width 500ms ease-in-out',
} as CSSProperties,
},
};

interface Props {
style?: any;
style?: CSSProperties;
className?: string;
percentage: number;
display: string;
Expand Down
4 changes: 2 additions & 2 deletions src/Remove.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';

export interface Props {
export interface IRemove {
color?: string;
width?: number;
height?: number;
}

export default function Remove({ color, width = 23, height = 23 }: Props) {
export default function Remove({ color, width = 23, height = 23 }: IRemove) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
Expand Down
10 changes: 6 additions & 4 deletions src/useCSVDownloader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { ReactNode, CSSProperties, useMemo } from 'react';
import PapaParse, { UnparseConfig } from 'papaparse';

const Type = {
Expand All @@ -7,11 +7,11 @@ const Type = {
} as const;

export interface Props {
children: React.ReactNode;
children: ReactNode;
data: any;
filename: string;
type?: 'link' | 'button';
style?: any;
style?: CSSProperties;
className?: string;
bom?: boolean;
config?: UnparseConfig;
Expand Down Expand Up @@ -47,6 +47,8 @@ function useCSVDownloaderComponent() {
type: 'text/csv;charset=utf-8;',
});

// FIX: Navigator interface no longer extends MSFileSaver
// https://github.com/microsoft/TypeScript/issues/45612
const navObj: any = window.navigator;
if (navObj.msSaveBlob) {
csvURL = navObj.msSaveBlob(csvData, `${filename}.csv`);
Expand Down Expand Up @@ -80,7 +82,7 @@ function useCSVDownloaderComponent() {
);
};

const CSVDownloader = React.useMemo(() => CSVDownloaderComponent, []) as any;
const CSVDownloader = useMemo(() => CSVDownloaderComponent, []);

return CSVDownloader;
}
Expand Down
Loading