microsoft / microsoft/TypeScript

Support lib: "baseline-widely-available"

Abierto
#62,536 3 comentarios 18 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Awaiting More Feedback Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

### 🔍 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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, typescript
Área
compilers
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.