@ttsc/wasm 0.19.2 → 0.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ttsc.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/wasm",
3
- "version": "0.19.2",
3
+ "version": "0.19.3",
4
4
  "description": "Build in-browser ttsc playgrounds. Compose ttsc + typescript-go with your own plugins via the Go host helper.",
5
5
  "main": "lib/src/index.js",
6
6
  "types": "lib/src/index.d.ts",
@@ -49,6 +49,19 @@ func Checker_getRegularTypeOfLiteralType(recv *innerchecker.Checker, t *innerche
49
49
  return checkerGetRegularTypeOfLiteralType(recv, t)
50
50
  }
51
51
 
52
+ // ValueToString renders a literal type's value in TypeScript source form: a
53
+ // string as a double-quoted, escaped literal, a number, boolean, or bigint as
54
+ // the way it is written. It is the checker's own renderer, so a consumer
55
+ // enumerating a literal union reports the values the way the compiler prints
56
+ // them, including numeric formatting and string escaping it should not re-derive.
57
+ //
58
+ // It panics on a value it does not handle — notably the nil a computed enum
59
+ // member carries — so a caller holding a `LiteralType.Value()` must reject nil
60
+ // before calling this.
61
+ func ValueToString(value any) string {
62
+ return innerchecker.ValueToString(value)
63
+ }
64
+
52
65
  // Checker_typeToStringFullyQualified formats a type with the same stable,
53
66
  // alias-aware flags TypeScript uses in diagnostics that name union members.
54
67
  // Keeping the flag bundle inside the shim avoids leaking checker-internal enum