import type { ConnectionId } from './connection_id.ts'; import type { Identity } from './identity.ts'; import type { Prettify } from './type_util.ts'; import type { TimeDuration } from './time_duration.ts'; import type { Timestamp } from './timestamp.ts'; import type { Uuid } from './uuid.ts'; declare const brand: unique symbol; /** * A branded primitive: an intersection of a primitive with a marker object. * `Prettify` must leave it alone — mapping it produces a structural record of * `String`'s members that no longer satisfies `string`. */ type UserId = string & { readonly [brand]: 'UserId' }; declare const userId: Prettify; // eslint-disable-next-line @typescript-eslint/no-unused-vars const _brandedIsStillAString: string = userId; // eslint-disable-next-line @typescript-eslint/no-unused-vars const _brandedKeepsItsBrand: UserId = userId; // Plain primitives round-trip unchanged. declare const str: Prettify; // eslint-disable-next-line @typescript-eslint/no-unused-vars const _str: string = str; declare const num: Prettify; // eslint-disable-next-line @typescript-eslint/no-unused-vars const _num: number = num; declare const big: Prettify; // eslint-disable-next-line @typescript-eslint/no-unused-vars const _big: bigint = big; // Every SATS wrapper class is passed through as the class, not as a // structural record of its members. declare const identity: Prettify; // eslint-disable-next-line @typescript-eslint/no-unused-vars const _identity: Identity = identity; declare const connectionId: Prettify; // eslint-disable-next-line @typescript-eslint/no-unused-vars const _connectionId: ConnectionId = connectionId; declare const timestamp: Prettify; // eslint-disable-next-line @typescript-eslint/no-unused-vars const _timestamp: Timestamp = timestamp; declare const timeDuration: Prettify; // eslint-disable-next-line @typescript-eslint/no-unused-vars const _timeDuration: TimeDuration = timeDuration; declare const uuid: Prettify; // eslint-disable-next-line @typescript-eslint/no-unused-vars const _uuid: Uuid = uuid; // Object types are still flattened. type Intersected = { a: string } & { b: number }; declare const flattened: Prettify; // eslint-disable-next-line @typescript-eslint/no-unused-vars const _flattened: { a: string; b: number } = flattened; // A generic row stays spreadable, as reducer args are in `sdk-test-ts`. // eslint-disable-next-line @typescript-eslint/no-unused-vars function _spreadGenericRow>( row: Prettify<{ [K in keyof Row]: Row[K] }> ) { return { ...row }; }