Skip to content

Improve scalability of Immutable.Map TS types #1831

Closed
@mbullington

Description

@mbullington

Hello! @immutable-js/maintainers @Methuselah96

We currently use Immutable.js pretty extensively in a Redux store and are progressively moving to TypeScript. In trying to strongly type our Immutable.Map objects, I settled for the time being on this:

export type FontUpload = Immutable.Map<
  'name' | 'created' | 'errorMessage' | 'progress' | 'complete',
  never
>;

It's less than ideal for strongly typing our stores, and given the option something like this would be great:

export type FontUpload = Immutable.Map<{
  name: string,
  created: number,
  errorMessage?: string,
  progress?: number,
  complete?: boolean
}>;

Is this something Immutable.js would be interested in for the v4.0.0 release? Happy to help with this work as long as devs find it reasonable.

I may need some TS help with overloading generics, if that's even possible. Would anyone know about the feasibility of this?

Best,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions