Conversation
|
I tried this here imranbarbhuiya@caccd03#diff-359eed88eef8047dde41894dee7f556365015932d5dfcdb994e5c13db9c2c1fb but there were some deep typing issues in test so I stopped, but it has most of the schemas, u can probably use some from there |
| }); | ||
|
|
||
| const dataUIPartSchema = z.object({ | ||
| type: z.string().startsWith('data-'), |
There was a problem hiding this comment.
since u r using zod v4, u can use
| type: z.string().startsWith('data-'), | |
| type: z.templateLiteral([z.literal('data-'), z.string()]), |
There was a problem hiding this comment.
and make it less readable when it is not needed? why would i do that?
There was a problem hiding this comment.
it gives proper type like the interface currently has data-${string} instead of just string, other then than yeah current one is better readable
There was a problem hiding this comment.
here we wont push everything into zod because the dynamic union types are too complex, so it doesnt matter, hence the simpler version
Background
Validating UI messages is often necessary, e.g. when they are loaded from the DB or received through REST requests.
Summary
Add
validateUIMessagesfunction.Example
Manual Verification
Tasks
Related Issues
Fixes #6763