SAST Semgrep support for Typescript 4.9 "Satisfies" operator
Summary
Semgrep does not seem to support the Satisfies operator in Typescript 4.9.
When running a job with code that uses the operator, there are some Syntax error warnings in the job log:
1 type Colors = "red" | "green" | "blue";
2 type RGB = [red: number, green: number, blue: number];
3 const palette = {
4 red: [255, 0, 0],
5 green: "#00ff00",
6 bleu: [0, 0, 255]
7 // ~~~~ The typo is now caught!
8 } satisfies Record<Colors, string | RGB>;
9 // toUpperCase() method is still accessible!
10 const greenNormalized = palette.green.toUpperCase();
tool notification warning: Syntax error Syntax error at line index.ts:8:
`satisfies Record<Colors, string | RGB>` was unexpected
This has also been reported in the upstream repository: Cannot parse Typescript satisfies operator #7197
Edited by Christopher Mutua