Transform ID:Documentation Index
Fetch the complete documentation index at: https://docs.refactron.dev/llms.txt
Use this file to discover all available pages before exploring further.
vue_set_delete_to_assignment
Language: TypeScript
What it does
Rewrites Vue 2 reactivity helpers to plain JavaScript:Vue.set(obj, key, value)→obj[key] = value(orobj.key = valuefor ident-shaped string keys)Vue.delete(obj, key)→delete obj[key](ordelete obj.key)this.$set(obj, key, value)→obj[key] = valuethis.$delete(obj, key)→delete obj[key]
class, interface, for, …) is rendered as dot notation. Anything else (spaces, digit-first, reserved words, numeric literals, identifier expressions, computed keys) uses bracket notation. Transform at src/transform/transforms/typescript/vue-set-delete.ts.
Detector pattern
The detector atsrc/analyze/detectors/typescript/vue-set-delete.ts matches CallExpression whose callee is Vue.set / Vue.delete (identifier + property access) or this.$set / this.$delete (this-expression + property access).
Preconditions
vue_sfc_not_supported— refuses any.vueSingle-File-Component file. SFC support requires a dedicated parser and is deferred to v0.4..js/.tsfiles only.wrong_arity— refuses when the call doesn’t have the expected argument count (3 forset, 2 fordelete).delete_in_expression_context— refusesVue.delete(...)(andthis.$delete(...)) anywhere its return value is consumed.Vue.deletereturnsundefined; the nativedeleteoperator returns a boolean — silently switching values would change semantics.Vue.setis safe in expression position becauseobj.k = vevaluates tov, which is whatVue.setalready returns; the rewritten form is paren-wrapped for precedence.
Before / after
class, interface, …) preserve bracket notation:
Edge cases NOT handled (skip via precondition)
.vueSingle-File-Component files —vue_sfc_not_supported; v0.4 follow-up.Vue.delete(...)used in expression position (const r = Vue.delete(obj, k), function-call args, binary operands) —delete_in_expression_context; return-value semantics differ.- Wrong arity (
Vue.set(a, b),Vue.delete(a)) —wrong_arity.
Vue 2 reactivity caveat (ships in the suggestion text, not as a precondition): Vue 2’s
Object.defineProperty-based reactivity requires Vue.set to add NEW reactive keys; direct assignment is not reactive for new keys on a Vue 2 instance. Vue 3 (Proxy-based) makes direct assignment reactive, so the rewrite is semantically equivalent. v0.2.3 assumes Vue 3 — on Vue 2 codebases, exclude this transform via --exclude vue_set_delete_to_assignment or your .refactronrc.json. A vueMajorVersion config key is a v0.4 follow-up.