In a TypeScript reporting library, you want a type that represents the possible aggregate functions ('sum', 'avg', 'min', 'max', 'count'). What is the most type-safe definition?
-
A
type AggregateFunc = string
-
B
type AggregateFunc = 'sum' | 'avg' | 'min' | 'max' | 'count'
-
C
enum AggregateFunc { SUM, AVG }
-
D
const AggregateFuncs = ['sum','avg']