René's URL Explorer Experiment


Title: Array.isArray type narrows to any[] for ReadonlyArray · Issue #17002 · microsoft/TypeScript · GitHub

Open Graph Title: Array.isArray type narrows to any[] for ReadonlyArray · Issue #17002 · microsoft/TypeScript

X Title: Array.isArray type narrows to any[] for ReadonlyArray · Issue #17002 · microsoft/TypeScript

Description: TypeScript Version: 2.4.1 Code declare interface T { foo: string; } const immutable: T | ReadonlyArray = []; if (Array.isArray(immutable)) { const x = immutable; // Any[] - Should be ReadonlyArray } const mutable: T | Array = []...

Open Graph Description: TypeScript Version: 2.4.1 Code declare interface T { foo: string; } const immutable: T | ReadonlyArray = []; if (Array.isArray(immutable)) { const x = immutable; // Any[] - Should be ReadonlyArr...

X Description: TypeScript Version: 2.4.1 Code declare interface T { foo: string; } const immutable: T | ReadonlyArray<T> = []; if (Array.isArray(immutable)) { const x = immutable; // Any[] - Should be Reado...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Array.isArray type narrows to any[] for ReadonlyArray\u003cT>","articleBody":"\u003c!-- BUGS: Please use this template. -->\r\n\u003c!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n\u003c!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\n**TypeScript Version:**  2.4.1\r\n\r\n**Code**\r\n\r\n```ts\r\ndeclare interface T {\r\n  foo: string;\r\n}\r\n\r\nconst immutable: T | ReadonlyArray\u003cT> = [];\r\n\r\nif (Array.isArray(immutable)) {\r\n  const x = immutable; // Any[]  - Should be ReadonlyArray\u003cT>\r\n} \r\n\r\nconst mutable: T | Array\u003cT> = [];\r\n\r\nif (Array.isArray(mutable)) {\r\n  const x = mutable; // T[]\r\n} \r\n```\r\n\r\n**Expected behavior:** Should type narrow to ```ReadonlyArray\u003cT>```, or at the very least ```T[]```.\r\n\r\n**Actual behavior:** Narrows to ```any[]```.  Doesn't trigger warnings in noImplicitAny mode either.\r\n","author":{"url":"https://github.com/jinder","@type":"Person","name":"jinder"},"datePublished":"2017-07-07T10:42:08Z","url":"https://github.com/microsoft/TypeScript/issues/17002"}

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:3753483f-e77a-e54d-a8db-09f541e453c5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8018:A99C2:2F2A08A:3BFB5E5:6B01ADBD
html-safe-noncef4749ff4670132d6526f505ae060510a7ee6748ef609e56e2069dd9d526f867d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDE4OkE5OUMyOjJGMkEwOEE6M0JGQjVFNTo2QjAxQURCRCIsInZpc2l0b3JfaWQiOiIxNjU1NzI1NTM0MDE3NDc4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac3c6157326875f4bfc8745ef45509492584de3db22e86288ffa0869dfd02fe67b
hovercard-subject-tagissue:241226715
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/17002/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c0c21f339859307845b350cf6abb51caa7b1969d9acecea8621f20c8fcc37210/microsoft/TypeScript/issues/17002
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c0c21f339859307845b350cf6abb51caa7b1969d9acecea8621f20c8fcc37210/microsoft/TypeScript/issues/17002
og:image:altTypeScript Version: 2.4.1 Code declare interface T { foo: string; } const immutable: T | ReadonlyArray = []; if (Array.isArray(immutable)) { const x = immutable; // Any[] - Should be ReadonlyArr...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejinder
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/17002#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F17002
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%2F17002
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/17002
Reloadhttps://github.com/microsoft/TypeScript/issues/17002
Reloadhttps://github.com/microsoft/TypeScript/issues/17002
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests312 (312)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/17002
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/17002
#39258https://github.com/microsoft/TypeScript/pull/39258
#48228https://github.com/microsoft/TypeScript/pull/48228
Array.isArray type narrows to any[] for ReadonlyArrayhttps://github.com/microsoft/TypeScript/issues/17002#top
#39258https://github.com/microsoft/TypeScript/pull/39258
#48228https://github.com/microsoft/TypeScript/pull/48228
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20lib.d.ts%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/jinder
Jinder Sidhu (jinder)https://github.com/jinder
on Jul 7, 2017https://github.com/microsoft/TypeScript/issues/17002#issue-241226715
Nexthttps://github.com/microsoft/TypeScript/issues/17002?timeline_page=1
https://github.com/jcalz
Joe Calzaretta (jcalz)https://github.com/jcalz
on Jul 7, 2017https://github.com/microsoft/TypeScript/issues/17002#issuecomment-313719111
https://github.com/jinder
Jinder Sidhu (jinder)https://github.com/jinder
on Jul 7, 2017https://github.com/microsoft/TypeScript/issues/17002#issuecomment-313720745
Joe Calzaretta (@jcalz)https://github.com/jcalz
https://github.com/vidartf
Vidar Tonaas Fauske (vidartf)https://github.com/vidartf
on Jul 10, 2017https://github.com/microsoft/TypeScript/issues/17002#issuecomment-314092180
https://github.com/jcalz
Joe Calzaretta (jcalz)https://github.com/jcalz
on Jul 10, 2017https://github.com/microsoft/TypeScript/issues/17002#issuecomment-314108464
https://github.com/jinder
Jinder Sidhu (jinder)https://github.com/jinder
on Jul 10, 2017https://github.com/microsoft/TypeScript/issues/17002#issuecomment-314119579
Vidar Tonaas Fauske (@vidartf)https://github.com/vidartf
https://github.com/vidartf
Vidar Tonaas Fauske (vidartf)https://github.com/vidartf
on Jul 10, 2017https://github.com/microsoft/TypeScript/issues/17002#issuecomment-314124522
Jinder Sidhu (@jinder)https://github.com/jinder
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20lib.d.ts%22
on Aug 22, 2017https://github.com/microsoft/TypeScript/issues/17002#event-1216780118
https://github.com/NN---
NN (NN---)https://github.com/NN---
on Sep 20, 2017https://github.com/microsoft/TypeScript/issues/17002#issuecomment-330791031
https://github.com/adrianheine
Adrian Heine né Lang (adrianheine)https://github.com/adrianheine
on Sep 17, 2018https://github.com/microsoft/TypeScript/issues/17002#issuecomment-422104686
https://github.com/jinder
Jinder Sidhu (jinder)https://github.com/jinder
on Sep 18, 2018https://github.com/microsoft/TypeScript/issues/17002#issuecomment-422457242
Adrian Heine né Lang (@adrianheine)https://github.com/adrianheine
https://github.com/adrianheine
Adrian Heine né Lang (adrianheine)https://github.com/adrianheine
on Sep 18, 2018https://github.com/microsoft/TypeScript/issues/17002#issuecomment-422460655
https://github.com/bluelovers
bluelovers (bluelovers)https://github.com/bluelovers
on May 17, 2019https://github.com/microsoft/TypeScript/issues/17002#issuecomment-493400187
https://github.com/paulmiu
Paul Miu (paulmiu)https://github.com/paulmiu
on May 22, 2019https://github.com/microsoft/TypeScript/issues/17002#issuecomment-494937708
Aleksey Lagashkin (@aleksey-l)https://github.com/aleksey-l
on stackoverflowhttps://stackoverflow.com/a/56249765/2524925
https://github.com/jonlepage
jon lepage (jonlepage)https://github.com/jonlepage
on Apr 6, 2025https://github.com/microsoft/TypeScript/issues/17002#issuecomment-2781717755
playgroundhttps://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgIJSnAngYQPYgDOYUArgmHlMgN4BQyjyIEA7sgBRwbYAyEIAOZgAFgH4AXM1IBbAEbQAlFLggsAbQC6AbgZMW7ADwAVAHxceWfkNFSQshVGXJjW3U2ZtkJ8wDp-wJAyhFKums5h7kwWmFYCwuJ2Dkoqam56jD4xfPG20vIpLukeWf6+gRDBoVoRxUzAhOixFoKpWM7cgsgNyKoaOhnIUBBwACYEADZYyAAOUHiUYFgzEG3pAL50dKCQsIgoTdj4RCTklFAAEogA1rSDBpzcsdYJkvmOHWkDHg9ZTzk2ERJApOarffReUoBIIhIrhMFRRjZOKAt72EGffqI7xmZEvPLoj4IwZQ8owsG1cGMBqHLAtNodKBdHrDMaTaZ9NzIAD03O8AF5+chRD0RDdkDBgAAPYUiA6WcqNSwcRTIViBERDEbjEBTZCAUHJBjTlZ0GSomd1CL0vtjWTq9XMFgtlqtrVi6Js6AgCMQ0JYAHJwMDAABuKCFtN6Vtpx2IZAoVC9PrAftiVwQtwjlijqaOyfj53Tty2O2g8CQyAAkqgKMACHcPFKpHHQIJdJtkHRRhAEBNuChvSdekypNXa-WAD7IABK2vZtMMY+DBFMukHvpAQdD4dzWEDwbDitpLVVYmHXSk6k6Ok7vI8HgAemItuuU2KMxBRsgs2mbkeTUyp7nsgl7XtoPJ8qwVDXJ+yAAIS3ny96ME+QA
https://github.com/A-EbrahimRSA
Abdullah Ebrahim (A-EbrahimRSA)https://github.com/A-EbrahimRSA
on Apr 7, 2025https://github.com/microsoft/TypeScript/issues/17002#issuecomment-2782169204
https://github.com/oconnorjoseph
Joseph O'Connor (oconnorjoseph)https://github.com/oconnorjoseph
on Apr 9, 2025https://github.com/microsoft/TypeScript/issues/17002#issuecomment-2787918238
Coltin Kifer (ckifer)https://github.com/ckifer
on Dec 12, 2025https://github.com/microsoft/TypeScript/issues/17002#event-21519733231
Remove any from Array.isArray, fix violations (#6760)https://github.com/recharts/recharts/commit/443b13649b383a1941468a750b7edbe43aa4b769
#6760https://github.com/recharts/recharts/pull/6760
443b136https://github.com/recharts/recharts/commit/443b13649b383a1941468a750b7edbe43aa4b769
https://github.com/spalt08
Konstantin Darutkin (spalt08)https://github.com/spalt08
on Jan 22, 2026https://github.com/microsoft/TypeScript/issues/17002#issuecomment-3784982171
playgroundhttps://www.typescriptlang.org/play/?ssl=12&ssc=1&pln=1&pc=1#code/GYVwdgxgLglg9mABDAzgJQKYEMAmCA2AngIIBOpWhAPACoA0imKUAfABQBuW+IGAXIlLY8YIohoBtALqIAPowzMAlAK48MyFIOEFC46YgDeAKETaoIUkjIVCAOlQ3KnbryUBuYwF9jxgPR+iHCkiABWIMz+gRAIzJqYuLpOegC8iMkOKMmIWFq0DEysLuoCQomiepIy8oVKiCksiGq8mtrlYlWexjFgcShYALYADvgYAIz1iAa5bSJiYCADAEYYpAbyzKQwYADmcogLy6ueMMCIbKgJcyTkzv3Do2NKdSZm9yPj7ogBiAAWcBxVogoHBECgMBooL9IYQhhhvMYgA
https://github.com/cahnory
cahnoryhttps://github.com/cahnory
on Jan 22, 2026https://github.com/microsoft/TypeScript/issues/17002#issuecomment-3786996167
playgroundhttps://www.typescriptlang.org/play/?ssl=12&ssc=1&pln=1&pc=1#code/GYVwdgxgLglg9mABDAzgJQKYEMAmCA2AngIIBOpWhAPACoA0imKUAfABQBuW+IGAXIlLY8YIohoBtALqIAPowzMAlAK48MyFIOEFC46YgDeAKETaoIUkjIVCAOlQ3KnbryUBuYwF9jxgPR+iHCkiABWIMz+gRAIzJqYuLpOegC8iMkOKMmIWFq0DEysLuoCQomiepIy8oVKiCksiGq8mtrlYlWexjFgcShYALYADvgYAIz1iAa5bSJiYCADAEYYpAbyzKQwYADmcogLy6ueMMCIbKgJcyTkzv3Do2NKdSZm9yPj7ogBiAAWcBxVogoHBECgMBooL9IYQhhhvMYgA
https://github.com/niklasholm
Niklas Holm (niklasholm)https://github.com/niklasholm
on Feb 25, 2026https://github.com/microsoft/TypeScript/issues/17002#issuecomment-3958701606
https://github.com/slztfn
slztfnhttps://github.com/slztfn
on Mar 17, 2026https://github.com/microsoft/TypeScript/issues/17002#issuecomment-4076378007
cahnoryhttps://github.com/cahnory
https://github.com/cahnory
cahnoryhttps://github.com/cahnory
on Mar 18, 2026https://github.com/microsoft/TypeScript/issues/17002#issuecomment-4080971605
Dominik Dorfmeister 🔮 (TkDodo)https://github.com/TkDodo
on Mar 19, 2026https://github.com/microsoft/TypeScript/issues/17002#event-23712535434
fix(types): ensure Array.isArray will not widen readonly arrays to anyhttps://github.com/getsentry/sentry/commit/ad58f309742c752ebb72d134b66080d3af04dd8e
ad58f30https://github.com/getsentry/sentry/commit/ad58f309742c752ebb72d134b66080d3af04dd8e
https://github.com/daishuge
Dai Luo (daishuge)https://github.com/daishuge
on Jul 5, 2026https://github.com/microsoft/TypeScript/issues/17002#issuecomment-4885934843
#63609https://github.com/microsoft/TypeScript/pull/63609
Sigurd Spieckermann (@sisp)https://github.com/sisp
https://github.com/anderson-pete
Pete Anderson (anderson-pete)https://github.com/anderson-pete
on Jul 6, 2026https://github.com/microsoft/TypeScript/issues/17002#issuecomment-4896931936
Dai Luo (@daishuge)https://github.com/daishuge
a commenthttps://github.com/microsoft/TypeScript/pull/63609#issuecomment-4896919593
Jake Bailey (jakebailey)https://github.com/jakebailey
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Aug 20, 2026https://github.com/microsoft/TypeScript/issues/17002#event-29770218168
Colum Ferry (Coly010)https://github.com/Coly010
on Aug 26, 2026https://github.com/microsoft/TypeScript/issues/17002#event-30054013368
fix(config): fifth codex round — deep-readonly metadata, integer freq…https://github.com/supabase/cli/commit/51d9793bca9cac0a94d71932f25eb5c15e334129
51d9793https://github.com/supabase/cli/commit/51d9793bca9cac0a94d71932f25eb5c15e334129
https://github.com/WORMSS
Colin Richardson (WORMSS)https://github.com/WORMSS
on Oct 19, 2026https://github.com/microsoft/TypeScript/issues/17002#issuecomment-6270372250
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/17002
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/17002
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20lib.d.ts%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
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.