Open phoenix-ru opened 7 months ago
Supporting imported types in defineProps
and defineEmits
requires filesystem access -> a filesystem interface needs to be provided to compiler similar to https://github.com/vuejs/core/blob/ae97e5053895eeaaa443306e72cd8f45da001179/packages/compiler-sfc/src/script/resolveType.ts#L849-L875
I am still not sure how TS is used in the official compiler to generate
.d.ts
of.vue
files. It usesdefineComponent
in the generated code but I want to find a balance between generating the most optimal code (i.e. omittingdefineComponent
) and supporting TS definitions.Spec: https://github.com/vuejs/core/blob/main/packages/compiler-sfc/__tests__/compileScript.spec.ts#L1393-L1424
Tasks:
defineComponent
when in TS mode;any
to some parameters and variables:__props
impl__temp
and__restore
impl (todo because no context restoration is present)defineProps
;withDefaults
defineEmits