-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Type of global navigator
object incorrect since node.js 21
#60387
Comments
That would be a massive breaking change for something that's essentially a configuration error. You shouldn't be using |
If itβs a configuration error, then it affects all react frameworks I know. React projects that do server rendering execute the same code on server and client, so we have to include lib.dom. Open for suggestions. |
That would be an issue far more general than this: #53971 |
The reality is that many projects end up with both node and DOM typings loaded at the same time due to transitive dependencies. There's not really a straightforward solution that would fix this situation without breaking huge swathes of working code. |
This issue has been marked as "Working as Intended" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
π Search Terms
navigator, node
π Version & Regression Information
β― Playground Link
No response
π» Code
This is a next.js app with server-rendering.
π Actual behavior
This crashes at runtime because since node.js 21, a global
navigator
object was introduced which only contains a few keys and is not compatible with theNavigator
interface defined inlib.dom.d.ts
. See nodejs/node#50269π Expected behavior
Typescript should regard the node.js
navigator
object type and make all keys on it optional, except when accessed viawindow.navigator
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: