Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/core/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import type {
ConfigChain,
ConfigChainMergeContext,
ConfigChainWithContext,
LiteralUnion,
MaybePromise,
OneOrMany,
Optional,
Expand Down Expand Up @@ -1193,7 +1194,7 @@ export interface OutputConfig {
* `auto` means use a relative path based on file location.
* @default `server.base`
*/
assetPrefix?: string | 'auto';
assetPrefix?: LiteralUnion<'auto', string>;
/**
* Set the size threshold to inline static assets such as images and fonts.
* By default, static assets will be Base64 encoded and inline into the page if
Expand Down Expand Up @@ -1734,7 +1735,7 @@ export interface DevConfig {
* similar to the [output.publicPath](https://rspack.rs/config/output#outputpublicpath)
* config of Rspack.
*/
assetPrefix?: string | boolean;
assetPrefix?: LiteralUnion<'auto', string> | boolean;
/**
* Whether to render progress bars to display the build progress.
* @default false
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/types/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export type MaybePromise<T> = T | Promise<T>;

export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;

// https://github.com/microsoft/TypeScript/issues/29729
export type LiteralUnion<T extends U, U> = T | (U & Record<never, never>);

/**
* Creates a type with readonly properties at the first and second levels only.
*/
Expand Down
Loading