@@ -3,9 +3,7 @@ import { utils, writeFile } from "xlsx-js-style";
33import type { BookType , WorkSheet } from "xlsx-js-style" ;
44import { excelSheetFromAoA , excelSheetFromDataSet } from "../utils/DataUtil" ;
55import type {
6- DataProps ,
76 ExcelColumnProps ,
8- ExcelSheetData ,
97 ExcelSheetProps ,
108 ExcelValue ,
119} from "react-xlsx-wrapper" ;
@@ -15,7 +13,7 @@ interface ExcelFileProps {
1513 filename ?: string ;
1614 fileExtension ?: BookType ;
1715 element ?: React . ReactNode ;
18- children : React . ReactElement < ExcelSheetProps < DataProps , ExcelSheetData > > [ ] ;
16+ children : React . ReactElement < ExcelSheetProps > [ ] ;
1917}
2018
2119class ExcelFile extends React . Component < ExcelFileProps > {
@@ -39,9 +37,7 @@ class ExcelFile extends React.Component<ExcelFileProps> {
3937 }
4038 }
4139
42- createSheetData = (
43- sheet : React . ReactElement < ExcelSheetProps < DataProps , ExcelSheetData > >
44- ) => {
40+ createSheetData = ( sheet : React . ReactElement < ExcelSheetProps > ) => {
4541 const columns = sheet . props . children ;
4642 const sheetData = [
4743 React . Children . map (
@@ -52,14 +48,13 @@ class ExcelFile extends React.Component<ExcelFileProps> {
5248
5349 const data = sheet . props . data ;
5450 if ( ! data ) throw new Error ( "No data provided" ) ;
55- data . forEach ( ( row : DataProps ) => {
51+ data . forEach ( ( row : any ) => {
5652 let sheetRow : ExcelValue [ ] = [ ] ;
5753
5854 React . Children . forEach (
5955 columns ,
6056 ( column : React . ReactElement < ExcelColumnProps > ) => {
61- const getValue = ( row : DataProps ) =>
62- row [ column . props . value as string ] ;
57+ const getValue = ( row : any ) => row [ column . props . value as string ] ;
6358 const itemValue = getValue ( row ) ;
6459 sheetRow . push ( isNaN ( Number ( itemValue ) ) ? itemValue || "" : itemValue ) ;
6560 }
0 commit comments