Files
scriptc/tests/diagnostics/delete-fences.ts
T
2026-07-22 18:08:04 -05:00

9 lines
419 B
TypeScript

// Delete fences: a HYBRID index-signature shape (declared fields + overflow)
// cannot delete — overflow keys are runtime state against declared struct
// slots (pure Record<string, T> shapes and declared OPTIONAL fields delete;
// tsc itself rejects deleting required fields).
type Hybrid = { base: string; [k: string]: string };
const h: Hybrid = { base: "b", extra: "e" };
delete h["extra"];
console.log(h.base);