Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

Text · 28 lines · 931 B · at dc221d2

import { Some, None, type Option } from "@tsus/runtime";// This file exists to break the match preprocessor.// The word match appears in comments: match (x) { fake => arm }/* and in block comments too: match (y) { Some(z) => z } */const decoy1 = "this string contains match (a) { Some(b) => b } and braces }{";const decoy2 = `template with match ( and a fake ${"arm => }"} inside`;const tricky: Option<string> = Some("{ => , }");const result = match (tricky) {  Some(s) => `payload is ${s} with ${decoy1.length + decoy2.length > 0 ? "decoys" : "nothing"}`,  None => "empty",};console.log(result);// String.prototype.match must NOT be treated as a macro.const found = "abc123".match(/\d+/);console.log(found ? found[0] : "none");// A match expression nested inside a template literal expression.const inline = `status: ${match (tricky) {  Some(s) => "has value",  None => "empty",}}`;console.log(inline);