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

Simplify PromisedThrow types in chai-as-promised #37292

Merged
merged 1 commit into from Aug 1, 2019

Conversation

@pimterry
Copy link
Contributor

commented Aug 1, 2019

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes:

This change simplifies the types without really changing them, but is required because function overloads do not nicely combine in TypeScript as you might expect. See microsoft/TypeScript#14107 for some background on this. In the following code for example, the last line is an error:

function f(arg: RegExp): void;
function f(arg: string): void;
function f() {}

f('hi');
f(/hi/);
f(Math.random() > 0.5 ? /hi/ : 'hi');

(Playground demo)

Even though the overloads can accept a string or a RegExp, they cannot accept string | RegExp. The same is true here. The fix for this is to combine the overloads, and that conveniently also simplifies the types too.

@typescript-bot

This comment has been minimized.

Copy link
Contributor

commented Aug 1, 2019

👋 Hi there! I’ve run some quick performance metrics against master and your PR. This is still an experiment, so don’t panic if I say something crazy! I’m still learning how to interpret these metrics.

Let’s review the numbers, shall we?

Comparison details 📊
master #37292 diff
Batch compilation
Memory usage (MiB) 81.2 80.9 -0.4%
Type count 10393 10392 0.0%
Assignability cache size 33956 33956 0.0%
Subtype cache size 31 30 -3.2%
Identity cache size 17 17 0.0%
Language service
Samples taken 301 301 0.0%
Identifiers in tests 301 301 0.0%
getCompletionsAtPosition
    Mean duration (ms) 346.8 403.0 +16.2%
    Median duration (ms) 345.1 398.9 +15.6%
    Mean CV 14.1% 13.9% -1.8%
    Worst duration (ms) 457.0 514.3 +12.5%
    Worst identifier be equal
getQuickInfoAtPosition
    Mean duration (ms) 333.7 389.5 +16.7%
    Median duration (ms) 331.4 388.4 +17.2%
    Mean CV 14.3% 14.1% -1.7%
    Worst duration (ms) 455.8 533.5 +17.0%
    Worst identifier should equal
System information
Node version v10.16.0 v10.16.0
CPU count 2 2
CPU speed 2.294 GHz 2.397 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
CPU Architecture x64 x64
Memory 6.8 GiB 6.8 GiB
Platform linux linux
Release 4.15.0-1047-azure 4.15.0-1047-azure

First off, note that the system varied slightly between these two runs, so you’ll have to take these measurements with a grain of salt.

It looks like nothing changed too much. I’m pretty lenient since I’m still an experiment, so take a look anyways and make sure nothing looks out of place.


If you have any questions or comments about me, you can ping @andrewbranch. Have a nice day!

@typescript-bot

This comment has been minimized.

Copy link
Contributor

commented Aug 1, 2019

@pimterry Thank you for submitting this PR!

🔔 @jt000 @Kuniwak @leonard-thieu @lazerwalker @mattbishop - 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.

@typescript-bot typescript-bot moved this from Waiting for Reviewers to Check and Merge in Pull Request Status Board Aug 1, 2019

@typescript-bot

This comment has been minimized.

Copy link
Contributor

commented Aug 1, 2019

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!

@jessetrinity jessetrinity merged commit ea1017f into DefinitelyTyped:master Aug 1, 2019

3 checks passed

DefinitelyTyped.BenchmarkPR Build #10622 succeeded
Details
DefinitelyTyped.DefinitelyTyped Build #20190801.29 succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

Pull Request Status Board automation moved this from Check and Merge to Done Aug 1, 2019

@typescript-bot

This comment has been minimized.

Copy link
Contributor

commented Aug 1, 2019

iRON5 pushed a commit to iRON5/DefinitelyTyped that referenced this pull request Aug 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.