phoenix-ru / fervid

All-in-One Vue compiler written in Rust
https://phoenix-ru.github.io/fervid/
Apache License 2.0
371 stars 9 forks source link

Research TS development experience #23

Open phoenix-ru opened 7 months ago

phoenix-ru commented 7 months ago

I am still not sure how TS is used in the official compiler to generate .d.ts of .vue files. It uses defineComponent in the generated code but I want to find a balance between generating the most optimal code (i.e. omitting defineComponent) and supporting TS definitions.

Spec: https://github.com/vuejs/core/blob/main/packages/compiler-sfc/__tests__/compileScript.spec.ts#L1393-L1424

Tasks:

phoenix-ru commented 2 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