Consider a scenario where a type key follows this structure:
XXX_{placeholder1}_{placeholder2}
, with placeholder1
being any letter from a to z
, and the same constraint applying to placeholder2
. Rather than explicitly defining each variation like so:
type ObjectT = {
XXX_a_a: '...',
XXX_a_b: '...',
....
XXX_z_z: '...'
}
Is there a method to dynamically generate these keys? I am aware that using:
type ObjectT = {
[key: string]: string
}
provides a generic solution, but it lacks specificity. Is there a way to achieve a more constrained type?