Skip to content

Commit 2b633f9

Browse files
authored
docs(hooks/use-outlet-context): update typings (#10661)
* Update use-outlet-context.md In previous version when you change type of a user in `useState` or just pass wrong data in the context you wouldn't get a typescript error. In other words only context consumer uses `ContextType` but not producer, which is wrong bcs as I said when you change type of data in the producer(without changing ContexrType) => the consumer would still assume the old data is passed. This commit adds better typescript support, so that when you change data passed into context you will get ts error of the data does not satisfy ContextType and will be forced to update related stuff * Update contributors.yml
1 parent 7178a48 commit 2b633f9

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,4 @@
222222
- yionr
223223
- yuleicul
224224
- zheng-chuang
225+
- valerii15298

docs/hooks/use-outlet-context.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default function Dashboard() {
4949
return (
5050
<div>
5151
<h1>Dashboard</h1>
52-
<Outlet context={{ user }} />
52+
<Outlet context={{ user } satisfies ContextType} />
5353
</div>
5454
);
5555
}

0 commit comments

Comments
 (0)