diff --git a/src/codegen.ts b/src/codegen.ts index 3326581..2985c64 100644 --- a/src/codegen.ts +++ b/src/codegen.ts @@ -32,7 +32,7 @@ export const codegen = ( const ctDtsFile: ArtifactContent = { file: 'ct.d.ts', code: `${serializeMapTypes(map)} - \nexport const ct: (alias: T) => typeof pluginCtMap[T];`, + \nexport const ct: (alias: T) => PluginCtMapType[T];`, }; cssFn.files.push(ctFile, ctDtsFile); diff --git a/src/utils.ts b/src/utils.ts index d482416..a8070bc 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -15,10 +15,10 @@ export const serializeValue = (value: any) => { }; export const serializeMapTypes = (map: Map) => { - let code = 'const pluginCtMap = {'; + let code = 'type PluginCtMapType = {'; for (const [key, value] of map.entries()) { code += `\n '${key}': ${serializeValue(value)},`; } - code += '\n} as const;'; + code += '\n}'; return code; };