Why keyof Record wont actually give the keys of the record ?

I have this exemple :

type GlobalStuff = {
  description : C,
  validate : (descriptionKeys : Record<keyof C, string> | undefined) => Boolean
}

type C = Record<string,object>


const test : GlobalStuff = {
  description : {
    test: {}
  },
  validate : (descriptionKeys) => {
    //no auto completed
    descriptionKeys.test
    return true
  }
}


So based on what i describe with type i would have hope that descriptionsKeys would get auto completion base on the description the user give but it doesn't thinkies The type of descriptionKeys is Record<string, string> and not Record<"test" , string> and if i had more keys to desc i would hope to get these keys to in the Record. Any idea of where i m wrong ?
Was this page helpful?