Open Hyperionza opened 4 years ago
cc @Starcounter-Jack
I suspect this is not a complete runnable example (for example there is an uncompilable comma at jsonpatch,observe(this.obj.myList); // *1
.
It also appears that the type signature of this.obj.mylist
is a UserGroup
or an array of the same.
@Starcounter-Jack
I suspect this is not a complete runnable example (for example there is an uncompilable comma at
jsonpatch,observe(this.obj.myList); // *1
.It also appears that the type signature of
this.obj.mylist
is aUserGroup
or an array of the same.
Fixed your issue with the typo in the example - sorry, I tried to quickly write a simple example rather than paste my actual code base, which I cant for obvious reasons. Do you want a stack blitz or something?
Updated the workaround paragraph to match the example classes.
I'm using FJP 3.0.0-1 on TypeScript 3.9 with Angular 9
I've got a strongly types set of UDTs analogous to:
Note 1: in the current setup, this line throws a compile time exception: Type 'Observer' is not assignable to type 'Observer<ChildClass[]>'
Note 2: if I change
observer
toObserver<ChildClass>
, then this line throws a compile time exception.I can work around the compile time exceptions by using
Observer<any>
orObserver<ChildClass | Array<ChildClass>>
, but that does defeat the purpose of strongly typed code.