Skip to content

Instantly share code, notes, and snippets.

@paradite
Created March 31, 2025 09:51
Show Gist options
  • Save paradite/ae2e33a711195853db33923762176089 to your computer and use it in GitHub Desktop.
Save paradite/ae2e33a711195853db33923762176089 to your computer and use it in GitHub Desktop.
doesn't work bro
type State = 'initialized' | 'processing' | 'completed' | 'failed';
interface Pipeline<T extends State> {
state: T;
start(this: Pipeline<'initialized'>): Pipeline<'processing'>;
finish(this: Pipeline<'processing'>): Pipeline<'completed'>;
retry(this: Pipeline<'failed'>): Pipeline<'processing'>;
}
declare const p: Pipeline<'initialized'>;
p.start();
p.finish();
// p.retry();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment