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

src: TS rewrite #6

Merged
merged 24 commits into from Sep 4, 2019

Conversation

@vladfrangu
Copy link
Contributor

commented Apr 23, 2019

No description provided.

vladfrangu added 2 commits Apr 23, 2019
package.json Outdated Show resolved Hide resolved
iCrawl and others added 2 commits Apr 23, 2019
misc: Update lint script to lint ts files
Co-Authored-By: vladfrangu <kingdgrizzle@gmail.com>
@appellation
Copy link
Member

left a comment

It might be worth parameterizing the type of thisArg for methods that use it. e.g.

public each<T>(fn: (this: T, value: V, key: K, collection: Map<K, V>) => void, thisArg?: T): this {

(have not confirmed the above example works as is)

src/index.ts Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
vladfrangu added 5 commits Apr 23, 2019
src/index.ts Show resolved Hide resolved
src: I seem to have bad decision making at night
Move the getter to a class field
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
@Ayplow

This comment has been minimized.

Copy link

commented Aug 13, 2019

If you don't want to, I can do the PR myself, but I thought it fit quite well in this one - The types of the predicate methods can all be improved;

interface Array<T> {
    filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[];
    map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
    filter(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
}

The types for the filter/find/map//mapValues/findKey/partition can all be improved like this. It allows stuff like channels.find((c): c is TextChannel => c.type === "text).send()

src/index.ts Outdated Show resolved Hide resolved
tsconfig.json Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
vladfrangu and others added 8 commits Sep 3, 2019
src: Implement PR #7
Co-authored-by: Xetera <mythologyali@gmail.com>
src: Implement PR #8
Co-authored-by: 1Computer1 <onecomputer00@gmail.com>

@vladfrangu vladfrangu force-pushed the vladfrangu:ts branch from 84bd76e to 0d98653 Sep 4, 2019

vladfrangu added 4 commits Sep 4, 2019
src: Fix Travis for TS 3.6.2
The code before this commit works in TS 3.7.0-dev.20190903
@iCrawl
iCrawl approved these changes Sep 4, 2019
src/index.ts Show resolved Hide resolved

@iCrawl iCrawl merged commit 3ab2cec into discordjs:master Sep 4, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.