question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript NextPageContext augmentation

See original GitHub issue

Hi everyone,

I am wondering if there is a reason why next-redux-wrapper declares its own NextJSPageContext and NextJSAppContext instead of merging the context props store and isServer into the NextPageContext interface?

Background: I am having problems setting up my _app component with TypeScript because the App class from “next/app” can only be extended when getInitialProps takes an AppContext as its parameter. Augmenting NextPageContext would be a nice solution in my opinion. Also, store and isServer would be available on every NextPage’s getInitialProps context without any extra configuration.

If this approach is welcome I would be happy to create a PR! In this case, I would augment NextPageContext and deprecate NextJSPageContext and NextJSAppContext.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
kirill-konshincommented, Feb 11, 2020

https://github.com/kirill-konshin/next-redux-wrapper/pull/176 code is in master now, it will be released after I do some more testing. Hopefully this week.

3reactions
kirill-konshincommented, Dec 5, 2019

Pull request is welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

extending nextJS default types with typescript - Stack Overflow
for module augmentation, you'll want to extend the default type of useRouter() and absorb your custom integration. Definition of useRouter
Read more >
TypeScript - NextAuth.js
Module Augmentation​. next-auth comes with certain types/interfaces that are shared across submodules. Good examples are Session and JWT .
Read more >
Next.js: restrict pages to authenticated users
Here's the implementation in TypeScript: import { NextPage, NextPageContext } from 'next'. import Router from 'next/router'.
Read more >
next-auth add data to session - You.com | The AI Search ...
How to augment Session using TypeScript? #671 - GitHub ... I've modified what the session object returns and would like to augment the...
Read more >
Tag Archives: Field Notes - Noise
NextPage(context.TODO()) if err != nil { log. ... This blog post uses an AWS CDK stack written in TypeScript and AWS Glue jobs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found