Open bwgjoseph opened 3 years ago
Hi,
As mentioned in #71, (maybe it was overlooked) but I'm wondering if this is better? Is there any cons to using <T = any, R = T> vs <T = any, R = any>?
<T = any, R = T>
<T = any, R = any>
I suppose if changing the declaration to something like this would be much better
interface IModel<T = any, R = T>
By default, R takes T which will be any if the type is not defined which is essentially the same as
R
T
any
interface IModel<T = any, R = any>
So this would also be changed to something like
// from replaceById<Doc = T, Result = R>(id: string, data: Doc | Document<Doc>, options?: MutationFunctionOptions): Promise<Result>; // to replaceById<Doc = T, Result = Doc>(id: string, data: Doc | Document<Doc>, options?: MutationFunctionOptions): Promise<Result>;
So if it was declared individually T = any, R = any or Doc = T, Result = R
T = any, R = any
Doc = T, Result = R
then it would be like this where return type doesn't get auto inferred from T and default to any
But if I were to change, then T and R is basically the same if R is not defined
Thanks
Hi,
As mentioned in #71, (maybe it was overlooked) but I'm wondering if this is better? Is there any cons to using
<T = any, R = T>
vs<T = any, R = any>
?I suppose if changing the declaration to something like this would be much better
By default,
R
takesT
which will beany
if the type is not defined which is essentially the same asSo this would also be changed to something like
So if it was declared individually
T = any, R = any
orDoc = T, Result = R
then it would be like this where return type doesn't get auto inferred from
T
and default toany
But if I were to change, then T and R is basically the same if R is not defined
Thanks