Title: Adding a compilerOption to disable error on property override accessor in 4.0.beta · Issue #39401 · microsoft/TypeScript · GitHub
Open Graph Title: Adding a compilerOption to disable error on property override accessor in 4.0.beta · Issue #39401 · microsoft/TypeScript
X Title: Adding a compilerOption to disable error on property override accessor in 4.0.beta · Issue #39401 · microsoft/TypeScript
Description: Search Terms property override accessor Suggestion Previously in 3.9, property can override an accessor with no emit errors. And in 4.0 beta, a break change was introduced by #33509. It's reasonable to report an error on property overrid...
Open Graph Description: Search Terms property override accessor Suggestion Previously in 3.9, property can override an accessor with no emit errors. And in 4.0 beta, a break change was introduced by #33509. It's reasonabl...
X Description: Search Terms property override accessor Suggestion Previously in 3.9, property can override an accessor with no emit errors. And in 4.0 beta, a break change was introduced by #33509. It's reaso...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/39401
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Adding a compilerOption to disable error on property override accessor in 4.0.beta","articleBody":"## Search Terms\r\nproperty override accessor\r\n\r\n## Suggestion\r\nPreviously in 3.9, property can override an accessor with no emit errors. And in 4.0 beta, a break change was introduced by #33509.\r\n\r\nIt's reasonable to report an error on property override accessor in most case, but I'm using `experimentalDecorators` to inject a property accessor in prototype. \r\n\r\nCurrently I cannot find a solution for this use case, so I'm suggesting to add a new compilerOption to disable this check(strictOnly?) for compatibility.\r\n\r\n## Use Cases\r\n\r\n```\r\nclass Animal {\r\n private _age: number\r\n get age(){ return this._age }\r\n set age(value){ this._age = value }\r\n}\r\n\r\nclass Dog extends Animal {\r\n @defaultValue(100) age: number; // Unexpected error here\r\n}\r\n\r\nfunction defaultValue(value) {\r\n return (obj, name) => {\r\n Object.defineProperty(obj, name, {\r\n get() { return value }\r\n })\r\n }\r\n}\r\n```\r\n\r\n## Checklist\r\n\r\nMy suggestion meets these guidelines:\r\n\r\n* [ ] This wouldn't be a breaking change in existing TypeScript/JavaScript code\r\n* [x] This wouldn't change the runtime behavior of existing JavaScript code\r\n* [x] This could be implemented without emitting different JS based on the types of the expressions\r\n* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)\r\n* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).\r\n","author":{"url":"https://github.com/xuld","@type":"Person","name":"xuld"},"datePublished":"2020-07-03T04:13:44Z","url":"https://github.com/microsoft/TypeScript/issues/39401"}
| 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:323442ee-9cd9-2a3e-8117-1d16be2d398b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AFF0:1FE434:2F63DB:3EC110:6B018FA2 |
| html-safe-nonce | 5140475b81429b76c532da0e0d793f87902021d64adfd9f9faa9060299f879fe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkYwOjFGRTQzNDoyRjYzREI6M0VDMTEwOjZCMDE4RkEyIiwidmlzaXRvcl9pZCI6Ijc0OTI5MzM3ODI0MjU2Njk1MzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2346d5a8005da75c5a5a674eab6bbf7490df5ae96ef9227316624eff47c0ec49 |
| hovercard-subject-tag | issue:650330293 |
| 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/39401/issue_layout |
| twitter:image | https://opengraph.githubassets.com/340e9b026719288bda12a30da7ada422e30e92f003b7df5e44b84e6854b8425f/microsoft/TypeScript/issues/39401 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/340e9b026719288bda12a30da7ada422e30e92f003b7df5e44b84e6854b8425f/microsoft/TypeScript/issues/39401 |
| og:image:alt | Search Terms property override accessor Suggestion Previously in 3.9, property can override an accessor with no emit errors. And in 4.0 beta, a break change was introduced by #33509. It's reasonabl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | xuld |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width