Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importMeta.d.ts file causes TypeScript error due to uppercase character #4541

Closed
6 tasks done
macdaddyaz opened this issue Nov 19, 2023 · 0 comments · Fixed by #4571
Closed
6 tasks done

importMeta.d.ts file causes TypeScript error due to uppercase character #4541

macdaddyaz opened this issue Nov 19, 2023 · 0 comments · Fixed by #4571

Comments

@macdaddyaz
Copy link
Contributor

macdaddyaz commented Nov 19, 2023

Describe the bug

There's a long-standing (or maybe recurring) TypeScript bug that filenames with uppercase characters are not handled properly within triple-slash directives on case-sensitive file systems. For Vitest, this means that the importMeta.d.ts file can't be referenced without causing a TypeScript error:

src/main.ts:1:23 - error TS2688: Cannot find type definition file for 'vitest/importmeta'.

1 /// <reference types="vitest/importMeta" />
                        ~~~~~~~~~~~~~~~~~


Found 1 error in src/main.ts:1

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Note that Vite recently fixed a similar issue: vitejs/vite#13309

Reproduction

See this repository for a small project that shows the issue (only on macOS or Linux, I believe): https://github.com/macdaddyaz/vitest-import-meta-bug

yarn
yarn run tsc --project ./tsconfig.json

System Info

System:
    OS: macOS 13.6.1
    CPU: (8) arm64 Apple M1
    Memory: 58.80 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.8.0 - ~/.asdf/installs/nodejs/20.8.0/bin/node
    Yarn: 1.22.20 - ~/.asdf/installs/nodejs/20.8.0/bin/yarn
    npm: 10.2.1 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 8.10.5 - ~/.asdf/installs/nodejs/20.8.0/bin/pnpm
  Browsers:
    Brave Browser: 119.1.60.118
    Chrome: 119.0.6045.123
    Safari: 17.1
  npmPackages:
    vite: ^5.0.0 => 5.0.0 
    vitest: ^1.0.0-beta.5 => 1.0.0-beta.5 

Used Package Manager

yarn

Validations

@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant