What types should I specify for foo and BAR in the ExampleClass ExampleClass below?
class ExampleClass { private foo = { one: 1, two: 2 }; private static BAR = { one: 'one', two: 'three' } } Cases where such annotation is necessary:
Text version:
import { Vue, Component, Prop } from 'vue-property-decorator'; @Component export default class Bootstrap4AlertsCodeGenerator extends Vue { static CONTEXT_CSS_CLASSES: object = { PRIMARY: 'primary', SECONDARY: 'secondary', SUCCESS: 'success', }; contextCssClass: string = Bootstrap4AlertsCodeGenerator.CONTEXT_CSS_CLASSES.SECONDARY; public get isSelectContextCssClassRadiobuttonActive(): (contextCssClass: string) => boolean { return contextCssClass => this.contextCssClass === contextCssClass; } } Mistake:
TS2339: Property 'SECONDARY' does not exist on type 'object'. 
anyinstead ofobject2. declare a contract or alias 3. get access by key through square bracketsCONTEXT_CSS_CLASSES['SECONDARY']..... When you use theobject | Objecttypeobject | Objectobject | Object- you tell the compiler thatCONTEXT_CSS_CLASSESis a simple object without attributes - overthesanity