Title: error TS2385: Overload signatures must all be public, private or protected. Why? · Issue #7577 · microsoft/TypeScript · GitHub
Open Graph Title: error TS2385: Overload signatures must all be public, private or protected. Why? · Issue #7577 · microsoft/TypeScript
X Title: error TS2385: Overload signatures must all be public, private or protected. Why? · Issue #7577 · microsoft/TypeScript
Description: public myMethod(); private myMethod(Data?:T,FromRevision?:number,TilRevision?:number); public myMethod(Data?:T,FromRevision:number=0,TilRevision:number=0) { ... } gives: error TS2385: Overload signatures must all be public, private or pr...
Open Graph Description: public myMethod(); private myMethod(Data?:T,FromRevision?:number,TilRevision?:number); public myMethod(Data?:T,FromRevision:number=0,TilRevision:number=0) { ... } gives: error TS2385: Overload sign...
X Description: public myMethod(); private myMethod(Data?:T,FromRevision?:number,TilRevision?:number); public myMethod(Data?:T,FromRevision:number=0,TilRevision:number=0) { ... } gives: error TS2385: Overload sign...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/7577
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"error TS2385: Overload signatures must all be public, private or protected. Why?","articleBody":"```\npublic myMethod();\nprivate myMethod(Data?:T,FromRevision?:number,TilRevision?:number);\npublic myMethod(Data?:T,FromRevision:number=0,TilRevision:number=0) {\n ...\n}\n```\n\ngives:\n\n```\nerror TS2385: Overload signatures must all be public, private or protected.\n```\n\nWhat is this restriction needed for? Of course a possible workaround is an internal helper function:\n\n```\nprivate myMethodInternal(Data?:T,FromRevision:number=0,TilRevision:number=0) {\n ...\n}\n\npublic myMethod() {\n this.myMethodInternal();\n}\n```\n\nBut it is just unnecessary work and unnecessary function calls (performance, when called often).\nEven worse, when i try to do this on a constructor, it complains:\n\n```\nerror TS1089: 'private' modifier cannot appear on a constructor declaration.\n```\n\nWhy not? I wanted to have a constructor, which is only accessible by methods inside the class and allows to specify additional parameters to the constructor, which would else hold their default values. Of course, the workaround above also works in this situation.\n","author":{"url":"https://github.com/0815fox","@type":"Person","name":"0815fox"},"datePublished":"2016-03-18T10:22:48Z","url":"https://github.com/microsoft/TypeScript/issues/7577"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7e5d01b4-4980-771a-03f7-139cad2cc85f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C64A:2E7EBB:8C2D16:B27DC1:6B00E999 |
| html-safe-nonce | 8db559fcf927b911fc7ccc9547050b473a652a1ce9d192f0a54649e404b743f1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjRBOjJFN0VCQjo4QzJEMTY6QjI3REMxOjZCMDBFOTk5IiwidmlzaXRvcl9pZCI6Ijc2NjY2MjM2NjQzMzAxNzI4MjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f2b7c07b7889b7ee1046c6ef7d617a3dc4fd5fe8f0f71a9a8f3c93faf536afda |
| hovercard-subject-tag | issue:141827798 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/7577/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a6cae0e803f10f19a9d285c4284883549a38d7aab12fc7721a7c2f6f9138f181/microsoft/TypeScript/issues/7577 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a6cae0e803f10f19a9d285c4284883549a38d7aab12fc7721a7c2f6f9138f181/microsoft/TypeScript/issues/7577 |
| og:image:alt | public myMethod(); private myMethod(Data?:T,FromRevision?:number,TilRevision?:number); public myMethod(Data?:T,FromRevision:number=0,TilRevision:number=0) { ... } gives: error TS2385: Overload sign... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 0815fox |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width