Skip to content

Using Immutable.js’s Maps with TypeScript #683

Closed
@OliverJAsh

Description

@OliverJAsh

I'm using immutable.js with TypeScript. I want a typed immutable object, e.g. an object called Person with an interface of: (name: string, age: number).

Ideally I could construct a Person and it will be an instance of Immutable.Map:

interface Person {
    name: string;
    age: number
}

var person = Person({ name: 'bob', age: 5 })
person.name // => 'bob'
var newPerson = person.set('name', 'harry');
person.name // => 'bob'
newPerson.name // => 'harry'

Is this possible? Sorry if my terminology is not entirely clear!

Thanks 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions