-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
π Search Terms
"Baseline Widely Available"
β Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- 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 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:
{
"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
- Writing modern websites and always knowing which APIs are available for use.
- 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.
- 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.
3ru and foolipfoolip
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript