Summary
Perry handles String.raw\...`as a tagged-template fast path, but there does not appear to be an implementation for the callable static method formString.raw(callSite, ...substitutions)`. Node supports both forms.
This matters for libraries that call String.raw as a normal function with an array-like { raw } object rather than using template literal syntax.
Node behavior
Local Node v25.9.0 probe:
"aXb"
"aXbYc"
"aXb"
""
""
TypeError:Cannot convert undefined or null to object
TypeError:Cannot convert undefined or null to object
Probe shape:
String.raw({ raw: ["a", "b"] }, "X")
String.raw({ raw: ["a", "b", "c"] }, "X", "Y")
String.raw({ raw: { 0: "a", 1: "b", length: 2 } }, "X")
String.raw({ raw: [] }, "X")
String.raw({ raw: { length: 0 } }, "X")
String.raw({ raw: null }, "X")
String.raw(null, "X")
String.raw reads callSite.raw as an array-like object, interleaves substitutions between raw segments, returns "" for zero raw segments, and throws TypeError for nullish callSite / raw.
Perry evidence
crates/perry-hir/src/lower/lower_expr.rs special-cases tagged template literals whose tag is exactly String.raw, directly concatenating SWC raw quasi text and interpolated expressions.
test-files/test_gap_string_methods.ts covers String.raw\...`` tagged template usage, including interpolation and an empty tagged template.
crates/perry-hir/src/analysis/builtins.rs and crates/perry-hir/src/lower/array_fold.rs list String.raw as a known String static, but source search found no Expr::StringRaw, js_string_raw, runtime helper, or module_static lowering branch for ordinary String.raw(...) calls.
crates/perry-hir/src/lower/expr_call/module_static.rs has explicit static branches for String.fromCharCode and String.fromCodePoint, but no corresponding branch for String.raw.
Duplicate check
Searched issues and PRs for:
String.raw callSite
String.raw
- PR search for
String.raw
No focused tracker showed up.
Expected fix shape
- Add callable
String.raw(callSite, ...substitutions) support using Node/ECMAScript array-like raw semantics.
- Preserve the existing tagged-template fast path where it is semantically equivalent.
- Throw
TypeError for nullish call sites or nullish callSite.raw.
- Add regression coverage for direct-call arrays, array-like raw objects, extra/missing substitutions, zero-length raw, and nullish error cases.
Summary
Perry handles
String.raw\...`as a tagged-template fast path, but there does not appear to be an implementation for the callable static method formString.raw(callSite, ...substitutions)`. Node supports both forms.This matters for libraries that call
String.rawas a normal function with an array-like{ raw }object rather than using template literal syntax.Node behavior
Local Node v25.9.0 probe:
Probe shape:
String.rawreadscallSite.rawas an array-like object, interleaves substitutions between raw segments, returns""for zero raw segments, and throwsTypeErrorfor nullishcallSite/raw.Perry evidence
crates/perry-hir/src/lower/lower_expr.rsspecial-cases tagged template literals whose tag is exactlyString.raw, directly concatenating SWC raw quasi text and interpolated expressions.test-files/test_gap_string_methods.tscoversString.raw\...`` tagged template usage, including interpolation and an empty tagged template.crates/perry-hir/src/analysis/builtins.rsandcrates/perry-hir/src/lower/array_fold.rslistString.rawas a known String static, but source search found noExpr::StringRaw,js_string_raw, runtime helper, ormodule_staticlowering branch for ordinaryString.raw(...)calls.crates/perry-hir/src/lower/expr_call/module_static.rshas explicit static branches forString.fromCharCodeandString.fromCodePoint, but no corresponding branch forString.raw.Duplicate check
Searched issues and PRs for:
String.raw callSiteString.rawString.rawNo focused tracker showed up.
Expected fix shape
String.raw(callSite, ...substitutions)support using Node/ECMAScript array-likerawsemantics.TypeErrorfor nullish call sites or nullishcallSite.raw.