Skip to content
Merged
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
58 changes: 57 additions & 1 deletion packages/vite/src/node/__tests_dts__/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,66 @@ export type cases1 = [

defineConfig({
base: '',
// @ts-expect-error
build: {
minify: 'oxc', // `as const` is not needed
},
server: {
proxy: {
'/test': {
bypass: () => false,
},
},
},
// @ts-expect-error --- invalid option should error
unknownProperty: 1,
})

defineConfig(() => ({
base: '',
build: {
minify: 'oxc' as const, // ideally we don't want to require `as const` here
},
server: {
proxy: {
'/test': {
bypass: () => false as const, // ideally we don't want to require `as const` here
},
},
},
unknownProperty: 1, // we cannot catch invalid option for this case, ideally we should
}))

// @ts-expect-error --- nested invalid option `build.unknown` should error
defineConfig(() => ({
base: '',
build: {
unknown: 1,
},
}))

defineConfig(async () => ({
base: '',
build: {
minify: 'oxc' as const, // ideally we don't want to require `as const` here
},
server: {
proxy: {
'/test': {
bypass: () => false as const, // ideally we don't want to require `as const` here
},
},
},
unknownProperty: 1, // we cannot catch invalid option for this case, ideally we should
}))

// @ts-expect-error --- nested invalid option `build.unknown` should error
defineConfig(async () => ({
base: '',
build: {
unknown: 1,
},
}))

mergeConfig(defineConfig({}), defineConfig({}))
mergeConfig(
// @ts-expect-error
Expand Down