@@ -372,6 +372,56 @@ describe('resolveType', () => {
372
372
} )
373
373
} )
374
374
375
+ test ( 'typeof' , ( ) => {
376
+ expect (
377
+ resolve ( `
378
+ declare const a: string
379
+ defineProps<{ foo: typeof a }>()
380
+ ` ) . props
381
+ ) . toStrictEqual ( {
382
+ foo : [ 'String' ]
383
+ } )
384
+ } )
385
+
386
+ test ( 'ExtractPropTypes (element-plus)' , ( ) => {
387
+ const { props, raw } = resolve (
388
+ `
389
+ import { ExtractPropTypes } from 'vue'
390
+ declare const props: {
391
+ foo: StringConstructor,
392
+ bar: {
393
+ type: import('foo').EpPropFinalized<BooleanConstructor>,
394
+ required: true
395
+ }
396
+ }
397
+ type Props = ExtractPropTypes<typeof props>
398
+ defineProps<Props>()
399
+ `
400
+ )
401
+ expect ( props ) . toStrictEqual ( {
402
+ foo : [ 'String' ] ,
403
+ bar : [ 'Boolean' ]
404
+ } )
405
+ expect ( raw . props . bar . optional ) . toBe ( false )
406
+ } )
407
+
408
+ test ( 'ExtractPropTypes (antd)' , ( ) => {
409
+ const { props } = resolve (
410
+ `
411
+ declare const props: () => {
412
+ foo: StringConstructor,
413
+ bar: { type: PropType<boolean> }
414
+ }
415
+ type Props = Partial<import('vue').ExtractPropTypes<ReturnType<typeof props>>>
416
+ defineProps<Props>()
417
+ `
418
+ )
419
+ expect ( props ) . toStrictEqual ( {
420
+ foo : [ 'String' ] ,
421
+ bar : [ 'Boolean' ]
422
+ } )
423
+ } )
424
+
375
425
describe ( 'external type imports' , ( ) => {
376
426
const files = {
377
427
'/foo.ts' : 'export type P = { foo: number }' ,
@@ -659,6 +709,7 @@ function resolve(
659
709
return {
660
710
props,
661
711
calls : raw . calls ,
662
- deps : ctx . deps
712
+ deps : ctx . deps ,
713
+ raw
663
714
}
664
715
}
0 commit comments