dillon1000/react

Commit

Define types for useState/useRef

Defines 4 new types: 

* Return type of `useState()`, which has properties "0" and "1" to allow us to 
infer the types when destructuring 

* Type of useState() set state function 

* Return type of `useRef()` so we know what is a ref 

* Type of ref.current, so we know what is a ref *value* 

Example: 

<img width="1670" alt="Screenshot 2023-05-24 at 9 59 37 AM" 
src="https://github.com/facebook/react-forget/assets/6425824/3ee7d04a-fda3-4b7b-89b7-d205d9a6fd0d">
Browse files
Changed paths2 files
First-parent comparison
M compiler/forget/src/HIR/Globals.ts ModifiedM compiler/forget/src/HIR/ObjectShape.ts Modified
Patch

Files changed

Rendering syntax-highlighted changes…