Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research TS development experience #23

Open
2 of 7 tasks
phoenix-ru opened this issue Feb 16, 2024 · 1 comment
Open
2 of 7 tasks

Research TS development experience #23

phoenix-ru opened this issue Feb 16, 2024 · 1 comment
Labels
compat: spec Compatibility with official compiler
Milestone

Comments

@phoenix-ru
Copy link
Owner

phoenix-ru commented Feb 16, 2024

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:

  • Implement defineComponent when in TS mode;
  • Add any to some parameters and variables:
    • __props impl
    • __temp and __restore impl (todo because no context restoration is present)
  • Implement type-only defineProps;
    • Also implement withDefaults
  • Implement type-only defineEmits
@phoenix-ru phoenix-ru added the compat: spec Compatibility with official compiler label Feb 16, 2024
@phoenix-ru phoenix-ru added this to the Beta milestone Feb 16, 2024
@phoenix-ru phoenix-ru pinned this issue Jun 25, 2024
@phoenix-ru
Copy link
Owner Author

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

phoenix-ru added a commit that referenced this issue Aug 23, 2024
* feat(#23): implement type-only defineProps and withDefaults WIP

* chore: add new word to dictionary

* feat: finish `infer_runtime_type`

* chore: add `keyof` to dictionary

* feat: implement defineProps and withDefaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compat: spec Compatibility with official compiler
Projects
None yet
Development

No branches or pull requests

1 participant