lodash
has the pick function which is used as follows:
var object = { 'a': 1, 'b': '2', 'c': 3 };
_.pick(object, ['a', 'c']);
// => { 'a': 1, 'c': 3 }
I would like to write a type-safe version of this in typescript.
Usage of this function should be
pick(object, o => o.a, o.b)
The goal is not to specify the same keys twice, and at the same time conserve type safety.
Is this possible to achieve?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…