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) addDocument(data)
setPdfIsLoading(false) setPdfIsLoading(false)
setPdfUrl(url) setPdfUrl(url)
} catch (error) { } catch (error: any) {
setPdfIsLoading(false) setPdfIsLoading(false)
setPdfError(error.message) setPdfError(error?.message || 'Unknown error')
setPdfUrl(null) setPdfUrl(null)
} }
} }

View File

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

View File

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

View File

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