File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 1+ import z from 'zod' ;
12import type { Pdu , PduType } from './v3-11' ;
23
34export declare const __brand : unique symbol ;
45
56export type Brand < B > = { [ __brand ] : B } ;
67export type Branded < T , B > = T & Brand < B > ;
78
8- export type EventID = Branded < string , 'EventID' > ;
9-
109export type StateKey = string ;
1110
11+ export const eventIdSchema = z . string ( ) . brand ( 'EventID' ) ;
12+
13+ export type EventID = z . infer < typeof eventIdSchema > ;
14+
1215export type StateMapKey = `${PduType } :${StateKey } `;
1316
1417export type State = Map < StateMapKey , EventID > ;
Original file line number Diff line number Diff line change 11import { z } from 'zod' ;
2- import { EventID , PduForType } from './_common' ;
3-
4- export const eventIdSchema = z . string ( ) . transform ( ( val ) => val as EventID ) ;
2+ import { PduForType , eventIdSchema } from './_common' ;
53
64// Copied from: https://github.com/element-hq/synapse/blob/2277df2a1eb685f85040ef98fa21d41aa4cdd389/synapse/api/constants.py#L103-L141
75
@@ -536,8 +534,7 @@ export const PduNoContentTimelineEventSchema = {
536534 . array ( eventIdSchema )
537535 . describe (
538536 'A list of event IDs that are required in the room state before this event can be applied. The server will not send this event if it is not satisfied.' ,
539- )
540- . transform ( ( val ) => val as EventID [ ] ) ,
537+ ) ,
541538 depth : z
542539 . number ( )
543540 . describe (
You can’t perform that action at this time.
0 commit comments