Closed mamlzy closed 10 months ago
You have to manually type ctx
, because we don't know if it's being used with getServerSideProps
or getStaticProps
:
export const getServerSideProps = getLocaleProps(async (ctx: GetServerSidePropsContext) => {
return {
props: {},
};
});
You have to manually type
ctx
, because we don't know if it's being used withgetServerSideProps
orgetStaticProps
:export const getServerSideProps = getLocaleProps(async (ctx: GetServerSidePropsContext) => { return { props: {}, }; });
okay that code is working fine, but @QuiiBz can you give me an example to fix this type error, it's happen when i'm using satisfies GetServerSideProps<Props>
. i just want to follow the nextjs docs example.
Works fine on my side, the id
you're returning is a number
instead of a string
as specified in HomeProps
:
export const getServerSideProps = getLocaleProps(async (ctx: GetServerSidePropsContext) => {
return {
props: {
id: '1',
},
};
}) satisfies GetServerSideProps<HomeProps>;
Works fine on my side, the
id
you're returning is anumber
instead of astring
as specified inHomeProps
:export const getServerSideProps = getLocaleProps(async (ctx: GetServerSidePropsContext) => { return { props: { id: '1', }, }; }) satisfies GetServerSideProps<HomeProps>;
oh sorry i didn't see that, thank you for your response😁
Describe the bug
getLocaleProps
does not give the proper types. Am i doing something wrong here?About (please complete the following information):