Skip to content

Commit 4b05bec

Browse files
authored
Revert "fix(types): correct withDefaults return type for boolean prop with undefined default value (vuejs#8602)"
This reverts commit f07cb18.
1 parent 2a2810c commit 4b05bec

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

packages/dts-test/setupHelpers.test-d.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -134,26 +134,6 @@ describe('defineProps w/ generic type declaration + withDefaults', <T extends nu
134134
expectType<boolean>(res.bool)
135135
})
136136

137-
describe('withDefaults w/ boolean type', () => {
138-
const res1 = withDefaults(
139-
defineProps<{
140-
bool?: boolean
141-
}>(),
142-
{ bool: false }
143-
)
144-
expectType<boolean>(res1.bool)
145-
146-
const res2 = withDefaults(
147-
defineProps<{
148-
bool?: boolean
149-
}>(),
150-
{
151-
bool: undefined
152-
}
153-
)
154-
expectType<boolean | undefined>(res2.bool)
155-
})
156-
157137
describe('defineProps w/ runtime declaration', () => {
158138
// runtime declaration
159139
const props = defineProps({

packages/runtime-core/src/apiSetupHelpers.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,7 @@ type PropsWithDefaults<
303303
? T[K]
304304
: NotUndefined<T[K]>
305305
: never
306-
} & {
307-
readonly [K in BKeys]-?: K extends keyof Defaults
308-
? Defaults[K] extends undefined
309-
? boolean | undefined
310-
: boolean
311-
: boolean
312-
}
306+
} & { readonly [K in BKeys]-?: boolean }
313307

314308
/**
315309
* Vue `<script setup>` compiler macro for providing props default values when

0 commit comments

Comments
 (0)