Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make explicit use of TypeScript's ReadonlySet and ReadonlyMap types. Fixes #494. #495

Closed
wants to merge 2 commits into from

Conversation

Mossop
Copy link
Contributor

@Mossop Mossop commented Jan 3, 2020

TypeScript provides the ReadonlySet and ReadonlyMap types which match
their normal counterparts but without any methods that mutate their data.
This change makes Immutable and Immutable map to those types
directly.

Worth noting that Map extends ReadonlyMap so we only need to check for
one to know what the resulting type is, the same goes for Set and
ReadonlySet.

This also removes the intermediate Set/Map types since TypeScript no
longer seems to need those (likely since TypeScript 3.7, see #448).

@Mossop Mossop changed the title Make explicit use of TypeScript's ReaonlySet and ReadonlyMap types. Fixes #494. Make explicit use of TypeScript's ReadonlySet and ReadonlyMap types. Fixes #494. Jan 3, 2020
…ixes immerjs#494.

TypeScript provides the ReadonlySet and ReadonlyMap types which match
their normal counterparts but without any methods that mutate their data.
This change makes Immutable<Map> and Immutable<Set> map to those types
directly.

Worth noting that Map extends ReadonlyMap so we only need to check for
one to know what the resulting type is, the same goes for Set and
ReadonlySet.

This also removes the intermediate Set/Map types since TypeScript no
longer seems to need those (likely since TypeScript 3.7, see immerjs#448).
@mweststrate
Copy link
Collaborator

Thanks for this PR! Merged into #506 and will become part of the next minor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants