René's URL Explorer Experiment


Title: Less restrictive object type · Issue #18228 · microsoft/TypeScript · GitHub

Open Graph Title: Less restrictive object type · Issue #18228 · microsoft/TypeScript

X Title: Less restrictive object type · Issue #18228 · microsoft/TypeScript

Description: New behavior No property existence check for object type. let foo: object; foo.bar; // no error Rationale The current object type is useful when used to type function arguments but not very useful on object members. See this IDL: [Secure...

Open Graph Description: New behavior No property existence check for object type. let foo: object; foo.bar; // no error Rationale The current object type is useful when used to type function arguments but not very useful ...

X Description: New behavior No property existence check for object type. let foo: object; foo.bar; // no error Rationale The current object type is useful when used to type function arguments but not very useful ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Less restrictive object type","articleBody":"### New behavior\r\n\r\nNo property existence check for `object` type.\r\n\r\n```ts\r\nlet foo: object;\r\nfoo.bar; // no error\r\n```\r\n\r\n### Rationale\r\n\r\nThe current `object` type is useful when used to type function arguments but not very useful on object members. See this IDL:\r\n\r\n```webidl\r\n[SecureContext]\r\ninterface PaymentResponse {\r\n    [Default] object        toJSON();\r\n\r\n    readonly attribute DOMString       requestId;\r\n    readonly attribute DOMString       methodName;\r\n    readonly attribute object          details;\r\n    readonly attribute PaymentAddress? shippingAddress;\r\n    readonly attribute DOMString?      shippingOption;\r\n    readonly attribute DOMString?      payerName;\r\n    readonly attribute DOMString?      payerEmail;\r\n    readonly attribute DOMString?      payerPhone;\r\n\r\n    Promise\u003cvoid> complete(optional PaymentComplete result = \"unknown\");\r\n};\r\n```\r\n\r\nHere, the `details` member can be any \"object\" depending on payment method behavior. Current lib.d.ts defines this member as `any` so that a user can access any untyped members.\r\n\r\n```ts\r\nlet response: PaymentResponse;\r\nlet { details } = response;\r\ndetails.anImplementationDependentMemberName; // great\r\n```\r\n\r\nBut `any` means it can be `boolean`, `number`, `string` or even `null` or `undefined`.\r\n\r\n```ts\r\nif (typeof details === \"number\") {\r\n  // `details` is resolved as `number` but really should be `never` here\r\n}\r\ndetails++; // no error, :(\r\n```\r\n\r\nA language service should be able to warn on these cases while still allowing arbitrary member accesses. Allowing such free accesses on `object` type will help here:\r\n\r\n```ts\r\ndetails.anImplementationDependentMemberName; // still great\r\nif (typeof details === \"number\") {\r\n  // it cannot be a number, so `never` here\r\n}\r\ndetails++; // error now :D\r\n```\r\n\r\n### Hey, a `function` can also be an `object` in TS!\r\n\r\nYes, but I don't think the fact will cause any problem as functions can also have arbitrary members. And I'm not proposing arbitrary function call.","author":{"url":"https://github.com/saschanaz","@type":"Person","name":"saschanaz"},"datePublished":"2017-09-03T12:50:01Z","url":"https://github.com/microsoft/TypeScript/issues/18228"}

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:ed4eb609-6988-43f0-03bc-91a8c3928f94
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE91E:1201C:A1B6D0:D8FFB2:6B00EA8C
html-safe-noncedb7b451428878f4b4e6622323e6f87adeb76abdbc8429237e156529e0daa851c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTFFOjEyMDFDOkExQjZEMDpEOEZGQjI6NkIwMEVBOEMiLCJ2aXNpdG9yX2lkIjoiMTI5NjQxMjU1NDEyNTQzNzU4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac58833507197a46440c18edad7fb462ee1ed0ad53af4795203791de4978a72ec4
hovercard-subject-tagissue:254872616
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/18228/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4c984b7a79d9536fd15f543bd66309285148080308022224b717550e22446354/microsoft/TypeScript/issues/18228
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4c984b7a79d9536fd15f543bd66309285148080308022224b717550e22446354/microsoft/TypeScript/issues/18228
og:image:altNew behavior No property existence check for object type. let foo: object; foo.bar; // no error Rationale The current object type is useful when used to type function arguments but not very useful ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesaschanaz
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
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
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/18228#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F18228
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%2F18228
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/18228
Reloadhttps://github.com/microsoft/TypeScript/issues/18228
Reloadhttps://github.com/microsoft/TypeScript/issues/18228
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests308 (308)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/18228
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/18228
Less restrictive object typehttps://github.com/microsoft/TypeScript/issues/18228#top
Needs More InfoThe issue still hasn't been fully clarifiedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20More%20Info%22
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Sep 3, 2017https://github.com/microsoft/TypeScript/issues/18228#issue-254872616
https://github.com/HerringtonDarkholme
Herrington Darkholme (HerringtonDarkholme)https://github.com/HerringtonDarkholme
on Sep 4, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-326908059
https://www.typescriptlang.org/play/index.html#src=type%20Obj%20%3D%20%7B%20%5Bk%3A%20string%20%5D%3A%20any%20%7D%0A%0Avar%20a%3A%20Obj%20%3D%201%0Avar%20b%3A%20Obj%20%3D%20true%0Avar%20c%3A%20Obj%20%3D%20%27ss%27%0Avar%20d%3A%20Obj%20%3D%20function%20()%20%7B%20%7D%20%0Avar%20e%3A%20Obj%20%3D%20new%20Number(3)https://www.typescriptlang.org/play/index.html#src=type%20Obj%20%3D%20%7B%20%5Bk%3A%20string%20%5D%3A%20any%20%7D%0A%0Avar%20a%3A%20Obj%20%3D%201%0Avar%20b%3A%20Obj%20%3D%20true%0Avar%20c%3A%20Obj%20%3D%20%27ss%27%0Avar%20d%3A%20Obj%20%3D%20function%20()%20%7B%20%7D%20%0Avar%20e%3A%20Obj%20%3D%20new%20Number(3)
https://github.com/NN---
NN (NN---)https://github.com/NN---
on Sep 4, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-327016921
#10715https://github.com/microsoft/TypeScript/issues/10715
#12416https://github.com/microsoft/TypeScript/issues/12416
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 5, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-327324432
#10715https://github.com/microsoft/TypeScript/issues/10715
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
DuplicateAn existing issue was already createdhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Duplicate%22
on Sep 5, 2017https://github.com/microsoft/TypeScript/issues/18228#event-1235831848
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Sep 8, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-327986491
#10715https://github.com/microsoft/TypeScript/issues/10715
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 11, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-328589724
#10715https://github.com/microsoft/TypeScript/issues/10715
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Sep 12, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-328698883
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
DuplicateAn existing issue was already createdhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Duplicate%22
on Sep 12, 2017https://github.com/microsoft/TypeScript/issues/18228#event-1244366444
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 12, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-328699351
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Sep 12, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-328708186
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 12, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-328919625
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Sep 13, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-329028484
Herrington Darkholme (@HerringtonDarkholme)https://github.com/HerringtonDarkholme
The code in TS2.2 release notehttps://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 14, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-329639745
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 14, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-329639826
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
Needs More InfoThe issue still hasn't been fully clarifiedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20More%20Info%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
on Sep 14, 2017https://github.com/microsoft/TypeScript/issues/18228#event-1250213548
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Sep 15, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-329645432
#1809https://github.com/microsoft/TypeScript/issues/1809
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 15, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-329864051
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Sep 16, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-329954235
#1809https://github.com/microsoft/TypeScript/issues/1809
#12501https://github.com/microsoft/TypeScript/pull/12501
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 18, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-330328033
#1809https://github.com/microsoft/TypeScript/issues/1809
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Sep 19, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-330398890
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 19, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-330616060
https://github.com/saschanaz
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
on Sep 19, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-330680116
Kagami Sascha Rosylight (saschanaz)https://github.com/saschanaz
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 19, 2017https://github.com/microsoft/TypeScript/issues/18228#event-1256343553
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Sep 19, 2017https://github.com/microsoft/TypeScript/issues/18228#issuecomment-330681179
microsofthttps://github.com/microsoft
on Jun 14, 2018https://github.com/microsoft/TypeScript/issues/18228#event-1682130810
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/18228
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/18228
Needs More InfoThe issue still hasn't been fully clarifiedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20More%20Info%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.