@pacote/immutable
v2.0.4
Published
Immutable generic type.
Downloads
37
Readme
@pacote/immutable
Generic type for deeply immutable data.
Installation
yarn add @pacote/immutableUsage
import type { Immutable } from '@pacote/immutable'
type Foo = { foo: string }
const mutable: Foo[] = [{ foo: 'bar' }]
// Allowed:
mutable.push({ foo: 'baz' })
mutable[0].foo = 'baz'
delete mutable[0].foo
const immutable: Immutable<Foo[]> = [{ foo: 'bar' }]
// Not allowed:
immutable.push({ foo: 'baz' })
immutable[0].foo = 'baz'
delete immutable[0].fooLicense
MIT © Luís Rodrigues.
