From 58396f52f7cd6ea901a3e65b991d78057eb79b33 Mon Sep 17 00:00:00 2001 From: Sean Larkin Date: Wed, 19 Apr 2023 15:17:35 +0000 Subject: [PATCH] introduce the new types from enhanced-resolve --- types.d.ts | 59 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/types.d.ts b/types.d.ts index 3a1f1becba1..7e6a78dcdf9 100644 --- a/types.d.ts +++ b/types.d.ts @@ -4191,17 +4191,31 @@ declare interface FileSystem { arg2: FileSystemCallback ): void; }; - readdir: { - ( - arg0: string, - arg1: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]> - ): void; - ( - arg0: string, - arg1: object, - arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]> - ): void; - }; + readdir: ( + arg0: string, + arg1?: + | null + | "ascii" + | "utf8" + | "utf16le" + | "ucs2" + | "latin1" + | "binary" + | (( + arg0?: null | NodeJS.ErrnoException, + arg1?: any[] | (string | Buffer)[] + ) => void) + | ReaddirOptions + | "utf-8" + | "ucs-2" + | "base64" + | "hex" + | "buffer", + arg2?: ( + arg0?: null | NodeJS.ErrnoException, + arg1?: any[] | (string | Buffer)[] + ) => void + ) => void; readJson?: { (arg0: string, arg1: FileSystemCallback): void; (arg0: string, arg1: object, arg2: FileSystemCallback): void; @@ -4234,11 +4248,6 @@ declare interface FileSystem { declare interface FileSystemCallback { (err?: null | (PossibleFileSystemError & Error), result?: T): any; } -declare interface FileSystemDirent { - name: string | Buffer; - isDirectory: () => boolean; - isFile: () => boolean; -} declare abstract class FileSystemInfo { fs: InputFileSystem; logger?: WebpackLogger; @@ -4590,7 +4599,7 @@ declare interface HashedModuleIdsPluginOptions { /** * The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported. */ - hashDigest?: "latin1" | "hex" | "base64"; + hashDigest?: "latin1" | "base64" | "hex"; /** * The prefix length of the hash digest to use, defaults to 4. @@ -9411,6 +9420,22 @@ declare class ReadFileCompileWasmPlugin { */ apply(compiler: Compiler): void; } +declare interface ReaddirOptions { + encoding?: + | null + | "ascii" + | "utf8" + | "utf16le" + | "ucs2" + | "latin1" + | "binary" + | "utf-8" + | "ucs-2" + | "base64" + | "hex" + | "buffer"; + withFileTypes?: boolean; +} declare class RealContentHashPlugin { constructor(__0: { hashFunction: any; hashDigest: any });