Skip to main content
Module

x/rimbu/mod.ts>Deep.withType

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function Deep.withType
import { Deep } from "https://deno.land/x/rimbu@0.14.0/mod.ts";
const { withType } = Deep;

Returns a curried API with a known target type. This can be useful for using the methods in contexts where the target type can be inferred from the usage.

Examples

Example 1

const s = { a: 1, b: { c: 'a', d: true }}
const upd = Deep.withType<typeof s>().patchWith([{ d: (v) => !v }])
upd(s)
// => { a: 1, b: { c: 'a', d: false }}