microsoft / microsoft/TypeScript
Support lib: "baseline-widely-available"
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
### 🔍 Search Terms
"Baseline Widely Available"
### ✅ Viability Checklist
- [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [x] This wouldn't change the runtime behavior of existing JavaScript code
- [x] This could be implemented without emitting different JS based on the types of the expressions
- [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- [x] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- [x] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
### ⭐ Suggestion
When creating websites, it is now an industry standard to support [Baseline Widely Available](https://web.dev/baseline) JS APIs. Rather than only being able to select an ECMAScript year in the `lib` config, how about adding `"baseline-widely-available"` where it updates with each TS release, only allowing JS API and syntax that is marked as Widely Available?
### 📃 Motivating Example
To ensure that you only use API and syntax supported by all major browsers, you will be able to set:
```json
{
"compilerOptions": {
"lib": ["baseline-widely-available"]
}
}
```
This means that you can be assured that all the JS you write has been supported for at least 30 months.
### 💻 Use Cases
1. Writing modern websites and always knowing which APIs are available for use.
2. You could use ESLint rules to ban too modern JS API but that is an opt-out structure, where this would prevent mistakes at the lowest level, when writing the code.
3. Currently using `lib: "ES2022"` as this covers the time gap but it's not self-updating and could still include items that some browsers are yet to support in the 30 month version history.
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 with the compilerOptions.lib setting described in the issue and compare the requested Baseline Widely Available behavior with existing ECMAScript-year selection. Review the linked Baseline documentation to determine how qualifying APIs and syntax should be represented and updated per TypeScript release. Done means a defined, maintainable lib target that enforces the stated browser-support guarantee.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100