Skip to content

Commit 4334ea3

Browse files
committedMar 25, 2023
fix: typeof import default in dts
1 parent 57e1c67 commit 4334ea3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

Diff for: ‎src/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const createTemplates = (resolvedConfig: Config, maxLevel: number, nuxt =
8484
filename: `tailwind.config/${subpath}.mjs`,
8585
getContents: () => `${values.map(v => `import _${v} from "./${key}/${v}.mjs"`).join('\n')}\nconst config = { ${values.map(k => `"${k}": _${k}`).join(', ')} }\nexport { config as default${values.length > 0 ? ', _' : ''}${values.join(', _')} }`
8686
})
87-
dtsContent.push(`declare module "#tailwind-config/${subpath}" {${Object.keys(value).map(v => ` export const _${v}: typeof import("#tailwind-config/${join(`${key}/${subpath}`, `../${v}`)}");`).join('')} const defaultExport: { ${values.map(k => `"${k}": typeof _${k}`).join(', ')} }; export default defaultExport; }`)
87+
dtsContent.push(`declare module "#tailwind-config/${subpath}" {${Object.keys(value).map(v => ` export const _${v}: typeof import("#tailwind-config/${join(`${key}/${subpath}`, `../${v}`)}").default;`).join('')} const defaultExport: { ${values.map(k => `"${k}": typeof _${k}`).join(', ')} }; export default defaultExport; }`)
8888
}
8989
})
9090
}
@@ -98,7 +98,7 @@ export const createTemplates = (resolvedConfig: Config, maxLevel: number, nuxt =
9898
write: true
9999
})
100100

101-
dtsContent.push(`declare module "#tailwind-config" {${configOptions.map(v => ` export const ${v}: typeof import("${join('#tailwind-config', v)}");`).join('')} const defaultExport: { ${configOptions.map(v => `"${v}": typeof ${v}`)} }; export default defaultExport; }`)
101+
dtsContent.push(`declare module "#tailwind-config" {${configOptions.map(v => ` export const ${v}: typeof import("${join('#tailwind-config', v)}").default;`).join('')} const defaultExport: { ${configOptions.map(v => `"${v}": typeof ${v}`)} }; export default defaultExport; }`)
102102
const typesTemplate = addTemplate({
103103
filename: 'tailwind.config.d.ts',
104104
getContents: () => dtsContent.join('\n'),

0 commit comments

Comments
 (0)
Please sign in to comment.