Skip to content

[4.0.11] @opentelemetry/api type error with new release #9064

@AviVahl

Description

@AviVahl

Describe the bug

Saw this is a downstream repository:

node_modules/vitest/dist/chunks/traces.d.B8ukBJqA.d.ts:5:44 - error TS2307: Cannot find module '@opentelemetry/api' or its corresponding type declarations.

5 import { Context, Span, SpanOptions } from '@opentelemetry/api';
                                             ~~~~~~~~~~~~~~~~~~~~

node_modules/vitest/dist/index.d.ts:26:8 - error TS2307: Cannot find module '@opentelemetry/api' or its corresponding type declarations.

26 import '@opentelemetry/api';
          ~~~~~~~~~~~~~~~~~~~~


Found 2 errors in 2 files.

Errors  Files
     1  node_modules/vitest/dist/chunks/traces.d.B8ukBJqA.d.ts:5
     1  node_modules/vitest/dist/index.d.ts:26

I saw in another type-related issue you guys are suggesting to turn skipLibCheck on. We cannot do that. It would skip type checking all .d.ts files in our project (not just node_modules), hiding potential real issues. Already got bit by that.

Reproduction

mkdir vitest-type-issue
cd vitest-type-issue
npm init -y
npm pkg set type=module
npm i vitest typescript
npx tsc --init --skipLibCheck false
echo "import { expect } from 'vitest'; console.log(expect);" > main.ts
npx tsc --noEmit

System Info

Fedora 43
Node 24.11.1
npm 11.6.3

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p4-importantViolate documented behavior or significantly improves performance (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions