@@ -158,12 +158,12 @@ export default defineResolvers({
158
158
*/
159
159
treeshakeClientOnly : {
160
160
async $resolve ( val , get ) {
161
- const isV4 = ( ( await get ( 'future' ) as Record < string , unknown > ) . compatibilityVersion === 4 )
161
+ const isV4 = ( await get ( 'future' ) ) . compatibilityVersion === 4
162
162
if ( isV4 && val === false ) {
163
163
console . warn ( 'Enabling `experimental.treeshakeClientOnly` in v4 compatibility mode as it will no longer be configurable in Nuxt v4.' )
164
164
return true
165
165
}
166
- return val ?? true
166
+ return typeof val === 'boolean' ? val : true
167
167
} ,
168
168
} ,
169
169
@@ -291,12 +291,12 @@ export default defineResolvers({
291
291
*/
292
292
configSchema : {
293
293
async $resolve ( val , get ) {
294
- const isV4 = ( ( await get ( 'future' ) as Record < string , unknown > ) . compatibilityVersion === 4 )
294
+ const isV4 = ( await get ( 'future' ) ) . compatibilityVersion === 4
295
295
if ( isV4 && val === false ) {
296
296
console . warn ( 'Enabling `experimental.configSchema` in v4 compatibility mode as it will no longer be configurable in Nuxt v4.' )
297
297
return true
298
298
}
299
- return val ?? true
299
+ return typeof val === 'boolean' ? val : true
300
300
} ,
301
301
} ,
302
302
@@ -309,12 +309,12 @@ export default defineResolvers({
309
309
*/
310
310
polyfillVueUseHead : {
311
311
async $resolve ( val , get ) {
312
- const isV4 = ( ( await get ( 'future' ) as Record < string , unknown > ) . compatibilityVersion === 4 )
312
+ const isV4 = ( await get ( 'future' ) ) . compatibilityVersion === 4
313
313
if ( isV4 && val === true ) {
314
314
console . warn ( 'Disabling `experimental.polyfillVueUseHead` in v4 compatibility mode as it will no longer be configurable in Nuxt v4.' )
315
315
return false
316
316
}
317
- return val ?? false
317
+ return typeof val === 'boolean' ? val : false
318
318
} ,
319
319
} ,
320
320
@@ -324,12 +324,12 @@ export default defineResolvers({
324
324
*/
325
325
respectNoSSRHeader : {
326
326
async $resolve ( val , get ) {
327
- const isV4 = ( ( await get ( 'future' ) as Record < string , unknown > ) . compatibilityVersion === 4 )
327
+ const isV4 = ( await get ( 'future' ) ) . compatibilityVersion === 4
328
328
if ( isV4 && val === true ) {
329
329
console . warn ( 'Disabling `experimental.respectNoSSRHeader` in v4 compatibility mode as it will no longer be configurable in Nuxt v4.' )
330
330
return false
331
331
}
332
- return val ?? false
332
+ return typeof val === 'boolean' ? val : false
333
333
} ,
334
334
} ,
335
335
@@ -491,18 +491,22 @@ export default defineResolvers({
491
491
/** @type {'undefined' | 'null' } */
492
492
value : {
493
493
async $resolve ( val , get ) {
494
- return val ?? ( ( await get ( 'future' ) as Record < string , unknown > ) . compatibilityVersion === 4 ? 'undefined' : 'null' )
494
+ const validOptions = [ 'undefined' , 'null' ] as const
495
+ type ValidOption = typeof validOptions [ number ]
496
+ return typeof val === 'string' && validOptions . includes ( val as ValidOption ) ? ( val as ValidOption ) : ( ( await get ( 'future' ) ) . compatibilityVersion === 4 ? 'undefined' : 'null' )
495
497
} ,
496
498
} ,
497
499
/** @type {'undefined' | 'null' } */
<
6D40
td data-grid-cell-id="diff-8133e9f1c64236731ed847ade3bc2eb437a7e044ca8dce3f3ec38bea75975ee7-498-500-0" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative diff-line-number-neutral left-side">498
500
errorValue : {
499
501
async $resolve ( val , get ) {
500
- return val ?? ( ( await get ( 'future' ) as Record < string , unknown > ) . compatibilityVersion === 4 ? 'undefined' : 'null' )
502
+ const validOptions = [ 'undefined' , 'null' ] as const
503
+ type ValidOption = typeof validOptions [ number ]
504
+ return typeof val === 'string' && validOptions . includes ( val as ValidOption ) ? ( val as ValidOption ) : ( ( await get ( 'future' ) ) . compatibilityVersion === 4 ? 'undefined' : 'null' )
501
505
} ,
502
506
} ,
503
507
deep : {
504
508
async $resolve ( val , get ) {
505
- return val ?? ! ( ( await get ( 'future' ) as Record < string , unknown > ) . compatibilityVersion = == 4 )
509
+ return typeof val === 'boolean' ? val : ( ( await get ( 'future' ) ) . compatibilityVersion ! == 4 )
506
510
} ,
507
511
} ,
508
512
} ,
@@ -533,7 +537,7 @@ export default defineResolvers({
533
537
*/
534
538
compileTemplate : {
535
539
async $resolve ( val , get ) {
536
- return val ?? ( ( await get ( 'future' ) as Record < string , unknown > ) . compatibilityVersion !== 4 )
540
+ return typeof val === 'boolean' ? val : ( ( await get ( 'future' ) ) . compatibilityVersion !== 4 )
537
541
} ,
538
542
} ,
539
543
@@ -546,7 +550,7 @@ export default defineResolvers({
546
550
*/
547
551
templateUtils : {
548
552
async $resolve ( val , get ) {
549
- return val ?? ( ( await get ( 'future' ) as Record < string , unknown > ) . compatibilityVersion !== 4 )
553
+ return typeof val === 'boolean' ? val : ( ( await get ( 'future' ) ) . compatibilityVersion !== 4 )
550
554
} ,
551
555
} ,
552
556
@@ -558,7 +562,7 @@ export default defineResolvers({
558
562
*/
559
563
relativeWatchPaths : {
560
564
async $resolve ( val , get ) {
561
- return val ?? ( ( await get ( 'future' ) as Record < string , unknown > ) . compatibilityVersion !== 4 )
565
+ return typeof val === 'boolean' ? val : ( ( await get ( 'future' ) ) . compatibilityVersion !== 4 )
562
566
} ,
563
567
} ,
564
568
@@ -568,7 +572,7 @@ export default defineResolvers({
568
572
*/
569
573
resetAsyncDataToUndefined : {
570
574
async $resolve ( val , get ) {
571
- return val ?? ( ( await get ( 'future' ) as Record < string , unknown > ) . compatibilityVersion !== 4 )
575
+ return typeof val === 'boolean' ? val : ( ( await get ( 'future' ) ) . compatibilityVersion !== 4 )
572
576
} ,
573
577
} ,
574
578
@@ -606,7 +610,7 @@ export default defineResolvers({
606
610
$resolve : async ( val , get ) => {
607
611
const validOptions = [ 'body' , 'within' ] as const
608
612
type SpaLoadingTemplateLocation = typeof validOptions [ number ]
609
- return typeof val === 'string' && validOptions . includes ( val as SpaLoadingTemplateLocation ) ? val as SpaLoadingTemplateLocation : ( ( ( await get ( 'future' ) ) . compatibilityVersion === 4 ) ? 'body' : 'within' )
613
+ return typeof val === 'string' && validOptions . includes ( val as SpaLoadingTemplateLocation ) ? val as SpaLoadingTemplateLocation : ( ( await get ( 'future' ) ) . compatibilityVersion === 4 ? 'body' : 'within' )
610
614
} ,
611
615
} ,
612
616
0 commit comments