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 locate
build_model_props_emitsand howinfo.type_argis handled today, then add fixtures and wire up type resolution to match@vue/compiler-sfc. - Assistant
Implementing type-argument resolution in
model.rs, then adding fixtures and running the coverage oracle. - Assistant
defineModeltype-argument resolution is wired throughcompileScriptso runtime props and TS_useModel<T>output match@vue/compiler-sfc.Implementation
model.rs- Introduced
ModelInfowithtype_argfrom macro extraction. - Added
build_model_prop_decl()to resolve type args via the script context and emit runtimetypeoptions (includingskipCheckfor mixed unions), merged with runtime options using TS spread orObject.assign. collect_model_infos()now carriestype_argfromMacroCall.type_args.
props.rs- Added
infer_model_runtime_type()andnormalize_model_type_arg()for model-specific type resolution (interface/alias lookup, union handling).
setup_emit.rs - Introduced
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.