File tree 2 files changed +27
-2
lines changed
2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -455,13 +455,13 @@ describe('resolveType', () => {
455
455
const { props } = resolve (
456
456
`
457
457
import { IMP } from './foo'
458
- interface Foo { foo: 1, ${ 1 } : 1 }
458
+ interface Foo { foo: 1, ${ 1 } : 1 }
459
459
type Bar = { bar: 1 }
460
460
declare const obj: Bar
461
461
declare const set: Set<any>
462
462
declare const arr: Array<any>
463
463
464
- defineProps<{
464
+ defineProps<{
465
465
imp: keyof IMP,
466
466
foo: keyof Foo,
467
467
bar: keyof Bar,
@@ -483,6 +483,25 @@ describe('resolveType', () => {
483
483
} )
484
484
} )
485
485
486
+ test ( 'keyof: Record utility type' , ( ) => {
487
+ const { props } = resolve (
488
+ `
489
+ type Foo = Record<symbol | string, any>
490
+ type AnyRecord = Record<keyof any, any>
491
+
492
+ defineProps<{
493
+ foo: keyof Foo,
494
+ anyRecord: keyof AnyRecord
495
+ }>()
496
+ ` ,
497
+ )
498
+
499
+ expect ( props ) . toStrictEqual ( {
500
+ foo : [ 'Symbol' , 'String' ] ,
501
+ anyRecord : [ 'Unknown' ] ,
502
+ } )
503
+ } )
504
+
486
505
test ( 'ExtractPropTypes (element-plus)' , ( ) => {
487
506
const { props, raw } = resolve (
488
507
`
Original file line number Diff line number Diff line change @@ -1535,6 +1535,12 @@ export function inferRuntimeType(
1535
1535
case 'ArrayLike' :
1536
1536
case 'ReadonlyArray' :
1537
1537
return [ 'String' , 'Number' ]
1538
+ case 'Record' :
1539
+ return inferRuntimeType (
1540
+ ctx ,
1541
+ node . typeParameters ! . params [ 0 ] ,
1542
+ scope ,
1543
+ )
1538
1544
default :
1539
1545
return [ 'String' ]
1540
1546
}
You can’t perform that action at this time.
0 commit comments