In the NextJs Docs for GetStaticProps it is written as a function declaration. If I try to make this typed, like this:
export async function getStaticProps(): GetStaticProps {
const db = await openDB();
const faq = await db.all('SELECT * FROM FAQ ORDER BY createDate DESC');
return {props: {faq}};
}
It won't work, with the compiler telling me
TS1055: Type 'GetStaticProps' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
If I, on the other hand, use an arrow-function expression, which should be equivalent, it does work though:
export const getStaticProps: GetStaticProps = async () => {
const db = await openDB();
const faq = await db.all('SELECT * FROM FAQ ORDER BY createDate DESC');
return {props: {faq}};
}
So, am I missing something obvious? Or am I forced to use the arrow-function syntax?