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
4 of 7 tasks
phoenix-ru opened this issue Feb 16, 2024 · 1 comment
Open
4 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
phoenix-ru added a commit that referenced this issue Sep 28, 2024
* feat(#23): support scope-aware type resolutions

* feat: resolve `todo!` comments

* feat: finish `recordType`

* ci: update artifact actions to v4
phoenix-ru added a commit that referenced this issue Oct 27, 2024
* test(#23): add some resolveType tests and fix behaviour

* chore: add test words to dict

* test: add more cases and fix indexed access

* test: add more test-cases

* ci: try using ubuntu 24.04 to fix grcov

* enh: support owner scopes

* fix: support more ExtractPropType tests

* enh: support namespaces

* test: fix enum test

* test: add tests for generics and remove `dbg!`
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