Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

Text · 22 lines · 688 B · at eb4a6ea

// Calls through a parameter: the per-file binder cannot see what api.beat() or// store.save() returns, so TSUS411 and TSUS412 need the project's types.import { Ok, type Result } from "@tsus/runtime";type Api = { readonly beat: () => Promise<number> };type Store = { readonly save: (row: string) => Result<true, "full"> };export const tick = (api: Api): number => {  void api.beat();  api.beat();  return 1;};export const persist = (store: Store, row: string): string => {  store.save(row);  return "saved";};export const fine = async (api: Api, store: Store): Promise<Result<true, "full">> => {  await api.beat();  return store.save("r1").andThen(() => Ok(true));};