TypeScript Compiler Options

stripInternal — TypeScript compiler option

Omits declarations marked @internal from declaration output, not from emitted JavaScript. The compiler does not guarantee that the resulting declarations remain valid if public signatures reference removed declarations. Verify the emitted declarations in a consumer project; do not use this as a runtime access-control mechanism. Default: false. Create the named files in a clean local project. Run tsc -p tsconfig.json. Expected output files: dist/example.js, dist/example.d.ts. Run node dist/example.js; expected stdout: '5'. Tested using TypeScript 5.8.3 and Node.js 22.16.0; local project instructions, not a single-file editor.

Formal Syntax & Structure

typescript syntaxtypescript
{  "compilerOptions": {    "stripInternal": true  }}

Parameters & Attributes

NameTypeDescription
stripInternalbooleanSet in compilerOptions; default: false.

Working Example

Example Snippettypescript
// File: tsconfig.json (omit this label){  "compilerOptions": {    "target": "ES2022",    "module": "CommonJS",    "strict": true,    "types": [],    "noEmitOnError": true,    "outDir": "dist",    "declaration": true,    "stripInternal": true  },  "files": [    "example.ts"  ]}// File: example.ts/** @internal */export const internalCount = 2;export const publicCount = 3;console.log(internalCount + publicCount);
TypeScript Reference