-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Property 'element' does not exist on type 'ExpectStatic' #6965
Comments
Hello @Pinakin-Desai-HBK. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with |
Here is a minimal reproduction - https://stackblitz.com/edit/vitejs-vite-vnkaxo?file=package.json,src%2Fassets%2FApp.test.tsx&terminal=dev |
Importing the import "@vitest/browser/matchers.d.ts";
// Your tests... |
Adding manually dts is necessary since |
@hi-ogawa |
I think it would be safe to include both the type and the dummy matcher that would throw an error if it's not the browser environment in the global expect, or, as suggested, have a separate browser expect/browserExpect. It will be great for discoverability and improve the DX. |
Yeah, that might work, but I guess there are a few concerns:
|
I don't see where it says to add it manually in that link. |
Thanks. This works too: import "@vitest/browser/matchers"; |
@Pinakin-Desai-HBK I'm referring to the first paragraph in the doc. There are actually many ways to help tsc and the doc mentions that
|
Describe the bug
Installed the latest vitest (2.1.5) but getting the following error - Property 'element' does not exist on type 'ExpectStatic'.
This was reported previously but seemed to have been fixed - #4273
Test:
package.json:
vitest:
Reproduction
Install the latest vitest and try to access the element property of expect.
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: