From ca16499eb67950d4445d0456ae1d72428b264f02 Mon Sep 17 00:00:00 2001 From: Rob Palmer Date: Thu, 27 Nov 2025 16:26:57 +0000 Subject: [PATCH] Docs: erasableSyntaxOnly should mention type assertions type assertions are errors under this mode. https://www.typescriptlang.org/play/?alwaysStrict=false&target=99&jsx=0&erasableSyntaxOnly=true&ssl=11&ssc=18&pln=11&pc=25#code/FASwdgLgpgTgZgQwMZQAQAkEGcBiIoA2AJqgN7CqWpz7EBcqWEM4A5gNzAC+wwUAHgAcA9jAiokBbFlQBhADwAVAHyoB0MERkBBGDAQBPJapABbQQSimokGZly0S5KqkEBXAEYEQSao4CEDEwsYBy8LtYQABbCRMYAFNEgWAz2eIREADSoCAD8QcxsAJQMAG7CIE4ULpRJWAB0NBmoALw5OTLBbJw1lEjCYEyo-K2o8mBuph6wygCMPVQ8PEA --- .../tsconfig-reference/copy/en/options/erasableSyntaxOnly.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/tsconfig-reference/copy/en/options/erasableSyntaxOnly.md b/packages/tsconfig-reference/copy/en/options/erasableSyntaxOnly.md index 92f662b42dac..7f67297786fb 100644 --- a/packages/tsconfig-reference/copy/en/options/erasableSyntaxOnly.md +++ b/packages/tsconfig-reference/copy/en/options/erasableSyntaxOnly.md @@ -13,6 +13,7 @@ That means the following constructs are not supported: * `namespace`s and `module`s with runtime code * parameter properties in classes * Non-ECMAScript `import =` and `export =` assignments +* ``-style type assertions ```ts // ❌ error: An `import ... = require(...)` alias @@ -43,6 +44,9 @@ enum Direction { Left, Right, } + +// ❌ error: -style type assertion. +const num = 1; ``` Similar tools like [ts-blank-space](https://github.com/bloomberg/ts-blank-space) or [Amaro](https://github.com/nodejs/amaro) (the underlying library for type-stripping in Node.js) have the same limitations.