eslint-config-next@12.0.5 gives "Type '() => any' is not a constructor function type" error in _Document.tsx
See original GitHub issueWhat version of Next.js are you using?
12.0.5
What version of Node.js are you using?
14.18.0
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
After upgrading to both next@12.0.5
and eslint-config-next@12.0.5
, my _Document.tsx
now throws an eslint error Type '() => any' is not a constructor function type
. I have typescript@^4.5.2
installed.
_Doucment.tsx
import Document, { Head, Html, Main, NextScript } from 'next/document'
class MyDocument extends Document {
render() {
return (
<Html lang="en-US" className="h-full bg-gray-100">
<Head />
<body className="loading h-full">
<Main />
<NextScript />
</body>
</Html>
)
}
}
export default MyDocument
.eslintrc.json
{
"extends": ["next/core-web-vitals", "prettier"],
"rules": {
"react/no-unescaped-entities": "off"
}
}
Expected Behavior
This was not breaking on 12.0.4 and should not break on 12.0.5
To Reproduce
Create a Next.js project with the example code I provided above.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:18
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Typescript Error: Type 'any' is not a constructor function type
I made a mistake when importing the abstract class. I wrote: import { RESTService } from 'restService';. But had to: import { RESTService...
Read more >TypeScript errors and how to fix them
error TS1055: Type ' AxiosPromise ' is not a valid async function return type in ES5/ES3 because it does not refer to a...
Read more >Explain 'Not a constructor function' error in JavaScript?
The not a constructor function error occurs if we use an object or a variable as a constructor that isn't a constructor.
Read more >"Type 'HealthOriginal' is not a constructor function type." when ...
I'm following these instructions on how to mock native-plugins. Trying this leads to the error in the title. I am using Ionic 5....
Read more >TS2605 JSX element type 'Button' is not a constructor function ...
I recently have been playing around with JSX and everything works fine; but trying to convert to TypeScript (TSX) I run into issues....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I respect and appreciate the awesome work of the Next js team, so I am perplexed how this got through testing for release.
For now replace
with
document.d.ts has been broken
12.0.5
12.0.4
Published 12.0.6: https://github.com/vercel/next.js/releases/tag/v12.0.6
It’ll take a bit for it to be available on npm 🙏