mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-30 15:15:38 -05:00
Add tests
This commit is contained in:
@@ -141,3 +141,19 @@ function test1<T extends Record<string, any>, K extends keyof T>(t: T, k: K) {
|
||||
t[k] = "hello"; // Error
|
||||
t[k] = [10, 20]; // Error
|
||||
}
|
||||
|
||||
// Repro from #28839
|
||||
|
||||
function f30<T, K extends keyof T>() {
|
||||
let x: Partial<Record<keyof T, string>>[K] = "hello";
|
||||
}
|
||||
|
||||
// We simplify indexed accesses applied to mapped types up to five levels deep
|
||||
|
||||
function f31<T, K extends keyof T>() {
|
||||
let x: Partial<Partial<Partial<Partial<Record<keyof T, string>>>>>[K] = "hello";
|
||||
}
|
||||
|
||||
function f32<T, K extends keyof T>() {
|
||||
let x: Partial<Partial<Partial<Partial<Partial<Record<keyof T, string>>>>>>[K] = "hello";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user