In my Typescript code, I encountered an issue while trying to make my interface extend Object when using an indexer with a key as a string.
When I do not extend Object, everything works fine except that the intellisense does not provide suggestions for the Object.hasOwnProperty() method.
interface MyObject extends Object {
[key: string] : string;
}
The above code results in a compile time error: "Property 'hasOwnProperty' of type '(v: string) => boolean' is not assignable to string index type 'string'."
Later in my code, I need to use a variable of type MyObject to check if it contains a specific key using the hasOwnProperty method of Object.