fix: handle empty message object when generating declaration

This commit is contained in:
Daniel Roe 2023-07-26 11:08:47 +02:00
parent 5f6e505ea4
commit c398e4177e

View File

@ -129,7 +129,7 @@ export const RenderPlugin = () => {
// Generate types
const types = [
`export type DefaultMessages = Record<${Object.keys(messages).map(a => `"${a}"`).join(' | ')}, string | boolean | number >`,
`export type DefaultMessages = Record<${Object.keys(messages).map(a => `"${a}"`).join(' | ') || 'string'}, string | boolean | number >`,
'declare const template: (data: Partial<DefaultMessages>) => string',
'export { template }'
].join('\n')