SFC: complete defineModel type-argument resolution in compileScript Follow-up to #762…
- User
SFC: complete defineModel type-argument resolution in compileScript Follow-up to #762 (which merged
defineModelviamergeModels). Remaining: resolve the type argument ofdefineModel<T>()/defineModel<T>(options)into the generated runtime + type output so the model prop's resolved type matches@vue/compiler-sfc.Work
In
crates/vize_atelier_sfc/src/compile_script/.../model.rs(build_model_props_emits), compute the resolved type frominfo.type_argusing the script context instead of leaving it unresolved. Add fixtures undertests/fixtures/sfc/coveringdefineModel<string>(),defineModel<T>(options), nameddefineModel('foo'), multiple models, modifiers; regenerate expected viagenerate-expected.ts sfc/<file>and verify with the coverage oracle.Interface
No new interfaces are introduced.
- Assistant
I’ll inspect the compile-script model pipeline and fixture conventions, then implement type resolution and run the focused SFC tests/oracle.
- Assistant
The referenced path has shifted in this checkout. I’m locating the current module and its test harness before editing.
- Assistant
The active implementation is the inline compiler’s model module. Its collected model data currently drops each macro’s type argument, while the neighboring props path already resolves aliases through
ScriptCompileContext; I’ll carry that resolved model type into prop generation using the same runtime-type machinery. - Assistant
The expected-output generator is present, but this environment has no
nodeexecutable. I’ll use the repository’s installed JavaScript runtime if available; otherwise I’ll derive the snapshots through the locally vendored compiler package without network access. - Assistant
The model prop generator now retains the type argument, separates modifier-key generics, resolves aliases/interfaces from the script context, and merges the inferred runtime constructor with any model options. The focused Rust test build is running now.
- Assistant
A second parity detail surfaced in the local pipeline: Vue’s transformation preserves
defineModelgenerics on the generated_useModel<T>(...)call. I’ve added that type-output preservation as well, including the two-parameter modifiers form and tuple binding metadata. - Assistant
The coverage oracle now passes all 678 fixtures, including all five new model cases. I’m doing a final diff review and running the affected crates’ full test suites to catch parser/binding regressions outside the fixture runner.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.