class Example {
static alpha () {
return 'a'
}
static beta () {
return 'a'
}
static get = <T extends keyof Example> (...keys: T[]) => _.pick(Fragments, keys)
}
Example.get('alpha', 'beta') // {alpha, beta}
我怎么有一个get
方法来使用示例的键?
答案 0 :(得分:1)
缺少typeof
class Example {
static alpha () {
return 'a'
}
static beta () {
return 'a'
}
static get = <T extends keyof typeof Example> (...keys: T[]) => _.pick(Fragments, keys)
}
Example.get('alpha', 'beta') // {alpha, beta}