microsoft / microsoft/TypeScript

Support lib: "baseline-widely-available"

Ouverte
#62,536 3 commentaires 18 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Awaiting More Feedback Suggestion
Langage dominant
Go
Étoiles
111k
Forks
14.3k
Merge moyen
2 j 4 h
PR mergées (30 j)
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.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript, typescript
Domaine
compilers
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.