So I have the following code:
const obj = {
'key1': ['a', 'b', 'c'],
'key2': ['d', 'e', 'f'],
} as const
type Property = keyof typeof obj;
type PropertyValue<T extends Property> = typeof obj[T][number]
type Test0 = typeof obj extends Record<string, any[]> ? true : false; // false
type Test1 = typeof obj extends Record<string, string[]> ? true : false; // false
type Test2 = typeof obj['key1'] extends string[] ? true : false; // false
type Test3 = PropertyValue<'key1'> extends 'a' ? true : false; // false
type Test4 = PropertyValue<'key1'> extends 'a' | 'b' | 'c' ? true : false; // true
While I mostly understand why Test4 returns true, I do not understand why the other tests do not; especially Test3.
If anyone could help me understand, or at least point me in the right direction, I'd be grateful