Files
scriptc/tests/corpus/3101-json-callback-bytes.ts
Chris Tate b778bf6e6e feat(compiler): run IR serialization and dependency scans natively (#496)
- Compile production IR serialization and runtime dependency scans on both native backends
- Support native JSON callbacks and checked records with unknown payloads
- Verify native IR round trips and executable generation with focused sanitizer coverage
2026-09-27 15:56:58 -05:00

15 lines
591 B
TypeScript

export {};
const trace: string[] = [];
function observe(key: string, value: unknown): unknown {
trace.push(key + ":" + typeof value);
return value;
}
console.log(JSON.stringify({ bytes: new Uint8Array([3, 4]) }, observe));
console.log(trace.join("|"));
console.log(JSON.stringify({ replace: 0 }, (key: string, value: unknown): unknown => {
return key === "replace" ? new Uint8Array([5, 6]) : value;
}));
console.log(JSON.stringify(0, (key: string, value: unknown): unknown => key === "" ? new Uint8Array([7, 8]) : value));
console.log(JSON.stringify(new Uint8Array([]), observe, 2));