bwgjoseph / mongoose-vs-ottoman

feature comparison between mongoose and ottoman
0 stars 1 forks source link

removeById types #71

Closed bwgjoseph closed 3 years ago

bwgjoseph commented 3 years ago

Hi,

Seem like the https://github.com/couchbaselabs/node-ottoman/pull/449 did not update removeById type

The current one is removeById(id: string): Promise<any>;

Should it be removeById<Result = R>(id: string): Promise<Result>;? Not sure if it would work

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

interface IModel<T = any, R = any>

So this would work

removeById<Result = R>(id: string): Promise<Result>;

image

alpha.28

AV25242 commented 3 years ago

Issue created https://github.com/couchbaselabs/node-ottoman/issues/470

gsi-alejandro commented 3 years ago

In the next release alpha.29 we will update the result types of removeById to look like: removeById(id: string): Promise<{ cas: any }>;

This method always will return an object with a cas property {cas: any}, we don't add generics due to the return always will this one and there isn't the way to change it.

httpJunkie commented 3 years ago

Fixed w/ alpha 29

bwgjoseph commented 3 years ago

Understand that @gsi-alejandro, thanks!