Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/deep/index.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.13.5/deep/index.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 }}