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 // Generate types
const 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', 'declare const template: (data: Partial<DefaultMessages>) => string',
'export { template }' 'export { template }'
].join('\n') ].join('\n')