Skip to content

Cleanup 2019 part 1#33278

Merged
sandersn merged 3 commits into
masterfrom
dt-cleanup-2019-part-1
Feb 21, 2019
Merged

Cleanup 2019 part 1#33278
sandersn merged 3 commits into
masterfrom
dt-cleanup-2019-part-1

Conversation

@sandersn

Copy link
Copy Markdown
Contributor

baidu-app: Not sure how this worked before. Taking away the extra thunk doesn't break any tests.

bluebird-tests:

  1. throw now correctly returns never instead of passing through the original type.
  2. Bluebird is invariant on R now. Not sure why. Could be bad?

cordova-sqlite-storage: Just a project ownership change.

d3-array: return-type inference seems higher priority than before, or maybe index access types. Probably not a big deal since I think people usually don't specify types for variable declarations.

Part 2 will fix ember.

baidu-app: Not sure what is wrong here. Taking away the extra thunk
doesn't break any tests, though.

bluebird-tests: Bluebird is invariant on R now. Not sure why. Could be bad?

cordova-sqlite-storage: Just a project ownership change.

d3-array: return-type inference seems higher priority than before.
Probably not a big deal since I think people usually don't specify types
for variable declarations.
@sandersn

Copy link
Copy Markdown
Contributor Author

@weswigham you might want to take a look at bluebird since I don't understand why it wasn't invariant before.

Same for baidu, although there I have no idea what changed.

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). Awaiting reviewer feedback labels Feb 21, 2019
@typescript-bot

typescript-bot commented Feb 21, 2019

Copy link
Copy Markdown
Contributor

@sandersn Thank you for submitting this PR!

🔔 @taoqf @lhecker @rafw87 @gustavderdrache @borisyankov @tomwanzek @denisname - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@lhecker

lhecker commented Feb 21, 2019

Copy link
Copy Markdown
Contributor

@sandersn - only in case you have time: Can you elaborate what you mean with "Bluebird is invariant on R now."? I’m familiar with invariants from math, but I’m not sure how they fit to your sentence.

I can’t comment on the changes tobaidu-app, but the rest LGTM. 👍

@sandersn

Copy link
Copy Markdown
Contributor Author

@lhecker The term comes from variance in type theory. That a type T is invariant on a parameter P means that T<P> can only be assigned to exactly T<P>.

In this example, previously bluebird's Promise<Derived> was assignable to Promise<Base> but is now only assignable to Promise<Derived>. No subclasses or superclasses of Derived will work.

This is simpler, but might break some users of bluebird.

The change is due to microsoft/TypeScript#29817.

@typescript-bot typescript-bot added Owner Approved A listed owner of this package signed off on the pull request. Merge:Express and removed Awaiting reviewer feedback labels Feb 21, 2019
@typescript-bot

Copy link
Copy Markdown
Contributor

A definition owner has approved this PR ⭐️. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped!

@lhecker

lhecker commented Feb 21, 2019

Copy link
Copy Markdown
Contributor

@sandersn Thanks! I'll try to remember the nomenclature this time. 😄

Although I do have to agree with you... That might be pretty bad for Bluebird or even TS in general. Are you (or the original author @weswigham) sure such a change isn't a bit too serious?

I mean the following is broken in the newest nightly, but works using the current release.
IMO this should continue to be legal code... (Edit: I mean this code with Bluebird in particular.)

import Bluebird from "bluebird";

class Base {
    base: string;
}

class Derived extends Base {
    derived: number;
}

// Error on the next line:
//   Type 'Bluebird<Derived>' is not assignable to type 'Bluebird<Base>'.
const promise: Bluebird<Base> = Bluebird.resolve(new Derived);
promise.then(instance => console.log(instance.base));

Either way... If this change does land in a release will it be part of TS 3?

@sandersn

Copy link
Copy Markdown
Contributor Author

@lhecker Yeah, I think that bluebird should be fixed and that my change to the tests is wrong. I'm not sure whether the fix should be in typescript or in bluebird's definitions.

@sandersn

Copy link
Copy Markdown
Contributor Author

I'm going to revert the bluebird changes until I can talk to @weswigham about the right fix here.

@sandersn sandersn merged commit 395ed44 into master Feb 21, 2019
@sandersn sandersn deleted the dt-cleanup-2019-part-1 branch February 21, 2019 22:07
@typescript-bot

Copy link
Copy Markdown
Contributor

I just published @types/[email protected] to npm.

@typescript-bot

Copy link
Copy Markdown
Contributor

I just published @types/[email protected] to npm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Owner Approved A listed owner of this package signed off on the pull request. Popular package This PR affects a popular package (as counted by NPM download counts).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants