Skip to content

Commit

Permalink
chore: fix ts error
Browse files Browse the repository at this point in the history
  • Loading branch information
wiidede committed Aug 24, 2023
1 parent b2a62bf commit 99a3be5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ export const allLocales = [
'getLocale',
]

export const allHooks = [
export const allHooks: Options['hooks'] = [
'useFormItem',
]

export const allImportsWithStyle: string[] = [
export const allImportsWithStyle: Options['imports'] = [
'Notification',
'Message',
]

export const allComponents = Object.keys(AllComponents).filter(name =>
!allLocales.includes(name)
&& !allHooks.includes(name)
&& !allImportsWithStyle.includes(name)
&& !allHooks.includes(name as any)
&& !allImportsWithStyle.includes(name as any)
&& !['install', 'default'].includes(name),
)

Expand Down
2 changes: 1 addition & 1 deletion src/core/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function getStyleDir(config: InnerOptions, name: string) {
export function resolveStyles(config: InnerOptions, name: string) {
const { components, noStylesComponents, imports } = config

if ((imports || []).includes(name) && allImportsWithStyle.includes(name))
if ((imports || []).includes(name as any) && (allImportsWithStyle || []).includes(name as any))
return getStyleDir(config, name)

const nameReg = new RegExp(`^${config.componentPrefix}[A-Z]`)
Expand Down
2 changes: 1 addition & 1 deletion src/core/transformPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface PluginOptions extends TransformOptions {
}

const componentsRegExp = /(?<=[ (])_?resolveComponent\(\s*["'](lazy-|Lazy)?([^'"]*?)["'][\s,]*[^)]*\)/g
const importsRegExp = toRegExp(allImportsWithStyle, 'g')
const importsRegExp = toRegExp(allImportsWithStyle || [], 'g')

export const transformPlugin = createUnplugin((options: PluginOptions) => {
const { include, exclude, transformStyles } = options
Expand Down

0 comments on commit 99a3be5

Please sign in to comment.