Sometimes, we want to fix the "Property does not exist on type ‘{}’" error with TypeScript.
In this article, we’ll look at how to fix the "Property does not exist on type ‘{}’" error with TypeScript.
How to fix the "Property does not exist on type ‘{}’" error with TypeScript?
To fix the "Property does not exist on type ‘{}’" error with TypeScript, we can set the variable causing the error to any
type.
For instance, we write
const bar: any = {};
bar.foo = "foobar";
to set the bar
variable to the any
type.
Then we can do anything we want with bar
.
Conclusion
To fix the "Property does not exist on type ‘{}’" error with TypeScript, we can set the variable causing the error to any
type.