I have hesitated to ask this. Been using the library for a while and its super helpful. I am just trying to figure out how I can extend something to a custom class to have the types available during development..
Simple example using fictitious service that returns daily stock prices:
export class MyStocks extends <How do I extend the return type here!> {
someCalculatedField: number;
constructor(data: <how do I get the type here!>){
Object.assign(this,data);
this.someCalculatedField = this.price * 50; // this.price's type should be 'number'
}
}
TypeFromSelector?
FromSelector?
The closest i can get is something like. data.map(d=>TypeFromSelector('stocks')(d))
and then d.symbol's type is a string.
Thanks for help and sorry for creating an issue that is more about docs.
I have hesitated to ask this. Been using the library for a while and its super helpful. I am just trying to figure out how I can extend something to a custom class to have the types available during development..
Simple example using fictitious service that returns daily stock prices:
My selector:
How can I create a class that extends the typeof this selector?
I have created Selectors using
const selectorForStock = Selector('stocks')({symbol: true, price: true, date: true})
I would like to use in another class like
TypeFromSelector? FromSelector?
The closest i can get is something like. data.map(d=>TypeFromSelector('stocks')(d)) and then d.symbol's type is a string.
Thanks for help and sorry for creating an issue that is more about docs.