`all()` should be generic based on given model #459
TonySpegel opened this issue · comments
Hi there, I was following the examples here and wondering about the types I get in return when using
await Flight.all();
youd would get Model[]
in return as defined in all()
static all() {
return this.get() as Promise<Model[]>;
}
but wouldn't it be better to return Flight[]
here or Model<Flight>[]
? (not sure about the semantics here).
Similar when selecting a field:
const flightDestinations = await Flight.select('destination').all();
Not sure about this one but selecting a specific field should alter the return type to be something partial of Flight
here as you only select one field and not all.
Hope this is specific enough and understandable what I'd like to achieve here :D
After further testing:
everything should be more generic, create
only accepts Values
but no Interfaces, would be cool to be able to use your own Interfaces instead