Skip to content

Instantly share code, notes, and snippets.

@YBogomolov
YBogomolov / session.ts
Last active November 26, 2022 16:45
Session types for TypeScript
// Inspired by https://github.com/Munksgaard/session-types
interface Chan<Env, Protocol> {
env_and_protocol: [Env, Protocol];
}
class Eps implements HasDual {
readonly tag: 'Eps' = 'Eps';
readonly dual!: Eps;
}