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

x/rimbu/deep/mod.ts>withType

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

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 }}