René's URL Explorer Experiment


Title: Native API createSourceFile panics for numeric literals whose normalized text is longer than the source · Issue #65451 · microsoft/TypeScript · GitHub

Open Graph Title: Native API createSourceFile panics for numeric literals whose normalized text is longer than the source · Issue #65451 · microsoft/TypeScript

X Title: Native API createSourceFile panics for numeric literals whose normalized text is longer than the source · Issue #65451 · microsoft/TypeScript

Description: 🔎 Search Terms stringtable, createSourceFile panic, slice bounds, numeric literal encoder 🕗 Version & Regression Information Reproduces with typescript@7.1.0-beta and typescript@7.1.0-dev.20261111.1 on Linux x64, using Node.js 24.20.0. A...

Open Graph Description: 🔎 Search Terms stringtable, createSourceFile panic, slice bounds, numeric literal encoder 🕗 Version & Regression Information Reproduces with typescript@7.1.0-beta and typescript@7.1.0-dev.20261111....

X Description: 🔎 Search Terms stringtable, createSourceFile panic, slice bounds, numeric literal encoder 🕗 Version & Regression Information Reproduces with typescript@7.1.0-beta and typescript@7.1.0-dev.20261...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Native API createSourceFile panics for numeric literals whose normalized text is longer than the source","articleBody":"### 🔎 Search Terms\n\n`stringtable`, `createSourceFile panic`, `slice bounds`, numeric literal encoder\n\n### 🕗 Version & Regression Information\n\nReproduces with `typescript@7.1.0-beta` and `typescript@7.1.0-dev.20261111.1` on Linux x64, using Node.js 24.20.0.\n\nAlso reproduces in an unmodified local build of current `main`, commit `ad24728023c52ef6a92a278046cdb69621048365` (`7.1.0-dev`), built with `node node_modules/hereby/bin/hereby.js build`.\n\nThe first affected version has not been identified. This concerns the native `typescript/sync` API. I reviewed the FAQ and found no entry covering this crash.\n\n### ⏯ Playground Link\n\nNot applicable: this reproduces through the native API's source-file serialization.\n\n### 💻 Code\n\nInstall an exact affected version:\n\n```sh\nnpm install typescript@7.1.0-dev.20261111.1\n```\n\nSave as `repro.cjs` and run `node repro.cjs`:\n\n```js\nconst { API } = require('typescript/sync');\nconst api = new API();\ntry {\n  api.createSourceFile('a.ts', '.1');\n} finally {\n  api.close();\n}\n```\n\n### 🙁 Actual behavior\n\nThe call throws an error containing the server panic:\n\n```text\npanic: runtime error: slice bounds out of range [-1:]\n.../internal/api/encoder.(*stringTable).add\n    .../internal/api/encoder/stringtable.go:41\n.../internal/api/encoder.recordExtendedData_NumericLiteral\n    .../internal/api/encoder/encoder.go:936\n```\n\nReplacing `.1` with `1e3` or `1e9` also panics. `1e2`, `1`, and `0` succeed. Each input was tested in a separate API instance/process.\n\n### 🙂 Expected behavior\n\nReturn a source-file syntax tree for these valid numeric expressions without a panic.\n\n### Additional information about the issue\n\nThe numeric literal's normalized text can be longer than its original spelling:\n\n| Source | Normalized text | Result |\n| --- | --- | --- |\n| `.1` | `0.1` | Panic, slice start -1 |\n| `1e3` | `1000` | Panic, slice start -1 |\n| `1e9` | `1000000000` | Panic, slice start -7 |\n| `1e2` | `100` | Success |\n| `1` | `1` | Success |\n| `0` | `0` | Success |\n\n`recordExtendedData_NumericLiteral` passes the normalized text and original positions to `stringTable.add`. The latter computes `start := end - len(text)` and slices `fileText[start:end]` before checking whether the slice matches the text. In these examples `start` is negative, so the existing fallback for text that cannot be reused from the source is never reached.\n\nSource inspected at commit `ad24728023c52ef6a92a278046cdb69621048365`:\nhttps://github.com/microsoft/TypeScript/blob/ad24728023c52ef6a92a278046cdb69621048365/tsc/internal/api/encoder/stringtable.go#L26-L52\n","author":{"url":"https://github.com/AkisArou","@type":"Person","name":"AkisArou"},"datePublished":"2026-11-12T08:10:01Z","url":"https://github.com/microsoft/TypeScript/issues/65451"}

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:a7831c6d-a6ee-da02-4f40-dd432c31fca3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE88C:229B2E:179E879:1F20BB1:6B0135DC
html-safe-nonce8df3675d55ffba69f03b5da816ed3cadf3c9d4d60d6e687828bfb0bca743986e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODhDOjIyOUIyRToxNzlFODc5OjFGMjBCQjE6NkIwMTM1REMiLCJ2aXNpdG9yX2lkIjoiMjk3NDQzMDkxMDU5NTgwNjY4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac423b2f9580ceba6bee3140ffca4967b1245636c20b97cc3566fa6d61a296318e
hovercard-subject-tagissue:6345646237
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/65451/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2b2b517731c7a97561b1bf882d404427835f4c08c454f5c56edf5cc488f0843a/microsoft/TypeScript/issues/65451
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2b2b517731c7a97561b1bf882d404427835f4c08c454f5c56edf5cc488f0843a/microsoft/TypeScript/issues/65451
og:image:alt🔎 Search Terms stringtable, createSourceFile panic, slice bounds, numeric literal encoder 🕗 Version & Regression Information Reproduces with typescript@7.1.0-beta and typescript@7.1.0-dev.20261111....
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameAkisArou
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/65451#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F65451
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%2F65451
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/65451
Reloadhttps://github.com/microsoft/TypeScript/issues/65451
Reloadhttps://github.com/microsoft/TypeScript/issues/65451
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/65451
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/65451
#65482https://github.com/microsoft/TypeScript/pull/65482
Native API createSourceFile panics for numeric literals whose normalized text is longer than the sourcehttps://github.com/microsoft/TypeScript/issues/65451#top
#65482https://github.com/microsoft/TypeScript/pull/65482
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/AkisArou
Adam Karafyllidis (AkisArou)https://github.com/AkisArou
on Nov 12, 2026https://github.com/microsoft/TypeScript/issues/65451#issue-6345646237
TypeScript/tsc/internal/api/encoder/stringtable.gohttps://github.com/microsoft/TypeScript/blob/ad24728023c52ef6a92a278046cdb69621048365/tsc/internal/api/encoder/stringtable.go#L26-L52
ad24728https://github.com/microsoft/TypeScript/commit/ad24728023c52ef6a92a278046cdb69621048365
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/65451#event-36429107570
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Backloghttps://github.com/microsoft/TypeScript/milestone/29
on Nov 17, 2026https://github.com/microsoft/TypeScript/issues/65451#event-36429121280
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/65451
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/65451
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.