| 1 | export interface Input { |
| 2 | name: string; |
| 3 | items: Array<{ id: number; label: string }>; |
| 4 | } |
| 5 | static const message = "Hello {world} with {braces}"; |
| 6 | static const template = ` |
| 7 | This is a template literal { |
| 8 | with nested braces |
| 9 | } and expressions ${1 + 1} |
| 10 | `; |
| 11 | static function evil() { |
| 12 | const obj = { a: "{", b: "}" }; |
| 13 | const regex = /\{.*\}/; |
| 14 | return `{${obj.a}${obj.b}}`; |
| 15 | } |
| 16 | static { |
| 17 | console.log("Block with {braces} in string"); |
| 18 | const data = { key: "value {nested}" }; |
| 19 | } |
| 20 | <h1>Evil Braces Test</h1> |
| 21 | <p>This tests that string literals with braces don’t confuse the parser.</p> |
| 22 | <p>The message is: <strong>${message}</strong></p> |