Rewrites const r = new SomeResponse(); r.prop = val; into a typed object
literal: const r: SomeResponse<T> = { prop: val };.
Only simple cases are transformed. A case is simple when:
the new expression has no constructor arguments,
all consecutive statements directly after the declaration are
unconditional assignments varName.prop = value, and no later statement
assigns to a property of the variable,
the class declaration resolves and has an empty or no constructor body
(syntax check only, no type inference).
After the rewrite no new expression for the variable remains, so a second
run finds no candidates.
Rewrites
const r = new SomeResponse(); r.prop = val;into a typed object literal:const r: SomeResponse<T> = { prop: val };.Only simple cases are transformed. A case is simple when:
newexpression has no constructor arguments,varName.prop = value, and no later statement assigns to a property of the variable,After the rewrite no
newexpression for the variable remains, so a second run finds no candidates.