import { expectType , defineProps , defineEmits , useAttrs , useSlots , withDefaults , Slots , describe } from './index' ; describe ( 'defineProps w/ type declaration' , ( ) => { const props = defineProps < { foo : string ; } > ( ) ; expectType < string > ( props . foo ) ; props . bar ; } ) ; describe ( 'defineProps w/ type declaration + withDefaults' , ( ) => { const res = withDefaults ( defineProps < { number ? : number ; arr ? : string [ ] ; obj ? : { x : number ; } ; fn ? : ( e : string ) => void ; x ? : string ; } > ( ) , { number : 123 , arr : ( ) => [ ] , obj : ( ) => ( { x : 123 } ) , fn : ( ) => { } } ) ; res . number + 1 ; res . arr . push ( 'hi' ) ; res . obj . x ; res . fn ( 'hi' ) ; res . x . slice ( ) ; } ) ; describe ( 'defineProps w/ runtime declaration' , ( ) => { const props = defineProps ( { foo : String , bar : { type : Number , default : 1 } , baz : { type : Array , required : true } } ) ; expectType < { foo ? : string ; bar : number ; baz : unknown [ ] ; } > ( props ) ; props . foo && props . foo + 'bar' ; props . bar + 1 ; props . bar ++ ; props . baz . push ( 1 ) ; const props2 = defineProps ( [ 'foo' , 'bar' ] ) ; props2 . foo + props2 . bar ; props2 . baz ; } ) ; describe ( 'defineEmits w/ type declaration' , ( ) => { const emit = defineEmits < ( e : 'change' ) => void > ( ) ; emit ( 'change' ) ; emit ( ) ; emit ( 'bar' ) ; type Emits = { ( e ) : void ; ( e , id ) : void ; } ; const emit2 = defineEmits < Emits > ( ) ; emit2 ( 'foo' ) ; emit2 ( 'bar' ) ; emit2 ( 'baz' , 123 ) ; emit2 ( 'baz' ) ; } ) ; describe ( 'defineEmits w/ runtime declaration' , ( ) => { const emit = defineEmits ( { foo : ( ) => { } , bar : null } ) ; emit ( 'foo' ) ; emit ( 'bar' , 123 ) ; emit ( 'baz' ) ; const emit2 = defineEmits ( [ 'foo' , 'bar' ] ) ; emit2 ( 'foo' ) ; emit2 ( 'bar' , 123 ) ; emit2 ( 'baz' ) ; } ) ; describe ( 'useAttrs' , ( ) => { const attrs = useAttrs ( ) ; expectType < Record < string , unknown > > ( attrs ) ; } ) ; describe ( 'useSlots' , ( ) => { const slots = useSlots ( ) ; expectType < Slots > ( slots ) ; } ) ;