R
Size: a a a
R
СД
S
R
МВ
B
МВ
B
МВ
🦜
И
๖
๖
bS
И
T
EA
page ниже может быть string[]? И если может, как обойти ошибку типизации у parseInt()? О page пишетArgument of type 'string | string[]' is not assignable to parameter of type 'string'.Пока проверяю через
Type 'string[]' is not assignable to type 'string'.
typeof page === "string".export const getServerSideProps: GetServerSideProps = async ({ query: { page = "1" } }) => {
// calculate start page
if (typeof page === "string") {
const start = parseInt(page, 10);
}
const res = await fetch(`${API_URL}/events?_sort=date:ASC&_limit=${PER_PAGE}`);
const events = await res.json();
return {
props: { events }
}
};๖
EA
parseInt(["1"], 10);
// 1