Vitest + React test input type

how to test input type.
i used the following
expect(passwordInput.type).toEqual("text");
but i have red line under type

the test works successfully but i want to remove the red line

i want to test whether the type is text or password
thanks

What is the error under type? hover mouse over it and it should give you some detail.

also would help to see where the passwordInput code is too

So your trying to check if the password is set to a text attribute?

when i hover over the error here what displays

Property ‘type’ does not exist on type ‘HTMLElement’.ts(2339)

this is my test

it(“should show password when show password is checked”, async () => {
const { passwordInput, showPasswordCheckBox, user } = renderComponent();

await user.type(passwordInput, "password");
expect(passwordInput.type).toEqual("password");

await user.click(showPasswordCheckBox);
expect(passwordInput.type).toEqual("text");

});

what i am trying to do is to verify that when i user click show password, the passowrd input will
by text input

can you show the constructor you made for the user property? and what is the error, hover mouse over red line.

I’m thinking if your using mongoose.Type It’s a capitol T but it’s on the user property from what it looks like.

regarding the user object there how i created it
user: userEvent.setup(),

the user object I used to simulate user events for testing purposes

when i hover with the mouse over the red line here is the error
Error: Property ‘type’ does not exist on type ‘HTMLElement’.ts(2339)

I would think you would need to create a user object in your testing suite something like this before you would be able to call user.type

const {USER} = require('…/user)

user= new User({
passwordInput: {
type:password},

click: {
type: text}

also define the password property otherwise it’s null