René's URL Explorer Experiment


Title: Dangerous "name" (and potentially others) global · Issue #18433 · microsoft/TypeScript · GitHub

Open Graph Title: Dangerous "name" (and potentially others) global · Issue #18433 · microsoft/TypeScript

X Title: Dangerous "name" (and potentially others) global · Issue #18433 · microsoft/TypeScript

Description: TypeScript Version: 2.6.0-dev.20170913 Code if (name === "asdf") { console.log("asdf") } https://www.typescriptlang.org/play/#src=if (name === "asdf") { console.log('hello') } Expected behavior: Error out Actual behavior...

Open Graph Description: TypeScript Version: 2.6.0-dev.20170913 Code if (name === "asdf") { console.log("asdf") } https://www.typescriptlang.org/play/#src=if (name === "asdf") { console.log('hello') } Expe...

X Description: TypeScript Version: 2.6.0-dev.20170913 Code if (name === "asdf") { console.log("asdf") } https://www.typescriptlang.org/play/#src=if (name === "asdf") { co...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Dangerous \"name\" (and potentially others) global ","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.6.0-dev.20170913\r\n\r\n**Code**\r\n\r\n```ts\r\nif (name === \"asdf\") {\r\n  console.log(\"asdf\")\r\n}\r\n```\r\n\r\n`https://www.typescriptlang.org/play/#src=if (name %3D%3D%3D \"asdf\") {%0D%0A console.log('hello')%0D%0A}`\r\n\r\n**Expected behavior:**\r\n\r\nError out\r\n\r\n**Actual behavior:**\r\n\r\nMore than once, I had a \"local\" variable called `name`, outside a block scope, and it didn't warn me that it's not defined (or used before declaration). even though, in my code, `event.name` is a string, the global `name` variable is of type `never`. it's defined in `lib.dom.d.ts`, along with other \"juicy\" global names that will provide some confusion, like `length`, `external`, `event`, `closed`\r\n\r\n![image](https://user-images.githubusercontent.com/461084/30372857-ad591f3a-9855-11e7-915b-7dee3baaec8f.png)\r\n\r\n![image](https://user-images.githubusercontent.com/461084/30372908-d7acb40e-9855-11e7-99c8-b31c78e45d5f.png)\r\n\r\none 'fix' (that would be a breaking change) would to make `lib.dom-globals.d.ts` (the propertiers that are usually accessible through `window` variable) and make it an opt-in in `tsconfig.json compilerOptions.lib` array","author":{"url":"https://github.com/pocesar","@type":"Person","name":"pocesar"},"datePublished":"2017-09-13T10:38:19Z","url":"https://github.com/microsoft/TypeScript/issues/18433"}

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:a9eede97-b61e-4562-e244-0c4e2d7edd5b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAE56:20AA01:FC397C:1430BDC:6B00FEC0
html-safe-nonce4e4e283da0f4c3cbbfa833fbf5e78f980a1d0499eaf3046b953812afa64f86b9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTU2OjIwQUEwMTpGQzM5N0M6MTQzMEJEQzo2QjAwRkVDMCIsInZpc2l0b3JfaWQiOiIzNTQzNDUzOTMwNTkzNzc5MzkyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacf31da3d7feb6af5efe7ca814ed8d0ba5d7ecf252cd5dbe0fb8a79ee2417e7b2d
hovercard-subject-tagissue:257334503
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/18433/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4225f234d7d219a34e6224960f9582b884157545a5a97f0b7ff6fc01d4714f74/microsoft/TypeScript/issues/18433
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4225f234d7d219a34e6224960f9582b884157545a5a97f0b7ff6fc01d4714f74/microsoft/TypeScript/issues/18433
og:image:altTypeScript Version: 2.6.0-dev.20170913 Code if (name === "asdf") { console.log("asdf") } https://www.typescriptlang.org/play/#src=if (name === "asdf") { console.log('hello') } Expe...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepocesar
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
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
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/18433#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F18433
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%2F18433
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/18433
Reloadhttps://github.com/microsoft/TypeScript/issues/18433
Reloadhttps://github.com/microsoft/TypeScript/issues/18433
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests309 (309)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/18433
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/18433
microsoft/TypeScript-DOM-lib-generator#883https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/883
Dangerous "name" (and potentially others) global https://github.com/microsoft/TypeScript/issues/18433#top
microsoft/TypeScript-DOM-lib-generator#883https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/883
Cursed?It's likely this is extremely difficult to fix without making something else much, much worsehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Cursed%3F%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
Possible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some caseshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Possible%20Improvement%22
Backloghttps://github.com/microsoft/TypeScript/milestone/29
https://github.com/pocesar
Paulo Cesar (pocesar)https://github.com/pocesar
on Sep 13, 2017https://github.com/microsoft/TypeScript/issues/18433#issue-257334503
https://user-images.githubusercontent.com/461084/30372857-ad591f3a-9855-11e7-915b-7dee3baaec8f.png
https://user-images.githubusercontent.com/461084/30372908-d7acb40e-9855-11e7-99c8-b31c78e45d5f.png
Nexthttps://github.com/microsoft/TypeScript/issues/18433?timeline_page=1
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Sep 13, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-329129957
#9850https://github.com/microsoft/TypeScript/issues/9850
https://github.com/pocesar
Paulo Cesar (pocesar)https://github.com/pocesar
on Sep 13, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-329130810
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
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
on Sep 13, 2017https://github.com/microsoft/TypeScript/issues/18433#event-1247743163
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Sep 13, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-329242841
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Sep 14, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-329615844
Mohamed Hegazy (@mhegazy)https://github.com/mhegazy
https://github.com/pocesar
Paulo Cesar (pocesar)https://github.com/pocesar
on Sep 14, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-329616498
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 14, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-329636470
https://github.com/pocesar
Paulo Cesar (pocesar)https://github.com/pocesar
on Sep 15, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-329764814
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Sep 17, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-330027116
https://github.com/pocesar
Paulo Cesar (pocesar)https://github.com/pocesar
on Sep 17, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-330027423
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Sep 17, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-330030151
https://github.com/pocesar
Paulo Cesar (pocesar)https://github.com/pocesar
on Sep 17, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-330030559
https://github.com/kitsonk
Kitson Kelly (kitsonk)https://github.com/kitsonk
on Sep 17, 2017https://github.com/microsoft/TypeScript/issues/18433#issuecomment-330044380
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
on Oct 10, 2017https://github.com/microsoft/TypeScript/issues/18433#event-1286631910
https://github.com/orta
Orta Therox (orta)https://github.com/orta
on Sep 10, 2020https://github.com/microsoft/TypeScript/issues/18433#issuecomment-690630288
https://github.com/david-fong
David Fong (david-fong)https://github.com/david-fong
on Mar 28, 2021https://github.com/microsoft/TypeScript/issues/18433#issuecomment-808975224
#14306https://github.com/microsoft/TypeScript/issues/14306
https://github.com/thw0rted
James Bromwell (thw0rted)https://github.com/thw0rted
on Mar 29, 2021https://github.com/microsoft/TypeScript/issues/18433#issuecomment-809277138
David Fong (@david-fong)https://github.com/david-fong
#13778https://github.com/microsoft/TypeScript/issues/13778
https://github.com/david-fong
David Fong (david-fong)https://github.com/david-fong
on Mar 29, 2021https://github.com/microsoft/TypeScript/issues/18433#issuecomment-809482787
#14306https://github.com/microsoft/TypeScript/issues/14306
https://github.com/thw0rted
James Bromwell (thw0rted)https://github.com/thw0rted
on Mar 29, 2021https://github.com/microsoft/TypeScript/issues/18433#issuecomment-809499898
https://github.com/david-fong
David Fong (david-fong)https://github.com/david-fong
on Mar 29, 2021https://github.com/microsoft/TypeScript/issues/18433#issuecomment-809652574
https://github.com/LeonxLJX
Stella (LeonxLJX)https://github.com/LeonxLJX
on Sep 1, 2026https://github.com/microsoft/TypeScript/issues/18433#issuecomment-5492444910
Stella (@LeonxLJX)https://github.com/LeonxLJX
https://github.com/LeonxLJX
Stella (LeonxLJX)https://github.com/LeonxLJX
on Sep 1, 2026https://github.com/microsoft/TypeScript/issues/18433#issuecomment-5492963547
Stella (@LeonxLJX)https://github.com/LeonxLJX
https://github.com/LeonxLJX
Stella (LeonxLJX)https://github.com/LeonxLJX
on Sep 1, 2026https://github.com/microsoft/TypeScript/issues/18433#issuecomment-5492964958
Stella (@LeonxLJX)https://github.com/LeonxLJX
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Cursed?It's likely this is extremely difficult to fix without making something else much, much worsehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Cursed%3F%22
Possible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some caseshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Possible%20Improvement%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
Help Wantedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Help%20Wanted%22
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
Good First Issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Good%20First%20Issue%22
on Nov 10, 2026https://github.com/microsoft/TypeScript/issues/18433#event-35705326206
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/18433
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/18433
Cursed?It's likely this is extremely difficult to fix without making something else much, much worsehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Cursed%3F%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
Possible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some caseshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Possible%20Improvement%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.