From b97aa45c5c0ef5cfccc15294767c2bc8f0a7307d Mon Sep 17 00:00:00 2001 From: meskill <8974488+meskill@users.noreply.github.com> Date: Fri, 9 Dec 2022 01:15:02 +0100 Subject: [PATCH] fix(node-swc): Sync types for `jsc.optimizer.globals` (#6603) --- node-swc/src/types.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/node-swc/src/types.ts b/node-swc/src/types.ts index 07ae2f6b9d2e..068924aeb381 100644 --- a/node-swc/src/types.ts +++ b/node-swc/src/types.ts @@ -879,18 +879,25 @@ export interface OptimizerConfig { */ export interface GlobalPassOption { /** - * Global variables. + * Global variables that should be inlined with passed value. * * e.g. `{ __DEBUG__: true }` */ - vars?: { [key: string]: string }; + vars?: Record; /** - * Name of environment variables to inline. + * Names of environment variables that should be inlined with the value of corresponding env during build. * * Defaults to `["NODE_ENV", "SWC_ENV"]` */ envs?: string[]; + + /** + * Replaces typeof calls for passed variables with corresponding value + * + * e.g. `{ window: 'object' }` + */ + typeofs?: Record; } export type ModuleConfig = Es6Config | CommonJsConfig | UmdConfig | AmdConfig | NodeNextConfig | SystemjsConfig;