TypeScript Version: 2.9.1
Search Terms:
object spread getter
Code
constA={a: 1};constX={ ...A,getx(){returnthis.a}};constY={a: A.a,getx(){returnthis.a}};console.log(X.x,Y.x)Expected behavior:
1 1
Actual behavior:
undefined 1
The proposal says that get x() should not be called (section Getters on the Object Initializer).
Executing the code in Chrome (66) console produces the expected behavior.
Playground Link:
link
TypeScript Version: 2.9.1
Search Terms:
object spread getter
Code
Expected behavior:
1 1
Actual behavior:
undefined 1
The proposal says that
get x()should not be called (section Getters on the Object Initializer).Executing the code in Chrome (66) console produces the expected behavior.
Playground Link:
link