Title: Panic during declaration emit with stripInternal on parenthesized or wrapped internal type · Issue #65623 · microsoft/TypeScript · GitHub
Open Graph Title: Panic during declaration emit with stripInternal on parenthesized or wrapped internal type · Issue #65623 · microsoft/TypeScript
X Title: Panic during declaration emit with stripInternal on parenthesized or wrapped internal type · Issue #65623 · microsoft/TypeScript
Description: 🔎 Search Terms stripInternal, parenthesized type, panic, nil pointer dereference, declaration emit, ParenthesizedType 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries ab...
Open Graph Description: 🔎 Search Terms stripInternal, parenthesized type, panic, nil pointer dereference, declaration emit, ParenthesizedType 🕗 Version & Regression Information This is the behavior in every version I trie...
X Description: 🔎 Search Terms stripInternal, parenthesized type, panic, nil pointer dereference, declaration emit, ParenthesizedType 🕗 Version & Regression Information This is the behavior in every version I ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/65623
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Panic during declaration emit with stripInternal on parenthesized or wrapped internal type","articleBody":"### 🔎 Search Terms\n\nstripInternal, parenthesized type, panic, nil pointer dereference, declaration emit, ParenthesizedType\n\n### 🕗 Version & Regression Information\n\n- This is the behavior in every version I tried, and I reviewed the FAQ for entries about stripInternal\n- Tested on TypeScript main (Version 7.1.0-dev)\n\n### ⏯ Playground Link\n\n_No response_\n\n### 💻 Code\n\n```ts\ninterface Foo {}\n\n// Case 1: Type alias with parenthesized internal type\nexport type T = (\n /** @internal */\n Foo\n);\n\n// Case 2: Variable type annotation with parenthesized internal type\nexport const x: (\n /** @internal */\n Foo\n) = {} as any;\n\n// Case 3: Type operator and array wrapping parenthesized internal type\nexport type T2 = readonly (\n /** @internal */\n Foo\n)[];\n```\n\n### 🙁 Actual behavior\n\nRunning `tsc -d --stripInternal` crashes the compiler with a runtime panic (`nil pointer dereference`):\n\npanic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=...]\n\ngoroutine ... [running]: github.com/microsoft/TypeScript/tsc/internal/ast.GetTypeNodePrecedence(...) tsc/internal/ast/precedence.go:656 github.com/microsoft/TypeScript/tsc/internal/printer.(*Printer).emitTypeNode(...) tsc/internal/printer/printer.go:2298 github.com/microsoft/TypeScript/tsc/internal/printer.(*Printer).emitParenthesizedType(...) tsc/internal/printer/printer.go:2114 github.com/microsoft/TypeScript/tsc/internal/printer.(*Printer).emitTypeAliasDeclaration(...) tsc/internal/printer/printer.go:3809\n\n**Cause:**\nWhen `--stripInternal` elides an `@internal` type wrapped in a parenthesized type, `VisitEachChild` calls `UpdateParenthesizedTypeNode(input, nil)`, constructing a node with an inner `nil` pointer. The printer attempts to inspect `node.Type.Kind` for operator precedence and dereferences `nil`.\n\n### 🙂 Expected behavior\n\nThe compiler should emit declarations without crashing:\n- `T` should fall back to `export type T = any;` (matching the behavior of bare `export type T = /** @internal */ Foo;`).\n- `x` should emit `export declare const x;`.\n- `T2` should fall back to `export type T2 = any;`.\n\n### Additional information about the issue\n\n_No response_","author":{"url":"https://github.com/ShakilUrRehman21","@type":"Person","name":"ShakilUrRehman21"},"datePublished":"2026-11-21T07:34:05Z","url":"https://github.com/microsoft/TypeScript/issues/65623"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:02512c32-4f5b-89a6-10a7-8a7085036805 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8102:2FDEEB:D1A34B:10E97B7:6B06414F |
| html-safe-nonce | c126f2302533e00b7e505741c04183fda906377e641ed0d395ce78dd4f44b113 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTAyOjJGREVFQjpEMUEzNEI6MTBFOTdCNzo2QjA2NDE0RiIsInZpc2l0b3JfaWQiOiIxNzU4NDkxNDE2NzM0MzUxNjk1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8c763db188adedcec26f0f0a02d17ea68d78d9f692af95e65b11cf3e983509f5 |
| hovercard-subject-tag | issue:6526070662 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/65623/issue_layout |
| twitter:image | https://opengraph.githubassets.com/01bf5bbbefa5a1dca0fc56acee39df22d33553b753e82944fe9fa5512b2126c8/microsoft/TypeScript/issues/65623 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/01bf5bbbefa5a1dca0fc56acee39df22d33553b753e82944fe9fa5512b2126c8/microsoft/TypeScript/issues/65623 |
| og:image:alt | 🔎 Search Terms stripInternal, parenthesized type, panic, nil pointer dereference, declaration emit, ParenthesizedType 🕗 Version & Regression Information This is the behavior in every version I trie... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ShakilUrRehman21 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width