TS2339: Property 'value' does not exist on type 'HTMLElement' react testing library code example

Example 1: react testing library Property 'value' does not exist on type 'HTMLElement'.ts(2339)

const title = getByPlaceholderText("test") as HTMLInputElement;

Example 2: TS2339: Property 'value' does not exist on type 'Component<{}, {}, any>'. react renderer unit test

//If you want to get around this in not a type safe way and only if you are sure you are getting the values, try this.

const { valueX, valueY } = location.state as any

Tags:

Misc Example