Im trying to implement the following logic. "For specific attributes, I want to set a specific option. and for all other keys (strings) fallback to another type
I got the following code:
interface ProcedureValue {
value: string
title: string
}
export interface Procedure{
procedure_creation_time: string
[key :string]: ProcedureValue,
}
Im getting the following error:
Type error: Property 'procedure_creation_time' of type 'string' is not assignable to 'string' index type 'ProcedureValue'.
I have tried the following approaches:
- Exclude type on the key
- type | and &
- extending interfaces
All of them fail. Is it possible to do so?