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

[node]: Base promisify signature on rest arguments and conditional types #49699

Closed

Conversation

AlCalzone
Copy link
Contributor

@AlCalzone AlCalzone commented Nov 20, 2020

Please fill in this template.

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: (see comment below)
  • If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the header.
  • If you are making substantial changes, consider adding a tslint.json containing { "extends": "dtslint/dt.json" }. If for reason the any rule need to be disabled, disable it for that line using // tslint:disable-next-line [ruleName] and not for whole package so that the need for disabling can be reviewed.

I was asked to create this PR here based on the discussion in microsoft/TypeScript#41563 (comment)

@DanielRosenwasser mentioned that he isn't sure how to feel about the helper types - how to avoid leaking them into the global scope when the new type declarations are used?

I'm not sure if all the config changes are correct - lots of things to shuffle around just to add something for a newer TypeScript version.
And I'm not happy about is that the helper type Promisify is exposed as the return type - is there any way to resolve to the function signature it represents?

@typescript-bot
Copy link
Contributor

typescript-bot commented Nov 20, 2020

@AlCalzone Thank you for submitting this PR!

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

Status

  • ❌ No merge conflicts
  • ❌ Continuous integration tests have failed
  • 🕐 A DT maintainer needs to approve changes which affect module config files

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.

Inactive

This PR has been inactive for 31 days — it is considered abandoned, and therefore closed!


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 49699,
  "author": "AlCalzone",
  "headCommitOid": "139c1679ecb5c2a475639582b7a312e4e7a1cde5",
  "lastPushDate": "2021-01-15T23:24:04.000Z",
  "lastActivityDate": "2021-04-02T09:04:01.000Z",
  "maintainerBlessed": false,
  "hasMergeConflict": true,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "node",
      "kind": "edit",
      "files": [
        {
          "path": "types/node/base.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/package.json",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/node/test/util.ts",
          "kind": "test"
        },
        {
          "path": "types/node/ts3.4/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/ts3.4/util.promisify.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/ts3.6/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/ts3.9/base.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/ts3.9/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/ts3.9/node-tests.ts",
          "kind": "test"
        },
        {
          "path": "types/node/ts3.9/tsconfig.json",
          "kind": "package-meta",
          "suspect": "not [the expected form](https://github.com/DefinitelyTyped/DefinitelyTyped#user-content-tsconfigjson)"
        },
        {
          "path": "types/node/ts3.9/tslint.json",
          "kind": "package-meta",
          "suspect": "not [the expected form](https://github.com/DefinitelyTyped/DefinitelyTyped#user-content-linter-tslintjson)"
        },
        {
          "path": "types/node/util.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/util.promisify.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "Microsoft",
        "DefinitelyTyped",
        "jkomyno",
        "alvis",
        "r3nya",
        "btoueg",
        "smac89",
        "touffy",
        "DeividasBakanas",
        "eyqs",
        "Hannes-Magnusson-CK",
        "KSXGitHub",
        "hoo29",
        "kjin",
        "ajafff",
        "islishude",
        "mwiktorczyk",
        "mohsen1",
        "n-e",
        "galkin",
        "parambirs",
        "eps1lon",
        "SimonSchick",
        "ThomasdenH",
        "WilcoBakker",
        "wwwy3y3",
        "samuela",
        "kuehlein",
        "bhongy",
        "chyzwar",
        "trivikr",
        "nguymin4",
        "yoursunny",
        "qwelias",
        "ExE-Boss",
        "Ryan-Willpower",
        "peterblazejewicz",
        "addaleax",
        "JasonHK",
        "victorperin",
        "ZYSzys"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "ExE-Boss",
      "date": "2021-02-08T09:16:43.000Z",
      "isMaintainer": false
    },
    {
      "type": "stale",
      "reviewer": "rbuckton",
      "date": "2020-12-08T01:35:34.000Z",
      "abbrOid": "54b22fd"
    }
  ],
  "ciResult": "fail",
  "ciUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/commit/139c1679ecb5c2a475639582b7a312e4e7a1cde5/checks?check_suite_id=1839569975"
}

