The code infer map keys type as unknown
, how to make it work correctly and detect it as string
? run it
class HMap<K, V> {
constructor(items: Record<string, V>)
constructor(items: [K, V][])
constructor(items: Record<string, V> | [K, V][]) {
}
}
const h = new HMap({a: 1, b: 2}) // => HMap<unknown, number>