-
Notifications
You must be signed in to change notification settings - Fork 13k
Description
We have generally chosen to only support ECMAScript Stage 3 and later proposals in TypeScript, with few exceptions. I propose that we choose to adopt earlier stage proposals through a combination of experimental switches and targets:
- By default, for any early stage proposal we do not scan, parse, check, or emit any related syntax.
- When an experimental feature is enabled, write a diagnostic warning message to the output.
- Add an
--experimentalStageNProposalName
switch for any early-stage proposal we opt to support to enable scan, parse, check, and emit for that proposal. - Add an
--experimentalStageN
switch to enable all experimental proposals in that stage. - Add a
--target esstageN
target to disable down-level emit for any proposal in that stage. - If a proposal advances between stages and changes syntax or runtime semantics, we can differentiate between each stage of that feature with a different switch.
- Once a proposal has advanced to Stage 3 or beyond, we can deprecate and eventually remove any outdated experimental switches in each release cycle.
- If necessary, we could consider restricting these experimental features to
@next
builds only.
Note that this differs from the behavior of the current --experimentalDecorators
switch in that we always parse decorators today, but issue a warning that is disabled with the switch. For this proposal we would never parse experimental features if the switch is disabled, and always issue a warning when it is enabled.
This would allow us to get valuable early feedback in TypeScript for various ECMAScript proposals as they advance while reducing the likelihood that developers become dependent on a feature whose experimental nature can change without notice due to a silently ignored warning.