From 933006656be8b355a745b1941b9f4d5c4d703aaf Mon Sep 17 00:00:00 2001 From: Soumyaraj Bag Date: Sun, 29 Mar 2026 15:59:12 +0530 Subject: [PATCH] fix: use '&' separator for intersection types in type resolver --- pages/v5.x/globals.md | 74 ++++++++++----------- pages/v5.x/webpack/namespaces/cli.md | 2 +- pages/v5.x/webpack/namespaces/util/index.md | 2 +- plugins/theme/partials/types.mjs | 4 +- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/pages/v5.x/globals.md b/pages/v5.x/globals.md index afd8ee8..bb97cd2 100644 --- a/pages/v5.x/globals.md +++ b/pages/v5.x/globals.md @@ -1542,13 +1542,13 @@ from parent (or top level compiler) and creates a child Compilation ##### Call Signature -* `options` {FactorizeModuleOptions|object} +* `options` {FactorizeModuleOptions&object} * `callback` {object} * Returns: {void} ##### Call Signature -* `options` {FactorizeModuleOptions|object} +* `options` {FactorizeModuleOptions&object} * `callback` {object} * Returns: {void} @@ -1860,7 +1860,7 @@ Fetches a module from a compilation by its identifier ###### T `T` *extends* {object|object[]} = {object} -* `schema` {JSONSchema4|ExtendedSchema|JSONSchema6|ExtendedSchema|JSONSchema7|ExtendedSchema|object} +* `schema` {JSONSchema4&ExtendedSchema|JSONSchema6&ExtendedSchema|JSONSchema7&ExtendedSchema|object} * `value` {T} * `options` {ValidationErrorConfiguration} * `check` {object} @@ -1942,7 +1942,7 @@ Schema validation function with optional pre-compiled check #### Static method: `matchModuleReference(name)` * `name` {string} -* Returns: {ModuleReferenceOptions|object} +* Returns: {ModuleReferenceOptions&object} *** @@ -3618,12 +3618,12 @@ Apply the plugin #### `new LoaderOptionsPlugin([options])` -* `options` {LoaderOptionsPluginOptions|MatchObject} +* `options` {LoaderOptionsPluginOptions&MatchObject} * Returns: {LoaderOptionsPlugin} ### Properties -* `options` {LoaderOptionsPluginOptions|MatchObject} +* `options` {LoaderOptionsPluginOptions&MatchObject} ### Methods @@ -4523,7 +4523,7 @@ In webpack 6, call getSourceBasicTypes() directly on the module instance instead * `hooks` {Readonly} * `inputFileSystem` {InputFileSystem} * `intermediateFileSystem` {IntermediateFileSystem} -* `options` {WebpackOptionsNormalized[]|MultiCompilerOptions} +* `options` {WebpackOptionsNormalized[]&MultiCompilerOptions} * `outputFileSystem` {OutputFileSystem} * `outputPath` {string} * `running` {boolean} @@ -4691,7 +4691,7 @@ Apply the plugin * `request` {string} * `resolveOptions` {ResolveOptions} * `resource` {string} -* `resourceResolveData` {ResourceSchemeData|Partial} +* `resourceResolveData` {ResourceSchemeData&Partial} * `type` {string} * `used` {any} * `usedExports` {boolean|SortableSet} @@ -5843,7 +5843,7 @@ Apply the plugin #### Static method: `renderRuntimeModules(runtimeModules, renderContext)` * `runtimeModules` {RuntimeModule[]} -* `renderContext` {RenderContextJavascriptModulesPlugin|object} +* `renderContext` {RenderContextJavascriptModulesPlugin&object} * Returns: {Source} #### Static method: `toComment(str)` @@ -6320,7 +6320,7 @@ Options object as provided by the user. * `entry` {string|string[]|EntryObject|object} The entry point(s) of the compilation. * `experiments` {Experiments} Enables/Disables experiments (experimental features with relax SemVer compatibility). * `extends` {string|string[]} Extend configuration from another configuration (only works when using webpack-cli). -* `externals` {string|RegExp|ExternalItemObjectKnown|ExternalItemObjectUnknown|object|object|ExternalItem[]} Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`. +* `externals` {string|RegExp|ExternalItemObjectKnown&ExternalItemObjectUnknown|object|object|ExternalItem[]} Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`. * `externalsPresets` {ExternalsPresets} Enable presets of externals for specific targets. * `externalsType` {"asset"|"module"|"css-import"|"css-url"|"global"|"import"|"commonjs"|"jsonp"|"promise"|"this"|"var"|"assign"|"window"|"self"|"commonjs2"|"commonjs-module"|"commonjs-static"|"amd"|"amd-require"|"umd"|"umd2"|"system"|"module-import"|"script"|"node-commonjs"} Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value). * `ignoreWarnings` {RegExp|object|object[]} Ignore specific warnings. @@ -6496,7 +6496,7 @@ Options for library. `ContextAdditions` = {object} -* `this` {NormalModuleLoaderContext|LoaderRunnerLoaderContext|LoaderPluginLoaderContext|HotModuleReplacementPluginLoaderContext|ContextAdditions} +* `this` {NormalModuleLoaderContext&LoaderRunnerLoaderContext&LoaderPluginLoaderContext&HotModuleReplacementPluginLoaderContext&ContextAdditions} * `content` {string} * `sourceMap` {string|RawSourceMap} * `additionalData` {AdditionalData} @@ -6670,7 +6670,7 @@ Specify options for each parser. `ContextAdditions` = {object} -* `this` {NormalModuleLoaderContext|LoaderRunnerLoaderContext|LoaderPluginLoaderContext|HotModuleReplacementPluginLoaderContext|ContextAdditions} +* `this` {NormalModuleLoaderContext&LoaderRunnerLoaderContext&LoaderPluginLoaderContext&HotModuleReplacementPluginLoaderContext&ContextAdditions} * `remainingRequest` {string} * `previousRequest` {string} * `data` {object} @@ -6703,7 +6703,7 @@ Specify options for each parser. `ContextAdditions` = {object} -* `this` {NormalModuleLoaderContext|LoaderRunnerLoaderContext|LoaderPluginLoaderContext|HotModuleReplacementPluginLoaderContext|ContextAdditions} +* `this` {NormalModuleLoaderContext&LoaderRunnerLoaderContext&LoaderPluginLoaderContext&HotModuleReplacementPluginLoaderContext&ContextAdditions} * `content` {Buffer} * `sourceMap` {string|RawSourceMap} * `additionalData` {AdditionalData} @@ -6737,7 +6737,7 @@ Specify options for each parser. * `context` {string} * `contextDependencies` {LazySet} * `contextInfo` {ModuleFactoryCreateDataContextInfo} -* `createData` {Partial} +* `createData` {Partial} * `dependencies` {ModuleDependency[]} * `dependencyType` {string} * `fileDependencies` {LazySet} @@ -6973,7 +6973,7 @@ Plugin instance. ## Type: `AssetInfo` -> **AssetInfo** = {KnownAssetInfo|Record} +> **AssetInfo** = {KnownAssetInfo&Record} *** @@ -6991,7 +6991,7 @@ Plugin instance. ## Type: `EntryOptions` -> **EntryOptions** = {object|Omit} +> **EntryOptions** = {object&Omit} ### Type Declaration @@ -7001,7 +7001,7 @@ Plugin instance. ## Type: `ExternalItem` -> **ExternalItem** = {string|RegExp|ExternalItemObjectKnown|ExternalItemObjectUnknown|object|object} +> **ExternalItem** = {string|RegExp|ExternalItemObjectKnown&ExternalItemObjectUnknown|object|object} *** @@ -7068,13 +7068,13 @@ Plugin instance. ## Type: `Externals` -> **Externals** = {string|RegExp|ExternalItemObjectKnown|ExternalItemObjectUnknown|object|object|ExternalItem[]} +> **Externals** = {string|RegExp|ExternalItemObjectKnown&ExternalItemObjectUnknown|object|object|ExternalItem[]} *** ## Type: `LoaderContext` -> **LoaderContext**\<`OptionsType`\> = {NormalModuleLoaderContext|LoaderRunnerLoaderContext|LoaderPluginLoaderContext|HotModuleReplacementPluginLoaderContext} +> **LoaderContext**\<`OptionsType`\> = {NormalModuleLoaderContext&LoaderRunnerLoaderContext&LoaderPluginLoaderContext&HotModuleReplacementPluginLoaderContext} ### Type Parameters @@ -7086,7 +7086,7 @@ Plugin instance. ## Type: `LoaderDefinition` -> **LoaderDefinition**\<`OptionsType`, `ContextAdditions`\> = {LoaderDefinitionFunction|object} +> **LoaderDefinition**\<`OptionsType`, `ContextAdditions`\> = {LoaderDefinitionFunction&object} ### Type Declaration @@ -7107,19 +7107,19 @@ Plugin instance. ## Type: `MultiConfiguration` -> **MultiConfiguration** = {ReadonlyArray|MultiCompilerOptions} +> **MultiConfiguration** = {ReadonlyArray&MultiCompilerOptions} *** ## Type: `ParserState` -> **ParserState** = {ParserStateBase|Record} +> **ParserState** = {ParserStateBase&Record} *** ## Type: `RawLoaderDefinition` -> **RawLoaderDefinition**\<`OptionsType`, `ContextAdditions`\> = {RawLoaderDefinitionFunction|object} +> **RawLoaderDefinition**\<`OptionsType`, `ContextAdditions`\> = {RawLoaderDefinitionFunction&object} ### Type Declaration @@ -7243,85 +7243,85 @@ Plugin instance. ## Type: `StatsAsset` -> **StatsAsset** = {KnownStatsAsset|Record} +> **StatsAsset** = {KnownStatsAsset&Record} *** ## Type: `StatsChunk` -> **StatsChunk** = {KnownStatsChunk|Record} +> **StatsChunk** = {KnownStatsChunk&Record} *** ## Type: `StatsChunkGroup` -> **StatsChunkGroup** = {KnownStatsChunkGroup|Record} +> **StatsChunkGroup** = {KnownStatsChunkGroup&Record} *** ## Type: `StatsChunkOrigin` -> **StatsChunkOrigin** = {KnownStatsChunkOrigin|Record} +> **StatsChunkOrigin** = {KnownStatsChunkOrigin&Record} *** ## Type: `StatsCompilation` -> **StatsCompilation** = {KnownStatsCompilation|Record} +> **StatsCompilation** = {KnownStatsCompilation&Record} *** ## Type: `StatsError` -> **StatsError** = {KnownStatsError|Record} +> **StatsError** = {KnownStatsError&Record} *** ## Type: `StatsLogging` -> **StatsLogging** = {KnownStatsLogging|Record} +> **StatsLogging** = {KnownStatsLogging&Record} *** ## Type: `StatsLoggingEntry` -> **StatsLoggingEntry** = {KnownStatsLoggingEntry|Record} +> **StatsLoggingEntry** = {KnownStatsLoggingEntry&Record} *** ## Type: `StatsModule` -> **StatsModule** = {KnownStatsModule|Record} +> **StatsModule** = {KnownStatsModule&Record} *** ## Type: `StatsModuleIssuer` -> **StatsModuleIssuer** = {KnownStatsModuleIssuer|Record} +> **StatsModuleIssuer** = {KnownStatsModuleIssuer&Record} *** ## Type: `StatsModuleReason` -> **StatsModuleReason** = {KnownStatsModuleReason|Record} +> **StatsModuleReason** = {KnownStatsModuleReason&Record} *** ## Type: `StatsModuleTraceDependency` -> **StatsModuleTraceDependency** = {KnownStatsModuleTraceDependency|Record} +> **StatsModuleTraceDependency** = {KnownStatsModuleTraceDependency&Record} *** ## Type: `StatsModuleTraceItem` -> **StatsModuleTraceItem** = {KnownStatsModuleTraceItem|Record} +> **StatsModuleTraceItem** = {KnownStatsModuleTraceItem&Record} *** ## Type: `StatsProfile` -> **StatsProfile** = {KnownStatsProfile|Record} +> **StatsProfile** = {KnownStatsProfile&Record} *** diff --git a/pages/v5.x/webpack/namespaces/cli.md b/pages/v5.x/webpack/namespaces/cli.md index eaecba5..5b66e69 100644 --- a/pages/v5.x/webpack/namespaces/cli.md +++ b/pages/v5.x/webpack/namespaces/cli.md @@ -13,7 +13,7 @@ > **getArguments**: {object} -* `schema` {JSONSchema4|object|JSONSchema6|object|JSONSchema7|object} +* `schema` {JSONSchema4&object|JSONSchema6&object|JSONSchema7&object} * Returns: {Flags} *** diff --git a/pages/v5.x/webpack/namespaces/util/index.md b/pages/v5.x/webpack/namespaces/util/index.md index 18b891b..e4b4a83 100644 --- a/pages/v5.x/webpack/namespaces/util/index.md +++ b/pages/v5.x/webpack/namespaces/util/index.md @@ -108,7 +108,7 @@ `O` * `first` {null|T} * `second` {null|O} -* Returns: {T|O|T|O} +* Returns: {T|O|T&O} *** diff --git a/plugins/theme/partials/types.mjs b/plugins/theme/partials/types.mjs index cf7261d..2cf3474 100644 --- a/plugins/theme/partials/types.mjs +++ b/plugins/theme/partials/types.mjs @@ -25,9 +25,11 @@ const resolve = type => { return `Tuple<${union(type.elements, ', ')}>`; case 'union': - case 'intersection': return union(type.types); + case 'intersection': + return union(type.types, '&'); + case 'optional': case 'indexedAccess': return resolve(type.elementType ?? type.objectType);