René's URL Explorer Experiment


Title: Experiment with always using parameters from base types for derived methods · Issue #23911 · microsoft/TypeScript · GitHub

Open Graph Title: Experiment with always using parameters from base types for derived methods · Issue #23911 · microsoft/TypeScript

X Title: Experiment with always using parameters from base types for derived methods · Issue #23911 · microsoft/TypeScript

Description: Note some related issues for doing this with properties rather than methods: #3667, #6118, #1373. Goal We want to make it easier for users to derive types without rewriting the same parameter signature every time class Base { method(x: n...

Open Graph Description: Note some related issues for doing this with properties rather than methods: #3667, #6118, #1373. Goal We want to make it easier for users to derive types without rewriting the same parameter signa...

X Description: Note some related issues for doing this with properties rather than methods: #3667, #6118, #1373. Goal We want to make it easier for users to derive types without rewriting the same parameter signa...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Experiment with always using parameters from base types for derived methods","articleBody":"Note some related issues for doing this with *properties* rather than methods: #3667, #6118, #1373.\r\n\r\n# Goal\r\n\r\nWe want to make it easier for users to derive types without rewriting the same parameter signature every time\r\n\r\n```ts\r\nclass Base {\r\n  method(x: number) {\r\n    // ...\r\n  }\r\n}\r\n\r\nclass Derived extends Base {\r\n  method(x) {\r\n    // 'x' should have the type 'number' here.\r\n  }\r\n}\r\n```\r\n\r\n# Potential ideas\r\n\r\n* Only enable in `noImplicitAny` (doesn't work for default initializers 😞)\r\n* Revert to `any` in all locations, opt in with another strictness flag (😞)\r\n* Something else? 😕\r\n\r\n# Potential issues\r\n\r\n## Default initializers with more capable derived types\r\n\r\n```ts\r\nclass A {\r\n  a = 1;\r\n}\r\n\r\nclass B extends A {\r\n  b = 2;\r\n}\r\n\r\nclass Base {\r\n  method(x: A) {\r\n    // ...\r\n  }\r\n}\r\n\r\nclass Derived extends Base {\r\n  method(x = new B) {\r\n    x.b;\r\n    // Today, 'x' has type 'B' which is technically unsound\r\n    // but that's just what we do. Does changing this to 'A' break things?\r\n  }\r\n}\r\n```\r\n\r\n## Default initializers that become less-capable via contextual types\r\n\r\n```ts\r\n\r\nclass Base {\r\n  method(x: \"a\" | \"b\") {\r\n    // ...\r\n  }\r\n}\r\n\r\nclass Derived extends Base {\r\n  method(x = \"a\") {\r\n    // We have to make sure 'x' doesn't have type '\"a\"'\r\n    // which is both unsound and less useful.\r\n  }\r\n}\r\n```\r\n\r\n## Distinction between properties and methods\r\n\r\nWould this work?\r\n\r\n```ts\r\nclass Base {\r\n  method = (x: number) => {\r\n    // ...\r\n  }\r\n}\r\n\r\nclass Derived extends Base {\r\n  method(x) {\r\n    // Does 'x' have the type 'number' here?\r\n  }\r\n}\r\n```\r\n\r\nWhat about this?\r\n\r\n```ts\r\nclass Base {\r\n  method(x: number) {\r\n    // ...\r\n  }\r\n}\r\n\r\nclass Derived extends Base {\r\n  method = (x) => {\r\n    // Does 'x' have the type 'number' here?\r\n  }\r\n}\r\n```\r\n\r\n____\r\n\r\n**Keywords:** base type derived contextual contextually inherit methods implicit any","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2018-05-04T23:08:10Z","url":"https://github.com/microsoft/TypeScript/issues/23911"}

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:17bdf442-a8ec-23bc-510f-f8425ae03c07
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAE56:B53AF:D53197:11CA3F1:6B00FFD3
html-safe-nonce34e0678e7d5fcd190304ed329657c696d91e901c21e8d5f05cd53767f5c83221
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTU2OkI1M0FGOkQ1MzE5NzoxMUNBM0YxOjZCMDBGRkQzIiwidmlzaXRvcl9pZCI6Ijc1ODEwODcxMzU3NzI1MDgxMTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac5e7a35e5f9bbbe3e85ebf8881a43f9057879d1dbf1b1df258e137c0c695e8028
hovercard-subject-tagissue:320454689
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/23911/issue_layout
twitter:imagehttps://opengraph.githubassets.com/79c9e357f6f1beba98cf713cb5676bf6c843c8cf847ea14ac4a8593da9aeacb9/microsoft/TypeScript/issues/23911
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/79c9e357f6f1beba98cf713cb5676bf6c843c8cf847ea14ac4a8593da9aeacb9/microsoft/TypeScript/issues/23911
og:image:altNote some related issues for doing this with properties rather than methods: #3667, #6118, #1373. Goal We want to make it easier for users to derive types without rewriting the same parameter signa...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameDanielRosenwasser
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/23911#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F23911
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%2F23911
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/23911
Reloadhttps://github.com/microsoft/TypeScript/issues/23911
Reloadhttps://github.com/microsoft/TypeScript/issues/23911
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/23911
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/23911
Experiment with always using parameters from base types for derived methodshttps://github.com/microsoft/TypeScript/issues/23911#top
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/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on May 4, 2018https://github.com/microsoft/TypeScript/issues/23911#issue-320454689
#3667https://github.com/microsoft/TypeScript/issues/3667
#6118https://github.com/microsoft/TypeScript/pull/6118
#1373https://github.com/microsoft/TypeScript/issues/1373
Nexthttps://github.com/microsoft/TypeScript/issues/23911?timeline_page=1
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
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
on May 4, 2018https://github.com/microsoft/TypeScript/issues/23911#event-1610985657
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
Wesley Wigham (weswigham)https://github.com/weswigham
on May 4, 2018https://github.com/microsoft/TypeScript/issues/23911#event-1610985750
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on May 4, 2018https://github.com/microsoft/TypeScript/issues/23911#event-1610999475
https://github.com/sandersn
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
on May 7, 2018https://github.com/microsoft/TypeScript/issues/23911#issuecomment-387116648
Contextually type implemented properties #6118https://github.com/microsoft/TypeScript/pull/6118
https://github.com/weswigham
Wesley Wigham (weswigham)https://github.com/weswigham
on May 7, 2018https://github.com/microsoft/TypeScript/issues/23911#issuecomment-387149264
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on May 16, 2018https://github.com/microsoft/TypeScript/issues/23911#issuecomment-389393105
#10570https://github.com/microsoft/TypeScript/issues/10570
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on May 16, 2018https://github.com/microsoft/TypeScript/issues/23911#issuecomment-389394869
#10570https://github.com/microsoft/TypeScript/issues/10570
https://github.com/donaldpipowitch
Donald Pipowitch (donaldpipowitch)https://github.com/donaldpipowitch
on Jul 20, 2018https://github.com/microsoft/TypeScript/issues/23911#issuecomment-406521415
#13971https://github.com/microsoft/TypeScript/pull/13971
https://github.com/unional
Homa Wong (unional)https://github.com/unional
on Feb 3, 2019https://github.com/microsoft/TypeScript/issues/23911#issuecomment-460034226
SOhttps://stackoverflow.com/questions/54501121/typescript-class-doesnt-impelement-interface-types/54501288#54501288
https://github.com/nevir
Ian MacLeod (nevir)https://github.com/nevir
on Feb 6, 2019https://github.com/microsoft/TypeScript/issues/23911#issuecomment-461123662
https://github.com/nevir
Ian MacLeod (nevir)https://github.com/nevir
on Apr 11, 2019https://github.com/microsoft/TypeScript/issues/23911#issuecomment-482329043
Contextually type implemented properties #6118https://github.com/microsoft/TypeScript/pull/6118
https://github.com/nickofthyme
Nick Partridge (nickofthyme)https://github.com/nickofthyme
on Jan 17, 2020https://github.com/microsoft/TypeScript/issues/23911#issuecomment-575827742
https://github.com/tadhgmister
Tadhg McDonald-Jensen (tadhgmister)https://github.com/tadhgmister
on Jan 19, 2020https://github.com/microsoft/TypeScript/issues/23911#issuecomment-576053920
#36165https://github.com/microsoft/TypeScript/issues/36165
https://github.com/svicalifornia
Shawn Van Ittersum (svicalifornia)https://github.com/svicalifornia
on Aug 2, 2020https://github.com/microsoft/TypeScript/issues/23911#issuecomment-667634619
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
wrotehttps://github.com/microsoft/TypeScript/issues/23911#issuecomment-389394869
long comment on #32082https://github.com/microsoft/TypeScript/issues/32082#issuecomment-667630186
comment on #32082https://github.com/microsoft/TypeScript/issues/32082#issuecomment-667630186
#10570https://github.com/microsoft/TypeScript/issues/10570
Andrei Alecu (andreialecu)https://github.com/andreialecu
on Jan 1, 2021https://github.com/microsoft/TypeScript/issues/23911#event-4161246138
docs: update writeValuehttps://github.com/andreialecu/reactive-forms/commit/f5f755798189563773864634c9276af93ce4e63e
f5f7557https://github.com/andreialecu/reactive-forms/commit/f5f755798189563773864634c9276af93ce4e63e
https://github.com/darklight9811
Rafael Corrêa Chaves (darklight9811)https://github.com/darklight9811
on Jun 9, 2021https://github.com/microsoft/TypeScript/issues/23911#issuecomment-857293892
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
Wesley Wigham (weswigham)https://github.com/weswigham
on Oct 8, 2021https://github.com/microsoft/TypeScript/issues/23911#event-5437198562
https://github.com/haskelcurry
HK (haskelcurry)https://github.com/haskelcurry
on Sep 1, 2022https://github.com/microsoft/TypeScript/issues/23911#issuecomment-1233797475
https://github.com/muratgozel
Murat Gözel (muratgozel)https://github.com/muratgozel
on Oct 7, 2022https://github.com/microsoft/TypeScript/issues/23911#issuecomment-1271483938
https://github.com/clshortfuse
Carlos Lopez (clshortfuse)https://github.com/clshortfuse
on Nov 29, 2022https://github.com/microsoft/TypeScript/issues/23911#issuecomment-1329917239
https://github.com/IlyaSemenov
Ilya Semenov (IlyaSemenov)https://github.com/IlyaSemenov
on Dec 14, 2022https://github.com/microsoft/TypeScript/issues/23911#issuecomment-1351020050
https://github.com/jonlepage
jon lepage (jonlepage)https://github.com/jonlepage
on Oct 19, 2023https://github.com/microsoft/TypeScript/issues/23911#issuecomment-1771849728
https://github.com/tadhgmister
Tadhg McDonald-Jensen (tadhgmister)https://github.com/tadhgmister
on Oct 26, 2023https://github.com/microsoft/TypeScript/issues/23911#issuecomment-1780327203
playground linkhttps://www.typescriptlang.org/play#code/IYIwzgLgTsDGEAJYBthjAgUgewJYDsBTKBAbwCgEqFRIZ4EArPfACmAC46CBzAGgQgu0XgEoOCbvh4BucgF9ySlGgwA5QgHcAMgUI49JQgA8IhfABMMBoiQoBIZgVYA6N1J5gJABWAwAtoRmUGAAPDbEANoARE740QC6AHziCABKQQCuUPgAKgCeAA6E4SxRsSyJSWTk9vZQWTmSItJgLnGsAOQAOvidonL2ivJAA
#36165https://github.com/microsoft/TypeScript/issues/36165
myndzi (myndzi)https://github.com/myndzi
on Nov 6, 2023https://github.com/microsoft/TypeScript/issues/23911#event-10872962374
Use prototype methods, not property initializershttps://github.com/Noita-Together/lobby-server/commit/d39bc181372b8f38123466aa8d95e3068a96612a
d39bc18https://github.com/Noita-Together/lobby-server/commit/d39bc181372b8f38123466aa8d95e3068a96612a
https://github.com/hediet
Henning Dieterichs (hediet)https://github.com/hediet
on Apr 26, 2024https://github.com/microsoft/TypeScript/issues/23911#issuecomment-2079145023
https://github.com/tadhgmister
Tadhg McDonald-Jensen (tadhgmister)https://github.com/tadhgmister
on Feb 21, 2026https://github.com/microsoft/TypeScript/issues/23911#issuecomment-3939333243
certainly targeting ES5 rewrites class methods to assigning fields in the prototypehttps://www.typescriptlang.org/play/?target=1&module=0#code/CYUwxgNghgTiAEkoGdnwEIoQbwFD3gAcoBLGAHgBUA+ACigC5KAaAIyYEoH4BtFygLq4AvriSp4AMQD20+CAAeAFxAA7YGkzIc+eK1i128ZEpglVAcw54CBMNNXJpEEADoI0i7QBE6AIIASt7M8EoAFiTIIawcugRwSgCuMKrwAKwA3LqiBAD0ufDSAG4gMGagRKQwtK61HPAAtPCgAGbmIMCFiUrIJBXSLYjQqCK4+fDmLaVosBaJALZqPfBQ6vAJyalKAJ6ECPranQ7wANaq0gDuW7sIA1KyroQw0kovN49VuDLSj8+vO3sPmR4ABeeAtRKqMBKEjHYhkejRay6DYpXisZhQITCIA
#36165https://github.com/microsoft/TypeScript/issues/36165
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/23911
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/23911
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.