Replies: 2 comments
-
hey is this related to this project? if not i might recommend opening this on the Next.js repository, though i have a feeling you may be able to find answers somewhere from an existing question |
Beta Was this translation helpful? Give feedback.
-
This is not related to this project and a general question of TypeScript. In TypeScript, spreading operations can sometimes be tricky due to the strong type constraints that the language imposes. The spread operator is used to spread elements of an iterable (like arrays or strings) into places where multiple elements are expected. This is convenient but poses the issue, that the compiler can't be sure that the amount of parameters and types you spread are correct. A tuple type would fix the length of parameters that are passed, a rest parameter would collect arguments into an array. You need to import the types and set them. So you basically avoid using spread operator.
|
Beta Was this translation helpful? Give feedback.
-
I'm trying to convert a whole project to typescript. I successfully converted quite a lot of files but have a problem with file _document in pages/posts.
on
const documentProps = await super.getInitialProps(...args);
I'm getting "A spread argument must either have a tuple type or be passed to a rest parameter."Does anyone have an idea how to fix it
Beta Was this translation helpful? Give feedback.
All reactions