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

feat: add TypeScript types #6

Merged
merged 4 commits into from
Sep 7, 2020
Merged

feat: add TypeScript types #6

merged 4 commits into from
Sep 7, 2020

Conversation

andrewvasilchuk
Copy link
Contributor

@marijnh, Hello. Can you please help me with prepend and append methods typing?

@marijnh
Copy link
Owner

marijnh commented Sep 5, 2020

They'd be something like append(OrderedMap<T> | {[key: string]: T}): OrderedMap<T>

@andrewvasilchuk
Copy link
Contributor Author

@marijnh, should T of this be combined with the passed one map T?

@marijnh
Copy link
Owner

marijnh commented Sep 5, 2020

Yes, that's the same type. Though I guess you could also do append(OrderedMap<U> | {[name: string]: U}): OrderedMap<T | U> if you want to be extremely general. But that seems overkill.

@andrewvasilchuk
Copy link
Contributor Author

andrewvasilchuk commented Sep 5, 2020

@marijnh, prepend and append now return a combined type of this and a passed map.

@marijnh
Copy link
Owner

marijnh commented Sep 5, 2020

find is internal. And the type for append, prepend, subtract, and from is not right yet. Just do something like

append(map: MapLike<T>): OrderedMap<T>
prepend(map: MapLike<T>): OrderedMap<T>
subtract(map: MapLike<T>): OrderedMap<T>
static from<T>(map: MapLike<T>): OrderedMap<T>

@marijnh marijnh merged commit 7f79027 into marijnh:master Sep 7, 2020
@marijnh
Copy link
Owner

marijnh commented Sep 7, 2020

Thanks!

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.

2 participants