fix type errors

This commit is contained in:
Thomas Ruoff
2021-11-24 12:00:39 +01:00
parent 04b6729625
commit 9a470a52a3
4 changed files with 17 additions and 8 deletions

View File

@@ -68,9 +68,9 @@ export default function App() {
addDocument(data)
setPdfIsLoading(false)
setPdfUrl(url)
} catch (error) {
} catch (error: any) {
setPdfIsLoading(false)
setPdfError(error.message)
setPdfError(error?.message || 'Unknown error')
setPdfUrl(null)
}
}

View File

@@ -24,7 +24,7 @@ async function generateDoc(id: string): Promise<void> {
const { stdout } = await execPromise(cmd, options)
stdout.length && console.log('stdout:', stdout)
console.log(`PDF ${id} generated`)
} catch (error) {
} catch (error: any) {
console.error(error.stdout)
console.error(error.toString())
throw new Error(error.message)

View File

@@ -33,7 +33,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
await renderer(id, texDoc)
const storeData = { ...templateData, id, created: new Date().toISOString(), template: templateName }
res.status(200).json({ id: id, data: storeData })
} catch (err) {
} catch (err: any) {
console.error('Error:', err, 'for', req.url)
res.status(500).json({ error: err.toString() })
}

View File

@@ -6,7 +6,10 @@
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "es2017"],
"lib": [
"dom",
"es2017"
],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
@@ -16,8 +19,14 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "esnext"
"target": "esnext",
"incremental": true
},
"exclude": ["node_modules"],
"include": ["**/*.ts", "**/*.tsx"]
"exclude": [
"node_modules"
],
"include": [
"**/*.ts",
"**/*.tsx"
]
}