feat: add TypeScript types #6

Merged
andrewvasilchuk merged 4 commits from feature/types into master 2020-09-07 09:20:39 +02:00
andrewvasilchuk commented 2020-09-05 16:49:23 +02:00 (Migrated from github.com)

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

@marijnh, Hello. Can you please help me with `prepend` and `append` methods typing?
marijnh commented 2020-09-05 16:51:59 +02:00 (Migrated from github.com)

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

They'd be something like `append(OrderedMap<T> | {[key: string]: T}): OrderedMap<T>`
andrewvasilchuk commented 2020-09-05 16:55:08 +02:00 (Migrated from github.com)

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

@marijnh, should `T` of `this` be combined with the passed one `map` `T`?
marijnh commented 2020-09-05 17:07:57 +02:00 (Migrated from github.com)

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.

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 commented 2020-09-05 17:09:17 +02:00 (Migrated from github.com)

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

@marijnh, `prepend` and `append` now return a combined type of `this` and a passed `map`.
marijnh commented 2020-09-05 17:20:08 +02:00 (Migrated from github.com)

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>
`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 commented 2020-09-07 09:20:44 +02:00 (Migrated from github.com)

Thanks!

Thanks!
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
marijn/orderedmap!6
No description provided.