Allow renaming URL path parameters from the Params tab (#528)

This commit is contained in:
Gregory Schier
2026-08-12 10:17:02 -07:00
committed by GitHub
parent 67a628d67a
commit a6be9dbaee
7 changed files with 458 additions and 64 deletions
@@ -1,9 +1,10 @@
import { generateId } from "../../lib/generateId";
import type { Pair, PairWithId } from "./PairEditor";
export function ensurePairId(p: Pair): PairWithId {
// NOTE: Generic so callers keep whatever they passed in (eg. an EditablePair stays editable)
export function ensurePairId<T extends Pair>(p: T): T & PairWithId {
if (typeof p.id === "string") {
return p as PairWithId;
return p as T & PairWithId;
}
return { ...p, id: p.id ?? generateId() };
}