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

update(assoc) Simplify Typings to fix inference and cross function usage #100

Merged
merged 1 commit into from
Mar 2, 2024

Conversation

Harris-Miller
Copy link
Collaborator

Simplify typings on assoc

Turns out that overloading for the specific key/value scenarios is harder on typescript than returning a complex type checking via ternaries. This works better for pretty much all scenarios. Especially when passing results from curried assoc calls into other functions, eg pipe(assoc('key', 'value')) or [].map(assoc('key', 'value'))

See example here: https://tsplay.dev/Na5r0N

Fixes: #35
And: #37 (comment)

@Harris-Miller Harris-Miller force-pushed the assoc-non-breaking-updates branch from 7c425ad to 7352edb Compare March 2, 2024 04:35
@Harris-Miller Harris-Miller merged commit 6027164 into develop Mar 2, 2024
3 checks passed
@Harris-Miller Harris-Miller deleted the assoc-non-breaking-updates branch March 2, 2024 04:38
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.

assoc returns a narrower type than what is passed
1 participant