Skip to content

chore: add explicit "types" to tsconfig files#6758

Merged
trentm merged 1 commit into
open-telemetry:mainfrom
trentm:trentm-tsconfig-explicit-types
May 25, 2026
Merged

chore: add explicit "types" to tsconfig files#6758
trentm merged 1 commit into
open-telemetry:mainfrom
trentm:trentm-tsconfig-explicit-types

Conversation

@trentm

@trentm trentm commented May 22, 2026

Copy link
Copy Markdown
Contributor

We use typescript v5 for compilation. However, sometimes external
tooling like an IDE will, by default, use the latest TS version for
editor support (like "squigglies" for lint/problems). This is the
case for VS Code and TS v6.

TS v6 changed the "types" tsconfig setting to default to [].
https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/#types-now-defaults-to-[]
It previously defaulted to "enumerate everything in node_modules/@types".

As (mild) preparation for eventually migrating to TS v6 and
to be nice to developers whose IDE or other tool defaults to using TS
v6, let's explicitly list our "types".

I don't believe there is a downside to this, other than needing
to add "types" entries as usage changes.

We use typescript v5 for compilation. However, sometimes external
tooling like an IDE will, by default, use the latest TS version for
editor support (like "squigglies" for lint/problems). This is the
case for VS Code and TS v6.

TS v6 changed the "types" tsconfig setting to default to `[]`.
  https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/#types-now-defaults-to-[]
It previously defaulted to "enumerate everything in node_modules/@types".

As (mild) preparation for eventually migrating to TS v6 and
to be nice to developers whose IDE or other tool defaults to using TS
v6, let's explicitly list our "types".

I don't believe there is a downside to this, other than needing
to add "types" entries as usage changes.
@trentm trentm self-assigned this May 22, 2026
@trentm
trentm requested review from a team as code owners May 22, 2026 23:31
@codecov

codecov Bot commented May 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.95%. Comparing base (4fdbfdd) to head (c403e6d).
⚠️ Report is 53 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6758      +/-   ##
==========================================
+ Coverage   94.78%   94.95%   +0.17%     
==========================================
  Files         374      377       +3     
  Lines       12439    12743     +304     
  Branches     2841     2896      +55     
==========================================
+ Hits        11790    12100     +310     
+ Misses        649      643       -6     

see 25 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trentm

trentm commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

This is what I'm referring to:

Screenshot 2026-05-22 at 4 15 29 PM

sometimes external
tooling like an IDE will, by default, use the latest TS version

This is, of course, configurable -- at least in VS Code via the @command:typescript.selectTypeScriptVersion command.
A possible position here is to say: developers, configure your tools.
However, I find that pretty tedious. At least personally I have dozens of git clones of this and contrib repo that I work in regularly. I'd need to configure VS Code local settings in each.

Or we could add .vscode/settings.json to the repo... but I don't particularly want to go there.

@overbalance overbalance left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upgrade to 7 👹

@trentm
trentm added this pull request to the merge queue May 25, 2026
Merged via the queue into open-telemetry:main with commit 00aed14 May 25, 2026
31 of 32 checks passed
@trentm
trentm deleted the trentm-tsconfig-explicit-types branch May 25, 2026 16:26
pull Bot pushed a commit to SimenB/opentelemetry-js that referenced this pull request May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants