My typescript type starts with an unknown key, followed by two known keys. I tried to use an index signature for the first key, but that seems to affect all following keys as well.
Desired result:
let objOne:MyThing = {"anything":0.534843, label:"hello", confidence:0.94394}
let objTwo:MyThing = {"bleep":0.348989843, label:"heyyy", confidence:0.48394}
I tried to write this type as
interface MyThing {
[key: string] : string;
label : string;
confidence : number;
}
But now confidence
also needs to be a string for some reason.
How can I have just the first key to be any string, but the other two keys should be named label
and confidence
?