From fb95b8b522a1f7d2699165e2f67f6ccaf76bda87 Mon Sep 17 00:00:00 2001 From: Marcin Lewandowski Date: Thu, 26 Oct 2023 16:51:20 +0200 Subject: [PATCH 1/2] fix(icons-react): fix exports in individual icon TypeScript declarations --- .../icon-build-helpers/src/builders/react/next/typescript.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/icon-build-helpers/src/builders/react/next/typescript.js b/packages/icon-build-helpers/src/builders/react/next/typescript.js index c7716b1112b2..42803dd03d87 100644 --- a/packages/icon-build-helpers/src/builders/react/next/typescript.js +++ b/packages/icon-build-helpers/src/builders/react/next/typescript.js @@ -46,9 +46,8 @@ async function writeModuleTypes(modules, outDir) { templates.banner + '\n' + "import type { CarbonIconType } from './CarbonIcon';\n" + - 'export const ' + - m.name + - ': CarbonIconType;\n'; + `const ${m.name}: CarbonIconType;\n` + + `export default ${m.name}\n`; const filename = path.resolve(outDir, m.filepath.replace(/\.js$/, '.d.ts')); await fs.writeFile(filename, content); } From e9307f0fb5da9d73ee61629f9a8c8fb5c0bbdac8 Mon Sep 17 00:00:00 2001 From: Marcin Lewandowski Date: Mon, 30 Oct 2023 20:10:57 +0100 Subject: [PATCH 2/2] fix(icon-build-helpers): add missing declare keyword in TS builder --- .../icon-build-helpers/src/builders/react/next/typescript.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/icon-build-helpers/src/builders/react/next/typescript.js b/packages/icon-build-helpers/src/builders/react/next/typescript.js index 42803dd03d87..f538b1b75976 100644 --- a/packages/icon-build-helpers/src/builders/react/next/typescript.js +++ b/packages/icon-build-helpers/src/builders/react/next/typescript.js @@ -46,7 +46,7 @@ async function writeModuleTypes(modules, outDir) { templates.banner + '\n' + "import type { CarbonIconType } from './CarbonIcon';\n" + - `const ${m.name}: CarbonIconType;\n` + + `declare const ${m.name}: CarbonIconType;\n` + `export default ${m.name}\n`; const filename = path.resolve(outDir, m.filepath.replace(/\.js$/, '.d.ts')); await fs.writeFile(filename, content);