Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add a newbaseline lib#62540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
3ru wants to merge1 commit intomicrosoft:main
base:main
Choose a base branch
Loading
from3ru:feat/baseline-lib
Draft

Conversation

3ru
Copy link

@3ru3ru commentedOct 4, 2025

Fixes#62536

Overview

  • This PoC adds a newlib value,baseline, to TypeScript.
  • When users setcompilerOptions.lib: ["baseline"] in tsconfig.json, the compiler only exposes types for JavaScript built‑ins that have reached Baseline Widely Available ("high"). Any built‑ins that are not yet in Baseline (low/false) are left undeclared and thus surface as ordinary type errors when referenced.
  • Language syntax (operators/statements/grammar/classes) is out of scope for this PR.

Scope (In/Out)

  • In: ECMAScript (JS) built‑in APIs only.
  • Data source: Features underjavascript.builtins.* in web‑features whosestatus.baseline == "high" (Widely Available).
  • Out: Language syntax (operators/statements/grammar/classes), DOM/Web API/Worker/ScriptHost (host environment APIs). (TODO)

Spec

  • baseline.
    • Concretely, we introducesrc/lib/baseline.d.ts, and reference only those existingsrc/lib/es20xx.*.d.ts fragments that correspond to Baseline Widely features via/// <reference lib="...">.
    • Built‑ins that haven't reached Baseline remain undeclared, so referencing them produces normal type errors.
Data Source and Verification (jq)
  • Data:web-featuresdata.json
    • Path:/Users/ru/Documents/eslint-plugin/eslint-plugin-baseline-js/node_modules/web-features/data.json
  • We extract feature IDs wherestatus.baseline == "high" and anycompat_features entry starts withjavascript.builtins.. We verified both the count and the list.

Set a variable:

DATA_PATH="/Users/ru/Documents/eslint-plugin/eslint-plugin-baseline-js/node_modules/web-features/data.json"

Count (unique feature IDs):

jq -r'.features | to_entries[] \  | select(.value.status?.baseline=="high") \  | select(any(.value.compat_features[]?; startswith("javascript.builtins."))) \  | .key'"$DATA_PATH"| sort -u| wc -l

List (unique feature IDs):

jq -r'.features | to_entries[] \  | select(.value.status?.baseline=="high") \  | select(any(.value.compat_features[]?; startswith("javascript.builtins."))) \  | .key'"$DATA_PATH"| sort -u
  • At the time of writing, we extract 65 JS built‑in features as Baseline Widely.

TODO

  • Scope and variants

    • Should we offer abaseline.full variant similar toes2015.full that also includes host libs likedom? (Note: this would mean JS is Baseline‑gated, but DOM is not.)
  • Definingbaseline.d.ts

    • Should we keep the allowlist references in the TS repo manually, or provide a mapper/tooling on the WebDX CG side? Either way, this repo needs the final mapping.
    • Known mismatch example between web‑features granularity and TS lib fragment granularity:
      • src/lib/es2023.array.d.ts currently contains both:
        • findLast/findLastIndex (web‑features:array-findlast, Baseline = high), and
        • toReversed/toSorted/toSpliced/with (web‑features:array-by-copy, Baseline = low)
      • We should decide whether to split this into separate fragments (e.g.es2023.array.findlast vses2023.array.by-copy) sobaseline can safely include only the Baseline‑high set.
  • Sustainable data maintenance

@typescript-bottypescript-bot added the For Uncommitted BugPR for untriaged, rejected, closed or missing bug labelOct 4, 2025
@3ru

This comment was marked as resolved.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotAwaiting requested review from CopilotCopilot will automatically review once the pull request is marked ready for review

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
For Uncommitted BugPR for untriaged, rejected, closed or missing bug
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Support lib: "baseline-widely-available"
2 participants
@3ru@typescript-bot

[8]ページ先頭

©2009-2025 Movatter.jp