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

fix(unzip): fix Yauzl typings #12

Merged
merged 2 commits into from
Feb 7, 2019
Merged

fix(unzip): fix Yauzl typings #12

merged 2 commits into from
Feb 7, 2019

Conversation

tlancina
Copy link
Contributor

@tlancina tlancina commented Feb 7, 2019

Both open and openReadStream have overloads, so promisify
can't know which one to choose and chooses the last one (which
doesn't include options). Additionally, once we specify those two
overloads, optional args become arg | undefined which is subtly
different than not providing an arg (which is what we want to be
able to do), so we specify onEntry's openReadStream callback
explicitly as well (to have options be optional).

I think this last point is also why we can't just update yauzl's
types to have both options and callback be optional, because
options when promisified will be unioned with undefined, not
optional (meaning you can't just leave it off, you'd have to
actually pass undefined as the value if you want to use it).

microsoft/TypeScript#13570
microsoft/TypeScript#13195

Both `open` and `openReadStream` have overloads, so `promisify`
can't know which one to choose and chooses the last one (which
doesn't include options).  Additionally, once we specify those two
overloads, optional args become `arg | undefined` which is subtly
different than not providing an arg (which is what we want to be
able to do), so we specify onEntry's `openReadStream` callback
explicitly as well (to have options be optional).

I think this last point is also why we can't just update `yauzl`'s
types to have both `options` and `callback` be optional, because
`options` when `promisified` will be unioned with `undefined`, not
optional (meaning you can't just leave it off, you'd have to
actually pass `undefined` as the value if you want to use it).

microsoft/TypeScript#13570
microsoft/TypeScript#13195
Copy link
Contributor

@imhoffd imhoffd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove src/android/utils/.apk.ts.swp?

.vscode/settings.json Outdated Show resolved Hide resolved
@imhoffd imhoffd merged commit 64b2cb4 into master Feb 7, 2019
@imhoffd imhoffd deleted the unzip-types branch February 7, 2019 16:24
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