Skip to content

Commit 24aebdb

Browse files
committed
🏷️ Export component prop types
1 parent 65ef217 commit 24aebdb

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

eslint.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ export default [
149149
react: {
150150
version: 'detect'
151151
}
152-
}
152+
},
153+
ignores: ['dist/**/*']
153154
},
154155
{
155156
files: ['**/*.astro'],
@@ -206,5 +207,11 @@ export default [
206207
'max-len': 'off',
207208
'indent': 'off'
208209
}
210+
},
211+
{
212+
files: ['dist/**/*'],
213+
rules: {
214+
'@typescript-eslint/no-explicit-any': 'off'
215+
}
209216
}
210217
]

scripts/buildTypes.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ const buildTypes = type => {
1010
if (type === 'astro') {
1111
return format(`
1212
${components.map(component => {
13-
return `import type { ${component}Props } from './components/${component}/${component.toLowerCase()}'`
13+
return `import type { ${component}Props as W${component}Props } from './components/${component}/${component.toLowerCase()}'`
1414
}).join('\n')}
1515
1616
declare module 'webcoreui/${type}' {
1717
${components.map(component => {
18-
return `export function ${component}(_props: ${component}Props): any`
18+
return `export function ${component}(_props: W${component}Props): any`
19+
}).join('\n\t')}
20+
21+
${components.map(component => {
22+
return `export type ${component}Props = W${component}Props`
1923
}).join('\n\t')}
2024
}
2125
`)
@@ -48,12 +52,16 @@ const buildTypes = type => {
4852
return format(`
4953
import type { SvelteComponent } from 'svelte'
5054
${components.map(component => {
51-
return `import type { ${getTypeName(component)} } from './components/${component}/${component.toLowerCase()}'`
55+
return `import type { ${getTypeName(component)} as W${getTypeName(component)} } from './components/${component}/${component.toLowerCase()}'`
5256
}).join('\n')}
5357
5458
declare module 'webcoreui/${type}' {
5559
${components.map(component => {
56-
return `export class ${component} extends SvelteComponent<${getTypeName(component)}> {}`
60+
return `export class ${component} extends SvelteComponent<W${getTypeName(component)}> {}`
61+
}).join('\n\t')}
62+
63+
${components.map(component => {
64+
return `export type ${component}Props = W${getTypeName(component)}`
5765
}).join('\n\t')}
5866
}
5967
`)
@@ -80,12 +88,16 @@ const buildTypes = type => {
8088
return format(`
8189
import { FC } from 'react'
8290
${components.map(component => {
83-
return `import type { ${getTypeName(component)} } from './components/${component}/${component.toLowerCase()}'`
91+
return `import type { ${getTypeName(component)} as W${getTypeName(component)} } from './components/${component}/${component.toLowerCase()}'`
8492
}).join('\n')}
8593
8694
declare module 'webcoreui/${type}' {
8795
${components.map(component => {
88-
return `export const ${component}: FC<${getTypeName(component)}>`
96+
return `export const ${component}: FC<W${getTypeName(component)}>`
97+
}).join('\n\t')}
98+
99+
${components.map(component => {
100+
return `export type ${component}Props = W${getTypeName(component)}`
89101
}).join('\n\t')}
90102
}
91103
`)

0 commit comments

Comments
 (0)