#Infer one generic type parameter for class but not another

3 messages · Page 1 of 1 (latest)

weak oarBOT
#
sjennings#0

Preview:```ts
// The class definition should look something like this:
class CacheEntry<Data, Params extends unknown[] = unknown[]> {
constructor(readonly getKey: (...args: Params) => string) {}

set(data: Data, ...keyArgs: Params) {}

}

type Animal = {
name: string
...```

proper locust
#

Is there some way to get the second generic type parameter to be inferred, and still require specifying the first one explicitly?

south crown
#

no