I am trying to create a dynamic type based on an array of objects. I can do this by defining literals as a type but ideally I want to learn how to do it without needing to manually define them.
Consider this example code
const testA = {
name: 'a',
}
const testB = {
name: 'b',
}
const testC = {
name: 'c',
}
const items = [testA, testB, testC]
I can easily create the type using the example below
type possibleNames = 'a' | 'b' | 'c'
However I want to do this dynamically without having to define literals. I looked into TS documentation for and saw utility helpers like Pick and Record but I'm not entirely sure if those are correct or how to implement them if so.