type A = { name?: string; } function test(a: A) { } type B = { [A in 'name' | 'age']?: string; } const b : B = {}; test(b);