René's URL Explorer Experiment


Title: Native API: formatDiagnosticsWithColorAndContext drops related information without a file location · Issue #65087 · microsoft/TypeScript · GitHub

Open Graph Title: Native API: formatDiagnosticsWithColorAndContext drops related information without a file location · Issue #65087 · microsoft/TypeScript

X Title: Native API: formatDiagnosticsWithColorAndContext drops related information without a file location · Issue #65087 · microsoft/TypeScript

Description: 🔎 Search Terms formatDiagnosticsWithColorAndContext, relatedInformation, fileless diagnostic, missing related diagnostic text, diagnosticFormatter 🕗 Version & Regression Information Reproduced against main at 6161772 using Node.js v24.14...

Open Graph Description: 🔎 Search Terms formatDiagnosticsWithColorAndContext, relatedInformation, fileless diagnostic, missing related diagnostic text, diagnosticFormatter 🕗 Version & Regression Information Reproduced agai...

X Description: 🔎 Search Terms formatDiagnosticsWithColorAndContext, relatedInformation, fileless diagnostic, missing related diagnostic text, diagnosticFormatter 🕗 Version & Regression Information Reproduced ...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/65087

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Native API: formatDiagnosticsWithColorAndContext drops related information without a file location","articleBody":"### 🔎 Search Terms\n\nformatDiagnosticsWithColorAndContext, relatedInformation, fileless diagnostic, missing related diagnostic text, diagnosticFormatter\n\n### 🕗 Version & Regression Information\n\nReproduced against `main` at 6161772c1370bdd4a82f808e6823bd755eb1870d using Node.js v24.14.0. The same conditional is still present on current `main`.\n\nThe TypeScript 6.0.3 implementation outputs related diagnostic text outside the `if (file)` branch; the native API implementation only outputs it inside the location branch.\n\n### ⏯ Playground Link\n\nNot applicable: this exercises the diagnostic formatting API.\n\n### 💻 Code\n\nSave as `repro.mts` at the repository root and run `node repro.mts` with Node.js 24. This calls the formatter directly with a diagnostic containing a related message without a file location.\n\n```ts\nimport { formatDiagnosticsWithColorAndContext } from \"./packages/typescript/src/api/diagnosticFormatter.ts\";\n\nconst host = {\n    getCurrentDirectory: () => \"/project\",\n    getCanonicalFileName: (name: string) => name,\n    getNewLine: () => \"\\n\",\n};\n\nconst output = formatDiagnosticsWithColorAndContext([{\n    category: 1,\n    code: 2322,\n    pos: 0,\n    end: 0,\n    text: \"Primary error.\",\n    relatedInformation: [{\n        category: 3,\n        code: 9999,\n        pos: 0,\n        end: 0,\n        text: \"This related explanation must remain visible.\",\n    }],\n}], host);\n\nconsole.log(JSON.stringify(output.replace(/\\x1b\\[[0-9;]*m/g, \"\")));\n```\n\n### 🙁 Actual behavior\n\nThe related explanation disappears:\n\n```text\n\"error TS2322: Primary error.\\n\"\n```\n\nAdding `fileName: \"/project/a.ts\"` and `startPosition: { line: 0, character: 0 }` to the related diagnostic makes its text appear.\n\n### 🙂 Expected behavior\n\nThe related explanation should be included even when it has no file location. Only the location heading and source context depend on a location.\n\n### Additional information about the issue\n\nIn [diagnosticFormatter.ts](https://github.com/microsoft/TypeScript/blob/6161772c1370bdd4a82f808e6823bd755eb1870d/packages/typescript/src/api/diagnosticFormatter.ts#L191-L201), the call to `flattenDiagnosticMessage(related, ...)` is inside `if (related.fileName && related.startPosition)`. This also drops message chains on locationless related diagnostics.\n\nThe diagnostic response type permits omitted file names and positions. In the [6.0.3 formatter](https://github.com/microsoft/TypeScript/blob/v6.0.3/src/compiler/program.ts#L786-L795), related message text is emitted independently of the file check.\n\nThe reproduction uses constructed diagnostic objects to isolate the formatter behavior. Existing formatter tests cover related information with a location.\n\nI would be happy to submit a focused fix and regression tests once this is triaged.\n","author":{"url":"https://github.com/emerardd","@type":"Person","name":"emerardd"},"datePublished":"2026-11-01T10:41:47Z","url":"https://github.com/microsoft/TypeScript/issues/65087"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:564397ae-ba08-c248-0f84-a928bbe07682
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9770:CC1A4:16CEE44:1CFF5BB:6B013693
html-safe-nonce2f3de5c467a6f19efe2348f0e7fb8bdce86592f00becb58737e6b96a50915a92
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzcwOkNDMUE0OjE2Q0VFNDQ6MUNGRjVCQjo2QjAxMzY5MyIsInZpc2l0b3JfaWQiOiI2ODY3NjMxMjMzMjYyNzYxNjE5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac9d93fb89e74a19a9114a3a406bc0bd7b0dcd9725fbf65b5ba564ce59357d9de4
hovercard-subject-tagissue:6145950652
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/65087/issue_layout
twitter:imagehttps://opengraph.githubassets.com/72860da278735c63d7f183d8da79a7b861f26937c7697940f7aa1a5615e8b87d/microsoft/TypeScript/issues/65087
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/72860da278735c63d7f183d8da79a7b861f26937c7697940f7aa1a5615e8b87d/microsoft/TypeScript/issues/65087
og:image:alt🔎 Search Terms formatDiagnosticsWithColorAndContext, relatedInformation, fileless diagnostic, missing related diagnostic text, diagnosticFormatter 🕗 Version & Regression Information Reproduced agai...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameemerardd
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/65087#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F65087
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F65087
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/65087
Reloadhttps://github.com/microsoft/TypeScript/issues/65087
Reloadhttps://github.com/microsoft/TypeScript/issues/65087
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests310 (310)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/65087
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/65087
#65592https://github.com/microsoft/TypeScript/pull/65592
Native API: formatDiagnosticsWithColorAndContext drops related information without a file locationhttps://github.com/microsoft/TypeScript/issues/65087#top
#65592https://github.com/microsoft/TypeScript/pull/65592
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Domain: APIRelates to the public API for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20API%22
Backloghttps://github.com/microsoft/TypeScript/milestone/29
https://github.com/emerardd
emerarddhttps://github.com/emerardd
on Nov 1, 2026https://github.com/microsoft/TypeScript/issues/65087#issue-6145950652
6161772https://github.com/microsoft/TypeScript/commit/6161772c1370bdd4a82f808e6823bd755eb1870d
diagnosticFormatter.tshttps://github.com/microsoft/TypeScript/blob/6161772c1370bdd4a82f808e6823bd755eb1870d/packages/typescript/src/api/diagnosticFormatter.ts#L191-L201
6.0.3 formatterhttps://github.com/microsoft/TypeScript/blob/v6.0.3/src/compiler/program.ts#L786-L795
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Domain: APIRelates to the public API for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20API%22
on Nov 17, 2026https://github.com/microsoft/TypeScript/issues/65087#event-36427362418
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Backloghttps://github.com/microsoft/TypeScript/milestone/29
on Nov 17, 2026https://github.com/microsoft/TypeScript/issues/65087#event-36427377011
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/65087
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/65087
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Domain: APIRelates to the public API for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20API%22
BacklogNo due datehttps://github.com/microsoft/TypeScript/milestone/29
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.