Version 9.0.2 typings error.
See original GitHub issueBug report
Describe the bug
In version 9.0.2 we get an error, connected with typings. It appears when we try to create a Next Server.
To Reproduce
In version 8, we could import like import * as next from 'next'
and it worked correctly both on JavaScript and TypeScript sides. So we got no errors connected with typings and javascript compiler. But now, we have to import via import next from 'next'
. There is no doubt it works correctly in TypeScript’s mind, but when we try to run an application, we get an error:
TypeError: next_1.default is not a function
In addition, I got an error, connected with props of component exported from _app. I just create a class ThemedApp extends App<SomeProps>
and get an error while trying to get something from this.props
.
Expected behavior
next
import have to be saved in current state, but error doesn’t occur. So, it is good we can import a bit more natively via import next from 'next'
, but this error makes some problems.
Screenshots
System information
- OS: Ubuntu 18
- Version of Next.js: 9.0.2
Additional context
No information.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (6 by maintainers)
Top GitHub Comments
Okay, I got problem solved. I just followed custom-server-typescript and used
tsconfig.json
andtsconfig.server.json
options. There are no problems now.Leaving a migration from 8 to 9 version case: v8 state: https://github.com/wolframdeus/ssr-server-template/tree/815eee98210a7ee1313dad4e267976406a0390b2 v9 migration commit: https://github.com/wolframdeus/ssr-server-template/commit/c8b100d928c2e22e3731be0b5fc4e3bb2158caf3
@yceffort Please use a different tsconfig for the server, you can see how by following the custom-server-typescript example.