You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The delete() method should have a correct return type. Actually, vscode considers it returns Model | Model[]. It should return { affectedRows: number } instead.
asyncdeleteLore(name: string): Promise<number>{constresult=awaitLore.where({ name }).delete();console.log(result);// @ts-ignore : let me compile, it worksreturnresult.affectedRows;}
Without the ts-ignore :
error: TS2339 [ERROR]: Property 'affectedRows' does not exist on type 'Model | Model[]'.
Property 'affectedRows' does not exist on type 'Model[]'.
With ts-ignore, if field exists and model name is "Lore" :
Lore { affectedRows: 0 }
By the way, other functions such as create haves the similar issue, it returns something like :
Finally, I think that other methods such as select() should not return Model type, but the model's final type.
Imagine I have a model called Lore with fields title, description. When I get the result of a select, I'd like my code editor to autocomplete fields that belongs to my model. Actually, it only returns create, delete and update function.
The text was updated successfully, but these errors were encountered:
Similar issue to #271
Using sqlite as DBMS.
The delete() method should have a correct return type. Actually, vscode considers it returns
Model | Model[]
. It should return{ affectedRows: number }
instead.Without the ts-ignore :
With ts-ignore, if field exists and model name is "Lore" :
By the way, other functions such as
create
haves the similar issue, it returns something like :While the return type in denodb's source code (see https://doc.deno.land/https://deno.land/x/[email protected]/mod.ts/~/Model) is Promise
Finally, I think that other methods such as
select()
should not return Model type, but the model's final type.Imagine I have a model called
Lore
with fieldstitle, description
. When I get the result of a select, I'd like my code editor to autocomplete fields that belongs to my model. Actually, it only returnscreate
,delete
andupdate
function.The text was updated successfully, but these errors were encountered: