I'm getting this error when I put my Javascipt code to a Typescript project.In Javascript project its worked fine but when I put the code into a Typescript project I got the error.
Is there any mistake in coding?
Here's the code :
const createPDF = async() => { let Options = { html: '<h1>test</h1>', fileName: 'test', directory: 'Download', }; let file = await RNHTMLtoPDF.convert(Options) Alert.alert('Alert','Successfully exported file:'+ file.filePath,[ {text:'Cancel',style:'cancel'}, {text:'Open',onPress:()=>openFile(file.filepath)} ],{cancelable:true}); } const openFile = (filepath: any) => { const path = filepath; FileViewer.open(path) .then(()=>{ //success console.log(`Successfully export PDF file`); }) .catch(error => { console.log(error); }); }
LOG [TypeError: Cannot read property 'startsWith' of undefined]