Title: Nightly-only experimental features · Issue #28152 · microsoft/TypeScript · GitHub
Open Graph Title: Nightly-only experimental features · Issue #28152 · microsoft/TypeScript
X Title: Nightly-only experimental features · Issue #28152 · microsoft/TypeScript
Description: This idea came about from a discussion I had with Yehuda Katz (@wycats) back in July when we discussed how Rust ships experimental features without the team feeling "locked in" if too many people take a dependency on it. If I'm suggestin...
Open Graph Description: This idea came about from a discussion I had with Yehuda Katz (@wycats) back in July when we discussed how Rust ships experimental features without the team feeling "locked in" if too many people t...
X Description: This idea came about from a discussion I had with Yehuda Katz (@wycats) back in July when we discussed how Rust ships experimental features without the team feeling "locked in" if too man...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/28152
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Nightly-only experimental features","articleBody":"This idea came about from a discussion I had with @wycats back in July when we discussed how Rust ships experimental features without the team feeling \"locked in\" if too many people take a dependency on it. If I'm suggesting anything drastically different from what we discussed, hopefully he can correct me.\r\n\r\n# Motivation\r\n\r\nFor some background, we've been helping a few of our friends at Bloomberg to implement ECMA262's private class fields proposal within the TypeScript compiler; however, given the sort of contentious feedback that we've seen on the proposal's repository, we'd like to first elicit feedback from the broader community around use-cases and general opinions around the private class fields proposal. But there's two problems with that.\r\n\r\n1. It's hard to get feedback about an implementation that's hard to npm install!\r\n1. The work is already done! And the longer that we put off merging it in, the more difficult it becomes later on.\r\n\r\nHow do we solve the above two problems without risking a change of course from ECMA262's proposal?\r\n\r\n# Not the solution\r\n\r\n## Release with `--experimentalPrivateFields`\r\n\r\nIn the last ~2 years or so, we've been extremely wary of [adding any flags](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22Add+a+Flag%22) to control experimental features, specifically because we know that `--experimentalDecorators` became a widespread hard dependency in the community in which the implementation deviated from the current ECMAScript proposal. How can you reasonably ever kill something like `--experimentalPrivateFields` if it ever landed in a stable release?\r\n\r\nMaybe the solution is to never land it in a stable release!\r\n\r\n# Maybe the solution\r\n\r\n## Release only nightlies with `--experimentalPrivateFields`\r\n\r\nTypeScript publishes a nightly release every, uh, I guess night depending on your time zone 🌏🌍🌎. Typically these releases are a good test bed for early adopters who want the latest and greatest features and bug fixes. Much of the time, they're purely for experimenting with features early on. General stability of the release is implied (i.e. usable with no major crashes or anything) but features themselves are prone to changing.\r\n\r\nThe idea here would be that if you wanted to actually use the private class fields proposal, you would have to get off of a stable version of TypeScript and then opt in with the flag.\r\n\r\nSo a user would have to run\r\n\r\n```sh\r\nnpm install typescript@next\r\n```\r\n\r\nto get the appropriate nightly release. At this point, trying to compile code with a private class field would result in the following error message on the declaration.\r\n\r\n```\r\nUsing private class fields requires opting in to the `--experimentalPrivateFields` flag. Note that this flag is only available in nightly releases, that its functionality may change, and that it may be removed entirely. Regardless, feedback from experimentation is appreciated\r\n```\r\n\r\nAt which point users could update their `tsconfig.json`\r\n\r\n```json5\r\n{\r\n \"compilerOptions\": {\r\n // ...\r\n \"experimentalPrivateFields\": true\r\n }\r\n // ...\r\n}\r\n```\r\n\r\n## Completely error in non-nightly releases\r\n\r\nUnder a non-nightly release (insiders, rc, latest, whatever's not `next`/`dev`), TypeScript should completely refuse to recognize the `--experimentalPrivateFields` option. It is an error to utilize it and it should prevent compilation from succeeding. Using it might result in an error message like\r\n\r\n```\r\n'--experimentalPrivateFields' is an experimental option that is only available on unstable nightly releases. To use it, you must install a nightly version of TypeScript via 'npm install typescript@next'.\r\n```\r\n\r\n# Precedent\r\n\r\n* IIRC @wycats mentioned that this is already something the Rust team does.\r\n* Browsers like Chrome ship certain JavaScript features only in canary (nightly) builds, but users have to explicitly jump into their settings and turn it on.\r\n\r\n# Other considerations\r\n\r\nThis functionality might need some minimal changes to our testing infrastructure, and appropriate feature gating utilities; however, I'm not convinced this will come up often enough that we will need to build up any heavy-weight abstractions.\r\n\r\nCC: @robpalme @joeywatts @mheiber","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2018-10-26T05:44:11Z","url":"https://github.com/microsoft/TypeScript/issues/28152"}
| 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:709ad365-da85-cd23-58a5-204c37d06ef9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CB96:361639:F0F6AC:141E965:6B010E1F |
| html-safe-nonce | 8311bac9903b8c31d8a4babccaee329a02991fbbff7bda6d27282a3c3509fcf0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjk2OjM2MTYzOTpGMEY2QUM6MTQxRTk2NTo2QjAxMEUxRiIsInZpc2l0b3JfaWQiOiI4NDgxNzIwMjY4NTQ3NDkzNDA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 87ff8d3aed892d6ffe9e07591c99811c77838d23e5745ee272629511cdc21770 |
| hovercard-subject-tag | issue:374234876 |
| 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/28152/issue_layout |
| twitter:image | https://opengraph.githubassets.com/230a94379a5d7b41ea95f40dcdfbfa8cc101ddbf8e1e72a1e20251e9a79226b4/microsoft/TypeScript/issues/28152 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/230a94379a5d7b41ea95f40dcdfbfa8cc101ddbf8e1e72a1e20251e9a79226b4/microsoft/TypeScript/issues/28152 |
| og:image:alt | This idea came about from a discussion I had with Yehuda Katz (@wycats) back in July when we discussed how Rust ships experimental features without the team feeling "locked in" if too many people t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DanielRosenwasser |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width