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
Hello. I'm stuck on a very strange error. Need some help
CREATETABLEIF NOT EXISTS schedules (
id SERIALPRIMARY KEY,
aid INTEGERNOT NULLREFERENCES activity(id),
day SMALLINTNOT NULLCHECK (day BETWEEN 1AND7),
timeTEXT[] NOT NULL,
price INTEGER[] NOT NULL
);
constschedule=[{"id": 3422799,"day": 2,"time": [["10:00","12:00"]],"price": [2500]},{"id": 3422801,"day": 4,"time": [["11:00","13:00"]],"price": [3500]}],constvalues=schedule.map(({ id, day, time, price })=>sql([id,day,sql.array(time),sql.array(price,23)]).first);awaitsql` UPDATE schedules SET day = (update_data.day)::int, time = update_data.time, price = update_data.price FROM ( VALUES ${sql(values)} // <----------------------- error ) AS update_data (id, day, time, price) WHERE schedules.id = (update_data.id)::int`;
Nooverloadmatchesthiscall.Overload1of2,'(first: [number, number, ArrayParameter<string[][]>, ArrayParameter<number[]>][] & readonly EscapableArray[]): Helper<[number, number, ArrayParameter<...>, ArrayParameter<...>][], []>',gavethefollowingerror.Argumentoftype'[number, number, ArrayParameter<string[][]>, ArrayParameter<number[]>][]'isnotassignabletoparameteroftype'[number, number, ArrayParameter<string[][]>, ArrayParameter<number[]>][] & readonly EscapableArray[]'.Type'[number, number, ArrayParameter<string[][]>, ArrayParameter<number[]>][]'isnotassignabletotype'readonly EscapableArray[]'.Type'[number, number, ArrayParameter<string[][]>, ArrayParameter<number[]>]'isnotassignabletotype'EscapableArray'.Type'number | ArrayParameter<string[][]> | ArrayParameter<number[]>'isnotassignabletotype'string | number'.Type 'ArrayParameter<string[][]>' is not assignable to type 'string| number'. Overload 2 of 2, '(template: TemplateStringsArray, ...parameters: readonlyParameterOrFragment<number>[]): PendingQuery<Row[]>', gave the following error. Argument of type '[number,number,ArrayParameter<string[][]>,ArrayParameter<number[]>][]' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type '[number,number,ArrayParameter<string[][]>,ArrayParameter<number[]>][]' but required in type 'TemplateStringsArray'.ts(2769)lib.es5.d.ts(622, 14): 'raw' is declared here.
I tries many variants but cant find way how to make it whithout ts error. With such code in update correctly. There is no postgres errors.
Do u have any ideas how i can improve code to remove ts error ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello. I'm stuck on a very strange error. Need some help
I tries many variants but cant find way how to make it whithout ts error. With such code in update correctly. There is no postgres errors.
Do u have any ideas how i can improve code to remove ts error ?
Beta Was this translation helpful? Give feedback.
All reactions