Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

TypeScript · 33 lines · 1.0 KiB · at 503e839

import { Ok, match, type Result } from "@tsus/v2";type State = "open" | "closed" | "merged";export const badge = (s: State): string => {  let text = "";  switch (s) { // expect TSUS501    case "open":      text = "Open";      break;    case "closed":      text = "Closed";      break;  }  return text;};type Event = { readonly kind: "push"; readonly ref: string } | { readonly kind: "tag"; readonly name: string };export const summary = (e: Event): string => match(e, "kind", { push: (p) => p.ref }); // expect TSUS501const save = async (id: string): Promise<void> => void id;const send = (to: string): Result<true, "bounced"> => (to === "" ? { ok: false, error: "bounced" } : Ok(true));export const handle = (id: string): string => {  save(id); // expect TSUS504  send("ops@example.com"); // expect TSUS505  void save(id);  return id;};export const newestFirst = (xs: number[]): number[] => xs.sort((a, b) => b - a); // expect TSUS510export const rename = (u: { name: string }, name: string): void => {  u.name = name; // expect TSUS510};