microsoft / microsoft/TypeScript
FR: Add TS config option to disable "<some regex feature> is only available when targeting 'es2018' or later.".
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Acknowledgement
- I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment
Search terms for existing issues
"regex", "regular expressions"
Problem
The Google TS build infrastructure runs the TypeScript compiler with a centrally defined target language = "ES2016" for edit-refresh & testing. For production, users can still target newer language versions, but for various reasons our edit-refresh setup is stuck on this older language version.
This means that with TS 5.5 we start seeing build errors like "This regular expression flag is only available when targeting 'es2018' or later.".
Our current workaround will be either using the RegExp constructor or adding a patch to our compiler fork.
Proposal
Add a TS config option to toggle whether these sorts of errors are emitted at all.
Use cases
I realize that Google infra's situation is unusual, so this might not be a generally useful proposal & understand if you don't support this.
However, some possibilities I could imagine for someone setting an older target language than necessary for the browsers they support might be:
- dependance on some semantics of the transpiled code, e.g. because of https://github.com/angular/angular/issues/31730
- some other part of the build toolchain not supporting newer syntax.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing how TypeScript emits target-dependent regular-expression diagnostics and how compiler options are defined and tested. Done means a TS config option can suppress these diagnostics without changing the target or transpilation behavior; the issue does not name specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100