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
Now let me look at the test runner to understand how SFC fixtures are compiled:
- Assistant
Let me look at existing TS cases in the script-setup expected snapshot to see the exact shape Vue produces for
lang="ts": - Assistant
Let me look at the preamble to see how imports are emitted for TS + defineModel:
- Assistant
Now I have the full picture. Let me check existing unit tests around defineModel in the SFC crate:
- Assistant
Now I'll implement. First, the runtime-type inference in
compile_script/props.rs: - Assistant
Now I'll add the model type inference functions to
props.rs: - Assistant
Now update
model.rswith theModelInfostruct and type-aware prop generation: - Assistant
Now update
collect_model_infos: - Assistant
Now update
body.rsandsetup_emit.rs: - Assistant
Builds. Now let me make
dump_patchesaccept a fixture argument so I can inspect actual outputs: - Assistant
Now add the new fixture cases to
define-model.toml: - Assistant
Now run the coverage oracle:
- Assistant
All 676 tests pass, including the 3 new cases. Let me check whether budget bumps are customary here:
- Assistant
Now run the full test suite for the SFC crate and the workspace checks:
- Assistant
Let me inspect these three tests to verify the new snapshots are correct:
- Assistant
All downstream crates pass. Let me add focused unit tests for the new resolver:
- Assistant
All green. Final review of the complete diff:
- Assistant
Done.
defineModel<T>()type arguments are now resolved into both the runtime props and the TS output, matching .
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.