Surfaced by the new feature-matrix probe test-files/test_feat_optional_chaining.ts (added under #801).
Repro
interface User { greet?: (who: string) => string }
const sparse: User = { id: 2 } as User;
console.log("sparse.greet?.('bob'):", sparse.greet?.("bob"));
Expected (Node)
sparse.greet?.('bob'): undefined
Actual (Perry v0.5.914)
TypeError: greet is not a function
at <anonymous>
The optional-call form obj.fn?.(...) must short-circuit to undefined when obj.fn is null/undefined — it must not invoke the call at all. Perry is currently evaluating the call site regardless of the ?. short-circuit.
Property-access optional chain works
The plain ?.email/?.phone?.work forms in the same test pass — only the optional-CALL form is broken.
Impact
This blocks ~all real-world TS code that uses optional method invocation (event-handler patterns, optional callbacks).
Part of #793 (axis 1 — TypeScript language). Surfaced by the #801 feature matrix.
Surfaced by the new feature-matrix probe
test-files/test_feat_optional_chaining.ts(added under #801).Repro
Expected (Node)
Actual (Perry v0.5.914)
The optional-call form
obj.fn?.(...)must short-circuit toundefinedwhenobj.fnisnull/undefined— it must not invoke the call at all. Perry is currently evaluating the call site regardless of the?.short-circuit.Property-access optional chain works
The plain
?.email/?.phone?.workforms in the same test pass — only the optional-CALL form is broken.Impact
This blocks ~all real-world TS code that uses optional method invocation (event-handler patterns, optional callbacks).
Part of #793 (axis 1 — TypeScript language). Surfaced by the #801 feature matrix.