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 type resolution infrastructure and how props type args are resolved:
- Assistant
Let me look at the test infrastructure — the coverage oracle and generate-expected script:
- Assistant
Network is available. Let me install Node.js so I can run the oracle:
- Assistant
Oracle toolchain reproduces the checked-in snap byte-for-byte. Now let me add the new fixture cases:
- Assistant
Now let me look at the preamble to fix the import-line merging:
- Assistant
Now I have the full picture. Let me check Vue's import-line format for the TS + mergeModels combination before implementing:
- Assistant
Now guard
to_analysis_summaryagainst pattern binding names: - Assistant
Now make the shared type-string helpers accessible in
compile_script/props.rs: - Assistant
Now update the rest of
build_model_props_emits(the emits loop) andcollect_model_infos: - Assistant
Now update
setup_emit.rsandbody.rs: - Assistant
Now the preamble import merge:
- Assistant
All 678 fixtures pass, including the 5 new typed
defineModelcases. Let me verify the actual output visually: - Assistant
Output matches
@vue/compiler-sfc. Now run the crate test suites to check for regressions: - Assistant
All three snapshot changes are intentional parity improvements. Accept them:
- Assistant
The
vize_cartonfailure is pre-existing on the base commit (environment-related, unrelated to this change). Now clippy + fmt: - Assistant
Clean. Let me add focused unit tests for the inference in
model.rs: - Assistant
Done. type-argument resolution is now complete in , verified against 3.6.0-beta.10 (the version pinned in the workspace catalog).
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.