withDictionaryItemconstant

withDictionaryItem: <T>(dict: ImmutableDictionary<T>, key: string, value: T) => ImmutableDictionary<T>
Return
unknown
A new dictionary including the set item, or the original dictionary if the value was unchanged.

Set an item on a dictionary object (immutably) and return a new object including that item.

  • If the value is unchanged the original dictionary is returned unchanged.

Examples

withDictionaryItem({ a: 1 }, "b", 2); // { a: 1, b: 2 }