Add extension API for registering custom category views (#4733)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-01-21 16:44:57 -05:00
1 parent 4f5a2988cb
commit 53ffc62391
9 files changed
+301 -13

No files matched your search

+8
View File
@@ -17,3 +17,11 @@ export function getOrInsert<K, V>(map: Map<K, V>, key: K, value: V): V {
return map.get(key);
}
/**
* Like `getOrInsert` but specifically for when `V` is `Map<any, any>` so that
* the typings are inferred.
*/
export function getOrInsertMap<K, MK, MV>(map: Map<K, Map<MK, MV>>, key: K): Map<MK, MV> {
return getOrInsert(map, key, new Map<MK, MV>());
}