[TS] `DocumentFiles` is not exported from `_document.tsx`
See original GitHub issueFeature request
Is your feature request related to a problem? Please describe.
I’m trying to use DocumentFiles
like:
getCssLinks({ allFiles }: DocumentFiles) {
const { assetPrefix } = this.context
if (!allFiles || allFiles.length === 0) return null
return allFiles
.filter((file: any) => /\.css$/.test(file))
.map((file: any) => (
<style
key={file}
nonce={this.props.nonce}
data-href={`${assetPrefix}/_next/${file}`}
dangerouslySetInnerHTML={{
__html: fs.readFileSync(path.join(process.cwd(), '.next', file), 'utf-8'),
}}
/>
))
}
Describe the solution you’d like
Just have to export DocumentFiles
from https://github.com/vercel/next.js/blob/canary/packages/next/pages/_document.tsx#L47
Describe alternatives you’ve considered
I use any
like so:
getCssLinks({ allFiles }: { allFiles: any }) {
...
}
Additional context
I’ve written about it here → https://github.com/vercel/next-plugins/issues/238#issuecomment-699890100
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to properly type the _document.tsx file from Next.js?
This is what I've ended up doing to type the getInitialProps and render methods: import React, { ReactElement } from "react"; ...
Read more >Advanced Features: Custom `Document` - Next.js
A custom Document can update the <html> and <body> tags used to render a Page. This file is only rendered on the server,...
Read more >Next.js: packages/next/pages/_document.tsx - Fossies
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TSX (TypeScript with React) source...
Read more >react-apollo-loader - npm
A webpack loader to make those who use [React Apollo](https://github.com/apollographql/react-apollo#readme) and [GraphQL Code ...
Read more >Tsx file
But now I'm getting an Error that it does not recognize import App from ". ... IntelliJ IDEA recognizes .ts and .tsx files...
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
DocumentFiles is not a public property. Overriding built-in components is not recommended and is likely to break between upgrading Next.js versions.
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.