From 8c6bd52f1104714413407252637569248ec4219c Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Sun, 1 Aug 2021 15:09:59 +0800 Subject: [PATCH 1/2] Fix vue TS declarations The declarations generated by #254 aren't correct, leading to tsc errors as seen in #318. --- scripts/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.js b/scripts/build.js index 8800e09e1..58fb71b05 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -86,7 +86,7 @@ async function buildIcons(package, style, format) { let types = package === 'react' ? `import * as React from 'react';\ndeclare function ${componentName}(props: React.ComponentProps<'svg'>): JSX.Element;\nexport default ${componentName};\n` - : `export default import("vue").DefineComponent;` + : `import { DefineComponent } from 'vue';\ndeclare const ${componentName}: DefineComponent;\nexport default ${componentName};\n` return [ fs.writeFile(`${outDir}/${componentName}.js`, content, 'utf8'), From 1658f7c47d883228374d4304187f179b6d29d6ef Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Tue, 17 Aug 2021 18:26:51 +0100 Subject: [PATCH 2/2] Use `RenderFunction` instead of `DefineComponent` --- scripts/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.js b/scripts/build.js index 58fb71b05..9fffcee5d 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -86,7 +86,7 @@ async function buildIcons(package, style, format) { let types = package === 'react' ? `import * as React from 'react';\ndeclare function ${componentName}(props: React.ComponentProps<'svg'>): JSX.Element;\nexport default ${componentName};\n` - : `import { DefineComponent } from 'vue';\ndeclare const ${componentName}: DefineComponent;\nexport default ${componentName};\n` + : `import { RenderFunction } from 'vue';\ndeclare const ${componentName}: RenderFunction;\nexport default ${componentName};\n` return [ fs.writeFile(`${outDir}/${componentName}.js`, content, 'utf8'),