🔎 Search Terms
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?erasableSyntaxOnly=true#code/PTAEAEFMCcEMGdYCMA2kDKBPAdgF1gB4Dy2KmAXKLtAK6QBQ9AxgPbby6gIBqsKdoALygATKABU40AGYu8UNhoBbJDAlSRAbmZsOoRLgCW8AGaHI8Xv0hDR6mfthHT5+YpVrJozUA
💻 Code
const asValue = 2 ** 3 as number ** 2;
const satisfiesValue = 2 ** 3 satisfies number ** 2;
🙁 Actual behavior
Both expressions are accepted without a diagnostic.
TypeScript emits each expression with the left-hand exponentiation parenthesized:
const asValue = (2 ** 3) ** 2;
const satisfiesValue = (2 ** 3) ** 2;
Replacing only the type syntax with spaces instead produces the equivalent of:
const asValue = 2 ** (3 ** 2);
const satisfiesValue = 2 ** (3 ** 2);
The emitted expression evaluates to 64, while the blanked expression evaluates to 512.
🙂 Expected behavior
TypeScript should report an error for these expressions because erasing the type syntax without moving source positions changes the exponentiation grouping. This should apply to both as and satisfies, consistent with the conclusion of #63527.
Additional information about the issue
Exponentiation is right-associative. The two ** operators have equal precedence, but removing the intervening type syntax changes the expression from left-grouped to right-grouped.
Related:
🔎 Search Terms
as exponentiation precedencesatisfies exponentiationerasableSyntaxOnlyblank-space erasureright associativityerasableSyntaxOnlyshould error on unerasableas/satisfies#63527🕗 Version & Regression Information
typescript-goat2bd066d87f5bafd315be9f40889d0a60b9e58e0b.as/satisfiestypescript-go#4192 witherasableSyntaxOnlyenabled.erasableSyntaxOnlyshould error on unerasableas/satisfies#63527 and Design Meeting Notes, 2026-06-04 #63533.⏯ Playground Link
https://www.typescriptlang.org/play/?erasableSyntaxOnly=true#code/PTAEAEFMCcEMGdYCMA2kDKBPAdgF1gB4Dy2KmAXKLtAK6QBQ9AxgPbby6gIBqsKdoALygATKABU40AGYu8UNhoBbJDAlSRAbmZsOoRLgCW8AGaHI8Xv0hDR6mfthHT5+YpVrJozUA
💻 Code
🙁 Actual behavior
Both expressions are accepted without a diagnostic.
TypeScript emits each expression with the left-hand exponentiation parenthesized:
Replacing only the type syntax with spaces instead produces the equivalent of:
The emitted expression evaluates to
64, while the blanked expression evaluates to512.🙂 Expected behavior
TypeScript should report an error for these expressions because erasing the type syntax without moving source positions changes the exponentiation grouping. This should apply to both
asandsatisfies, consistent with the conclusion of #63527.Additional information about the issue
Exponentiation is right-associative. The two
**operators have equal precedence, but removing the intervening type syntax changes the expression from left-grouped to right-grouped.Related:
erasableSyntaxOnlyshould error on unerasableas/satisfies#63527as/satisfiestypescript-go#4192