////////////////////// type OriginalType = { key1: { sub1: string; sub2: string }; key2: { subA: string; subB: string }; }; type ValidKeys = keyof OriginalType; type ValidSubKeys = keyof OriginalType[K]; type EnforcedRecord = { [K in ValidKeys]: ValidSubKeys[]; }; // Example usage: const example: EnforcedRecord = { key1: ['sub1', 'sub2'], key2: ['subA', 'subB', "sub1"], // last is invalid };