interface Sample {
value?: string
[prop: string]: any
}
const sampleObject: Sample = { title: 'John' }
const data = sampleObject.title
By including "any" in the interface, it eliminates the automatically assumed "string" type for the property name. This is evident when sampleObject
is assigned to the Sample interface.
Is there a method to uphold the inferred type with an interface or type definition?