1- import type { TDocumentDefinitions } from 'pdfmake/interfaces'
1+ import type { TableCell , TDocumentDefinitions } from 'pdfmake/interfaces'
22
33import { invoiceData } from './data'
44
@@ -9,12 +9,12 @@ const TEXT_COLOR = '#2a2a2a'
99const MUTED_COLOR = '#666666'
1010const BORDER_COLOR = '#e5e5e5'
1111
12- let pdfMakePromise : Promise < typeof import ( 'pdfmake/build/pdfmake' ) . default > | null = null
12+ let pdfMakePromise : Promise < typeof import ( 'pdfmake/build/pdfmake' ) > | null = null
1313
1414async function loadPdfMake ( ) {
1515 if ( ! pdfMakePromise ) {
1616 pdfMakePromise = ( async ( ) => {
17- const [ { default : pdfMake } , fontsModule ] = await Promise . all ( [
17+ const [ pdfMake , fontsModule ] = await Promise . all ( [
1818 import ( 'pdfmake/build/pdfmake' ) ,
1919 import ( 'pdfmake/build/vfs_fonts' ) ,
2020 ] )
@@ -45,7 +45,7 @@ async function loadPdfMake() {
4545 : undefined ) ??
4646 ( isFontDictionary ( fontsDefault ) ? fontsDefault : undefined )
4747
48- if ( vfs ) {
48+ if ( vfs && typeof vfs !== 'string' ) {
4949 ; ( pdfMake as unknown as { vfs : Record < string , string > } ) . vfs = vfs
5050 }
5151
@@ -76,12 +76,7 @@ function buildDocDefinition(data: InvoiceData): TDocumentDefinitions {
7676 { } ,
7777 { text : `$${ data . totalPaid } ` } ,
7878 ] ,
79- [
80- { text : 'Late Fees' , colSpan : 3 , alignment : 'right' , bold : true , color : '#555555' } ,
81- { } ,
82- { } ,
83- { text : '$0.00' } ,
84- ] ,
79+ [ { text : 'Late Fees' , colSpan : 3 , alignment : 'right' , bold : true , color : '#555555' } , { } , { } , { text : '$0.00' } ] ,
8580 [
8681 { text : 'Remaining Balance' , colSpan : 3 , alignment : 'right' , bold : true , color : '#555555' } ,
8782 { } ,
@@ -167,7 +162,7 @@ function buildDocDefinition(data: InvoiceData): TDocumentDefinitions {
167162 table : {
168163 headerRows : 1 ,
169164 widths : [ '*' , 70 , 50 , 70 ] ,
170- body : [
165+ body : ( [
171166 [
172167 { text : 'Description' , style : 'tableHeader' } ,
173168 { text : 'Price' , style : 'tableHeader' } ,
@@ -176,7 +171,7 @@ function buildDocDefinition(data: InvoiceData): TDocumentDefinitions {
176171 ] ,
177172 ...lineItemRows ,
178173 ...totalsRows ,
179- ] ,
174+ ] as TableCell [ ] [ ] ) ,
180175 } ,
181176 layout : {
182177 hLineColor : ( ) => BORDER_COLOR ,
0 commit comments