From 8253348b3c197f32b6ded0175dd5acd51f7128e4 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 13 Nov 2024 20:26:15 +0800 Subject: [PATCH] Fix typing of mainFields option (#106) --- README.md | 2 +- src/options.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3b10784..70e0761 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ An array of the extensions that will be tried during resolve. Ideally this would This allows you to override the `baseUrl` found in tsconfig.json. The baseUrl specifies from which directory `paths` should be resolved. So this option enabled you to resolve from another directory than the one where tsconfig.json is located. This can be useful if you want to use webpack with `tsc --watch` instead of a typescript loader. If this option is `undefined` then the `baseUrl` from tsconfig.json will be used. -#### mainFields _(string[]) (default=["main"])_ +#### mainFields _((string | string[])[]) (default=["main"])_ An array of the field names that should be considered when resolving packages. Ideally this would be the same as the mainFields from the webpack config but it seems resolver plug-ins does not have access to this infomration so you need to specify it again for the plugin. diff --git a/src/options.ts b/src/options.ts index c9e105d..ceddee6 100644 --- a/src/options.ts +++ b/src/options.ts @@ -9,7 +9,7 @@ export interface Options { readonly logInfoToStdOut: boolean; readonly context: string | undefined; readonly colors: boolean; - readonly mainFields: string[]; + readonly mainFields: (string | string[])[]; readonly references: string[] | undefined; }