arktypeio / arktype

TypeScript's 1:1 validator, optimized from editor to runtime
https://arktype.io/
MIT License
3.93k stars 59 forks source link

type snapshot doesn't escape string interpolation #1077

Closed holic closed 3 months ago

holic commented 3 months ago

Report a bug

🔎 Search Terms

type snap

🧩 Context

🧑‍💻 Repro

const props = {} as { hex: `0x${string}`, complex: "object", toGetFormatter: ["to print this", "on multiple lines"], soWeGetAString: "surrounded by backticks", };

// This will output the props type as a multi-line string (i.e. with backticks) and the type of `hex` will not be properly escaped,
// leading to syntax errors in following test runs.
attest(props).type.toString.snap();
ssalbdivad commented 3 months ago

Fixed in 0.11.0🎉