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

Getting typescript errors (unsafe member access on import.meta.env) since update to 2.4.0 #4125

Closed
6 tasks done
gunters63 opened this issue Jul 5, 2021 · 1 comment · Fixed by #4138
Closed
6 tasks done

Comments

@gunters63
Copy link

Describe the bug

I updated from 2.3.8 to 2.4.0 and I am getting now typescript errors accessing import.meta.env:

19:3 error Unsafe member access .PROD on an any value @typescript-eslint/no-unsafe-member-access
51:19 error Unsafe member access .DEV on an any value @typescript-eslint/no-unsafe-member-access
146:9 error Unsafe member access .DEV on an any value @typescript-eslint/no-unsafe-member-access

image

Did somehow the typescript definitions got lost? Or is there some manual configuration needed now?

Reproduction

Just upgrade an existing ViteJs project using typescript and import.meta.env to 2.4.0

System Info

System:
    OS: Windows 10 10.0.19043
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 16.69 GB / 31.71 GB
  Binaries:
    Node: 14.17.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.13 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1023.0), Chromium (91.0.864.64)     
    Internet Explorer: 11.0.19041.1
  npmPackages:
    vite: 2.4.0 => 2.4.0

Used Package Manager

pnpm

Logs

No response

Validations

@jceipek
Copy link

jceipek commented Jul 5, 2021

I believe this was introduced here: https://github.com/vitejs/vite/pull/4031/files#diff-9377bf04a22205467980e8409cb506410c7684f31069a146edba29a5d26c4e4fR2

I think changing /// <reference path="./types/importMeta" /> to /// <reference path="./types/importMeta.d.ts" /> would fix the problem

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.

2 participants