New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TS] DocumentFiles
is not exported from _document.tsx
#17413
Comments
Typescript is able to infer the correct type without specifying, due to extending the base class. More details as vercel/next-plugins#238 (comment) |
@jsiddiqui Definitely but I get red-squiggly lines in VSCode so I have to use |
One of these should work to strongly type it: getCssLinks: Head['getCssLinks'] = ({ allFiles }) => { OR getCssLinks({ allFiles }: Parameters<Head['getCssLinks']>[0]) { I am not against a one-line export, but I don't see this likely because this whole method is an undocumented hack as you can see from previous comments on the linked issue. This means that we have to manually verify if it works even with every patch release. Adding this one-line export means that the maintainers need to document any change to it in release notes and consider it when evaluating breaking changes. I'd rather make a case for intrinsic support of inline CSS, e.g. by showing that loading in parallel to JS (multiplexed on http/2), slows down the first contentful paint; rather than asking the maintainers to export an internal type and maintain it. |
The first one worked fine: getCssLinks: Head['getCssLinks'] = ({ allFiles }) => {
...
} Personally, I don't see much issue in adding it so I'll still keep this one open to see what others think :) |
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. |
Feature request
Is your feature request related to a problem? Please describe.
I'm trying to use
DocumentFiles
like: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#L47Describe alternatives you've considered
I use
any
like so:Additional context
I've written about it here → vercel/next-plugins#238 (comment)
The text was updated successfully, but these errors were encountered: