@@ -372,6 +372,56 @@ describe('resolveType', () => {
372372 } )
373373 } )
374374
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+
375425 describe ( 'external type imports' , ( ) => {
376426 const files = {
377427 '/foo.ts' : 'export type P = { foo: number }' ,
@@ -659,6 +709,7 @@ function resolve(
659709 return {
660710 props,
661711 calls : raw . calls ,
662- deps : ctx . deps
712+ deps : ctx . deps ,
713+ raw
663714 }
664715}
0 commit comments