Skip to content

tsc --build in my project is reporting errors with vitest (missing Awaited) #510

@NullVoxPopuli

Description

@NullVoxPopuli

Describe the bug

  • chai does not have a default export
  • `Awaited is not defined
❯ tsc --build --clean && tsc --build
node_modules/vitest/dist/index.d.ts:5:18 - error TS2305: Module '"chai"' has no exported member 'default'.

5 export { assert, default as chai, should } from 'chai';
                   ~~~~~~~

node_modules/vitest/dist/index.d.ts:1086:28 - error TS2304: Cannot find name 'Awaited'.

1086     mockResolvedValue(obj: Awaited<TReturns>): this;
                                ~~~~~~~

node_modules/vitest/dist/index.d.ts:1087:32 - error TS2304: Cannot find name 'Awaited'.

1087     mockResolvedValueOnce(obj: Awaited<TReturns>): this;
                                    ~~~~~~~



Check for Awaited

❯ cat node_modules/vitest/dist/index.d.ts  | grep Awaited
    mockResolvedValue(obj: Awaited<TReturns>): this;
    mockResolvedValueOnce(obj: Awaited<TReturns>): this;

(only used, never imported)

Check for chai's default export

❯ cat node_modules/@types/chai/index.d.ts | grep default

(nothing)

Reproduction

I guess, use vitest in a project, and run tsc --build?

specifically,

System Info

System:
    OS: Linux 5.13 Ubuntu 21.10 21.10 (Impish Indri)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 14.38 GB / 31.14 GB
    Container: Yes
    Shell: 5.1.8 - /bin/bash
  Binaries:
    Node: 16.13.1 - ~/.volta/tools/image/node/16.13.1/bin/node
    Yarn: 1.22.11 - ~/.volta/tools/image/yarn/1.22.11/bin/yarn
    npm: 8.2.0 - ~/.volta/tools/image/npm/8.2.0/bin/npm
  Browsers:
    Chrome: 96.0.4664.93
    Firefox: 96.0


### Used Package Manager

yarn

### Validations

- [X] Follow our [Code of Conduct](https://github.com/vitest-dev/vitest/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitest-dev/vitest/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitest.dev/guide).
- [X] Check that there isn't [already an issue](https://github.com/vitest-dev/vitest/issues) that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions) or join our [Discord Chat Server](https://chat.vitest.dev).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions