SIGN IN SIGN UP
facebook / react UNCLAIMED

The library for web and native user interfaces.

244272 0 0 JavaScript

[compiler] validation against calling impure functions (#31960)

For now we just reject all calls of impure functions, and the validation
is off by default. Going forward we can make this more precise and only
reject impure functions called during render.

Note that I was intentionally imprecise in the return type of these
functions in order to avoid changing output of existing code. We lie to
the compiler and say that Date.now, performance.now, and Math.random
return unknown mutable objects rather than primitives. Once the
validation is complete and vetted we can switch this to be more precise.
J
Joseph Savona committed
7f3826e8e44caa6984232ab8d752d8b9441e4c99
Parent: 313c8c5
Committed by GitHub <[email protected]> on 1/17/2025, 5:04:02 PM