You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix types for loaderData and actionData that contained `Record`s
6
+
7
+
UNSTABLE(BREAKING):
8
+
9
+
`unstable_SerializesTo` added a way to register custom serialization types in Single Fetch for other library and framework authors like Apollo.
10
+
It was implemented with branded type whose branded property that was made optional so that casting arbitrary values was easy:
11
+
12
+
```ts
13
+
// without the brand being marked as optional
14
+
let x1 =42asunknownasunstable_SerializesTo<number>;
15
+
// ^^^^^^^^^^
16
+
17
+
// with the brand being marked as optional
18
+
let x2 =42asunstable_SerializesTo<number>;
19
+
```
20
+
21
+
However, this broke type inference in `loaderData` and `actionData` for any `Record` types as those would now (incorrectly) match `unstable_SerializesTo`.
22
+
This affected all users, not just those that depended on `unstable_SerializesTo`.
23
+
To fix this, the branded property of `unstable_SerializesTo` is marked as required instead of optional.
24
+
25
+
For library and framework authors using `unstable_SerializesTo`, you may need to add `as unknown` casts before casting to `unstable_SerializesTo`.
0 commit comments