@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Nov 20, 2020
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board Nov 20, 2020
@typescript-bot
Copy link
Contributor

@AlCalzone The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@typescript-bot typescript-bot added Check Config Changes a module config files and removed The CI failed When GH Actions fails labels Nov 29, 2020
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Nov 29, 2020
@AlCalzone AlCalzone changed the title [node]: (WIP) base promisify signature on rest arguments [node]: Base promisify signature on rest arguments and conditional types Nov 29, 2020
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Nov 29, 2020
types/node/ts3.4/util.d.ts Outdated Show resolved Hide resolved
@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Nov 29, 2020
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Needs Author Action in New Pull Request Status Board Nov 29, 2020
@typescript-bot
Copy link
Contributor

@AlCalzone One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits or comments. If you disagree with the reviewer's comments, you can "dismiss" the review using GitHub's review UI. Thank you!

@AlCalzone
Copy link
Contributor Author

AlCalzone commented Nov 29, 2020

You just need to override the promisify function.

That would be simpler, but wouldn't that just add another overload instead of replacing the existing ones?

@typescript-bot typescript-bot removed the Revision needed This PR needs code changes before it can be merged. label Nov 29, 2020
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Nov 29, 2020
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Nov 29, 2020
@typescript-bot
Copy link
Contributor

@ExE-Boss Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@ExE-Boss
Copy link
Contributor

You just need to override the promisify function.

That would be simpler, but wouldn't that just add another overload instead of replacing the existing ones?

You can do what’s being done with the globals.global.d.ts file to provide different definitions of declare var global between TypeScript 3.7+ and TypeScript ≤3.6 by utilising util.promisify.d.ts.

@AlCalzone
Copy link
Contributor Author

@ExE-Boss I've tried what you suggested - hope it is correct this time. All the interdependencies between the different types-versions are confusing.

I've also solved the problem that promisify returned Promisify<...> instead of the function signature type.

@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Code Reviews in New Pull Request Status Board Dec 1, 2020
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Dec 1, 2020
Comment on lines +1 to +8
// NOTE: These definitions support NodeJS and TypeScript 3.5 - 3.6.
// This is required to enable typing assert in ts3.7 without causing errors
// Typically type modifications should be made in base.d.ts instead of here

/// <reference path="base.d.ts" />

/// <reference path="../ts3.4/assert.d.ts" />
/// <reference path="../ts3.4/util.promisify.d.ts" />
Copy link
Contributor

@ExE-Boss ExE-Boss Dec 2, 2020

Choose a reason for hiding this comment

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

This file and directory is probably unnecessary, since util.promisify.d.ts doesn’t differ between ts3.4 and ts3.9.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a way to limit the signature to TS 4.0+ without it?

Copy link
Contributor Author

@AlCalzone AlCalzone Dec 2, 2020

Choose a reason for hiding this comment

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

I thought the ts3.6 directory exists because TS 3.7 added some new features that are being used. This should be the same - new feature starting with TS 4.0?

Copy link
Collaborator

@rbuckton rbuckton Dec 8, 2020

Choose a reason for hiding this comment

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

I think the point @AlCalzone is trying to make here is that ts3.4/util.promisify.d.ts isn't included in the set of referenced files (it is referenced by ts3.6/index.d.ts but not by ts3.6/base.d.ts).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Honestly, I'm not sure what to do here.
There are some existing definitions that should be active for TS >= 3.7 (thus the 3.6 directory).
Then there are the new promisify signatures which should be active for TS >= 4.0.
And there are the old promisify signatures which need to be available for all versions <= 3.9.

I got it to work the way it is now, but if this is not the correct way, I'm happy to change it.

