File tree 1 file changed +17
-11
lines changed
1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -116,19 +116,25 @@ export default function interpolateName(
116
116
} ) ;
117
117
}
118
118
119
+ interface ILoaderContextOptions {
120
+ customInterpolateName (
121
+ this : LoaderContext < object > ,
122
+ url : string ,
123
+ name : string | ( ( resourcePath : string , resourceQuery ?: string ) => string ) ,
124
+ options ?: IInterpolateNameOptions
125
+ ) : string ;
126
+ }
127
+ type LegacyLoaderContext = LoaderContext < object > & {
128
+ options ?: ILoaderContextOptions ;
129
+ } ;
130
+ const loaderContextOptions : ILoaderContextOptions | undefined = (
131
+ loaderContext as LegacyLoaderContext
132
+ ) . options ;
119
133
if (
120
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
121
- // @ts -ignore LoaderContext doesn't even have options defined on it?
122
- // If we chagned this to be `loaderContext.getOptions()` it would still not have
123
- // the customInterpolateName function defined on it.
124
- typeof loaderContext . options === "object" &&
125
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
126
- // @ts -ignore
127
- typeof loaderContext . options . customInterpolateName === "function"
134
+ typeof loaderContextOptions === "object" &&
135
+ typeof loaderContextOptions . customInterpolateName === "function"
128
136
) {
129
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
130
- // @ts -ignore
131
- url = loaderContext . options . customInterpolateName . call (
137
+ url = loaderContextOptions . customInterpolateName . call (
132
138
loaderContext ,
133
139
url ,
134
140
name ,
You can’t perform that action at this time.
0 commit comments