Open irskep opened 1 year ago
Yeah this is unfortunately true. Sadly there is no way (at the moment) to define different types on setting vs getting with proxy objects (see: https://github.com/microsoft/TypeScript/issues/43826). I'll leave this open to encourage us to look into it further as other options arise.
Let's say I make this reactive object:
And then I want to observe the value of
x.y
:I get a TypeScript error:
I recognize this example code won't work if the initial value of
x
isundefined
, but if it's present,.$on
works fine, so it would be nice if the type system reflected this.