types/node/util.promisify.d.ts Outdated Show resolved Hide resolved
@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Dec 8, 2020
@AlCalzone AlCalzone closed this Feb 8, 2021
@AlCalzone AlCalzone reopened this Feb 8, 2021
@typescript-bot typescript-bot removed the Abandoned This PR had no activity for a long time, and is considered abandoned label Feb 8, 2021
@AlCalzone
Copy link
Contributor Author

@rbuckton @ExE-Boss I think everything should be addressed now

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Feb 8, 2021
@ankon
Copy link
Contributor

ankon commented Feb 10, 2021

The PR will be closed on Mar 10th (in a week) if the issues aren't addressed.

Out of interest: Where would one report issues with the bot seemingly not being able to read a calendar?

@AlCalzone
Copy link
Contributor Author

Mar 10th (in a week)

Hah, good old JavaScript with its 0-based monts 😏

@jablko
Copy link
Contributor

jablko commented Feb 10, 2021

@ankon I opened DefinitelyTyped/dt-mergebot#364 to fix the calendar bug you spotted, which is my fault. Sorry about that!

@typescript-bot typescript-bot added the Abandoned This PR had no activity for a long time, and is considered abandoned label Mar 5, 2021
@typescript-bot
Copy link
Contributor

@AlCalzone I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Mar 12th (in a week) if the issues aren't addressed.

@AlCalzone
Copy link
Contributor Author

Which issues though? This is waiting for a re-review.

@typescript-bot typescript-bot removed the Abandoned This PR had no activity for a long time, and is considered abandoned label Mar 5, 2021
@AlCalzone
Copy link
Contributor Author

@rbuckton got time for a re-review?

@typescript-bot typescript-bot added the Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. label Mar 9, 2021
@typescript-bot
Copy link
Contributor

@AlCalzone Unfortunately, this pull request currently has a merge conflict 😥. Please update your PR branch to be up-to-date with respect to master. Have a nice day!

@AlCalzone
Copy link
Contributor Author

🤷🏻‍♂️

@typescript-bot typescript-bot added the Abandoned This PR had no activity for a long time, and is considered abandoned label Apr 2, 2021
@typescript-bot
Copy link
Contributor

@AlCalzone I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Apr 8th (in a week) if the issues aren't addressed.

@AlCalzone
Copy link
Contributor Author

I don't care anymore. I was asked by a TS developer to raise this PR, yet I can't get anyone to review it and now I need to start from scratch because of the merge conflicts.

Do what you want with it, I'll ignore this thread now.

@typescript-bot typescript-bot removed the Abandoned This PR had no activity for a long time, and is considered abandoned label Apr 2, 2021
@typescript-bot
Copy link
Contributor

@AlCalzone I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on May 2nd (in a week) if the issues aren't addressed.

@typescript-bot typescript-bot added the Abandoned This PR had no activity for a long time, and is considered abandoned label Apr 25, 2021
@typescript-bot typescript-bot removed this from Needs Author Action in New Pull Request Status Board May 3, 2021
@typescript-bot
Copy link
Contributor

@AlCalzone To keep things tidy, we have to close PRs that aren't mergeable and don't have activity in the last month. No worries, though — please open a new PR if you'd like to continue with this change. Thank you!

@OmgImAlexis
Copy link
Contributor

@AlCalzone don't mean to annoy you with this ping but is there any chance I could assist in getting this re-opened and merged? This is the first time I've managed to find a working version of promisify with typescript.

@AlCalzone
Copy link
Contributor Author

@OmgImAlexis if you like, you can try to put up an up-to-date PR with my changes. I'll gladly assist if there are any problems with my types, but I don't have the capacity to jump through these hoops again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Abandoned This PR had no activity for a long time, and is considered abandoned Check Config Changes a module config files Critical package Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. Owner Approved A listed owner of this package signed off on the pull request. The CI failed When GH Actions fails
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants