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

Add support for TypeScript 4.7 #349

Merged
merged 1 commit into from
Apr 22, 2022
Merged

Add support for TypeScript 4.7 #349

merged 1 commit into from
Apr 22, 2022

Conversation

chriskrycho
Copy link
Collaborator

@chriskrycho chriskrycho commented Apr 22, 2022

TS 4.7 catches a class of error which 4.6 and earlier did not, courtesy of microsoft/TypeScript#48366: if the type passed does not implement toString(), it notices, because it no longer defaults to falling back to {}.

To resolve this, loosen the constraints on what is acceptable as input to toString, by making the implementation itself more robust. Doing so also fixes a bug with the output for toString when working with strings: previously if you had Maybe("a string"), the toString output would be 'Maybe(a string)'; it is now 'Maybe("a string")'.

Fixes #330

TS 4.7 catches a class of error which 4.6 and earlier did not, courtesy
of microsoft/TypeScript#43183: if the type passed does not implement
`toString()`, it notices, because it no longer defaults to falling back
to `{}`.

To resolve this, *loosen* the constraints on what is acceptable as
input to `toString`, by making the implementation itself more robust.
Doing so also fixes a bug with the output for `toString` when working
with strings: previously if you had `Maybe("a string")`, the `toString`
output would be `'Maybe(a string)'`; it is now `'Maybe("a string")'`.

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

Successfully merging this pull request may close these issues.

Failing on TS 4.7 nightlies
1 participant