File tree Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -144,10 +144,10 @@ const getPostcssLoaderOptions = async ({
144
144
root : string ;
145
145
postcssrcCache : PostcssrcCache ;
146
146
} ) : Promise < PostCSSLoaderOptions > => {
147
- const extraPlugins : unknown [ ] = [ ] ;
147
+ const extraPlugins : AcceptedPlugin [ ] = [ ] ;
148
148
149
149
const utils = {
150
- addPlugins ( plugins : unknown | unknown [ ] ) {
150
+ addPlugins ( plugins : AcceptedPlugin | AcceptedPlugin [ ] ) {
151
151
extraPlugins . push ( ...castArray ( plugins ) ) ;
152
152
} ,
153
153
} ;
@@ -181,9 +181,7 @@ const getPostcssLoaderOptions = async ({
181
181
// initialize the plugin to avoid multiple initialization
182
182
// https://github.com/web-infra-dev/rsbuild/issues/3618
183
183
options . plugins = options . plugins . map ( ( plugin ) =>
184
- isPostcssPluginCreator ( plugin as AcceptedPlugin )
185
- ? ( plugin as PluginCreator < unknown > ) ( )
186
- : plugin ,
184
+ isPostcssPluginCreator ( plugin ) ? plugin ( ) : plugin ,
187
185
) ;
188
186
189
187
// always use postcss-load-config to load external config
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import type {
40
40
CSSLoaderOptions ,
41
41
HtmlRspackPlugin ,
42
42
PostCSSLoaderOptions ,
43
+ PostCSSPlugin ,
43
44
StyleLoaderOptions ,
44
45
WebpackConfig ,
45
46
} from './thirdParty' ;
@@ -60,7 +61,7 @@ export type ToolsBundlerChainConfig = OneOrMany<
60
61
61
62
export type ToolsPostCSSLoaderConfig = ConfigChainWithContext <
62
63
PostCSSLoaderOptions ,
63
- { addPlugins : ( plugins : unknown | unknown [ ] ) => void }
64
+ { addPlugins : ( plugins : PostCSSPlugin | PostCSSPlugin [ ] ) => void }
64
65
> ;
65
66
66
67
export type ToolsCSSLoaderConfig = ConfigChain < CSSLoaderOptions > ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export type { WebpackConfig };
19
19
20
20
export type PostCSSOptions = ProcessOptions & {
21
21
config ?: boolean ;
22
- plugins ?: unknown [ ] ;
22
+ plugins ?: AcceptedPlugin [ ] ;
23
23
} ;
24
24
25
25
export type PostCSSLoaderOptions = {
You can’t perform that action at this time.
0 commit comments