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 nearby type-resolution logic, then implement the fix and run the focused fixture/oracle tests.
- Assistant
The referenced path has shifted in this checkout, so I’m locating the current module and its fixture tooling before editing.
- Assistant
I’ve added a focused fixture matrix, including alias resolution and the two-parameter modifier form. Next I’m using the locally installed Vue compiler to establish the exact expected runtime output.
- Assistant
The implementation now extracts only the model value type (excluding modifier keys), reuses prop runtime inference, resolves aliases/interfaces through the script context, and merges inferred types with runtime options in Vue’s spread form. I’m compiling and exercising the SFC tests now.
- Assistant
The focused Rust test found the intended snapshot change: a locally declared interface now resolves to
Object, merged with{ required: true }. I’ll accept that expected update, then run the fixture harness to inspect all five new cases. The JavaScript generator is unavailable because this environment has no Node runtime, so I’ll validate against the repository’s Rust oracle path and record that limitation explicitly. - Assistant
The oracle isolated one additional parity issue exposed by these new TypeScript fixtures: Vue combines
useModelanddefineComponentin one helper import, while Vize emitted two lines. I’m correcting that preamble emission, then rerunning the full oracle. - Assistant
All five new cases now pass, and the full coverage oracle is back to 678/678. I’m doing the final crate-wide test pass and checking the diff for accidental artifacts.
- Assistant
The crate-wide pass surfaced two existing snapshots whose old output encoded this missing behavior: one typed model prop and one now-combined Vue helper import. Both diffs are exactly the intended changes, so I’m updating those snapshots and rerunning the suite.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.