refactor: fix more type-aware linting errors (#7479)

This commit is contained in:
Joshua Chen 2022-05-24 19:19:24 +08:00 committed by GitHub
parent bf1513a3e3
commit 624735bd92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 192 additions and 189 deletions

View file

@ -6,7 +6,7 @@
*/
import * as lqip from './lqip';
import type {LoaderContext} from 'webpack';
import type {LoaderContext, LoaderModule} from 'webpack';
type Options = {
base64: boolean;
@ -36,8 +36,9 @@ export default async function lqipLoader(
} else {
if (!contentIsFileExport) {
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
const fileLoader = require('file-loader') as typeof import('file-loader');
content = fileLoader.call(this, contentBuffer);
const fileLoader = require('file-loader') as LoaderModule['default'];
// @ts-expect-error: type is a bit unwieldy...
content = fileLoader!.call(this, contentBuffer) as string;
}
source = content.match(
/^(?:export default|module.exports =) (?<source>.*);/,