GabenGar

Results 97 comments of GabenGar

Any progress on this? Got hit by this error too while trying to migrate the project to ESM. Worst part there is no stack trace either. EDIT: I guess a...

You have to use `GetServerSideProps`/`GetStaticProps` interface instead and pass the `Props` interface of your page component to its first generic for the props to be picked up by `Infer`. You...

Let's say you have `interface PageProps { user: unknown }` declared somewhere on the component file. Then you write `GetServerSideProps` as the type for your `getServerSideProps()` function.

I have a [page which uses it](https://github.com/GabenGar/next-js-site/blob/master/src/pages/frontend-mentor/rest-countries/all.tsx). The lines of interest are [30](https://github.com/GabenGar/next-js-site/blob/7b5da32d1b0adae85c72159e5653378f3f91344d/src/pages/frontend-mentor/rest-countries/all.tsx#L30) and [128](https://github.com/GabenGar/next-js-site/blob/7b5da32d1b0adae85c72159e5653378f3f91344d/src/pages/frontend-mentor/rest-countries/all.tsx#L128).

> aren't we returning an object with everything inside a props object? Why does including that in the interface not work? I'm confused about that. Because the generic for `GetServerSideProps`...

> Can we use middlewares to make sure a user is logged in and then serve the dynamic content server-side? No, but you can boot out the users without a...

It's not the issue with javascript, but with the typescript types. I kind of fixed it (and it builds and runs just fine) by declaring the context type like this:...

This could be solved by having a clear separation between public pages/endpoints and protected ones.

Just protect `dev` and `master` branches from pushes by anyone but you. Also "tone" is a bit too vague, pretty sure `type` is more fitting.

Yes and no. In a proper setup there shouldn't be `webapp` in production, but in development it is required for dev QoL to work.