Because of --strict_checks and typescript eslint checks, I am trying to fix some new errors in my code. Code examples below for everything I explain. Say I have an Object a, and I want to directly specify it as a map to get around some errors. I can't use the keyword "any". This is what I am trying to do:
isEquivalent(a: Object, b: Object): boolean {
const aObject: {[index: string]: Object} = a;
const bObject: {[index: string]: Object} = b;
}
Link to the typescript playground with the actual code snippet: here But this throws the error:
error TS2322: Type 'Object' is not assignable to type '{ [index: string]: Object; }'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? Index signature is missing in type 'Object'.
Can anyone point me to the solution for the type to specify object as, without using 'any'? Or if this isn't possible, please let me know.