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

[jest] type done callback on each #63882

Merged
merged 3 commits into from Mar 15, 2023

Conversation

staff0rd
Copy link
Contributor

Select one of these and delete the others:

If changing an existing definition:

Note

I also added a test case for ReadonlyArray declaration, however I was unable to fix it for the done callback as the variadic tuple approach doesn't appear to work there, ie:

<T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): (
            name: string,
            fn: (...t: [...args: T, done: DoneCallback) => any,  // results in arguments being typed T | DoneCallback
            timeout?: number,
        ) => void;

@typescript-bot
Copy link
Contributor

typescript-bot commented Jan 11, 2023

@staff0rd 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.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by a DT maintainer

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 63882,
  "author": "staff0rd",
  "headCommitOid": "8fa31a2aa6603a68dd6dfbff5a5fe6a0d4a6e6f8",
  "mergeBaseOid": "0e64955901599be1e43a2e50c556d141a2b8fdd8",
  "lastPushDate": "2023-02-22T11:15:37.000Z",
  "lastActivityDate": "2023-03-15T05:12:36.000Z",
  "mergeOfferDate": "2023-03-13T20:00:55.000Z",
  "mergeRequestDate": "2023-03-15T05:12:36.000Z",
  "mergeRequestUser": "mrazauskas",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "jest",
      "kind": "edit",
      "files": [
        {
          "path": "types/jest/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/jest/jest-tests.ts",
          "kind": "test"
        }
      ],
      "owners": [
        "NoHomey",
        "jwbay",
        "asvetliakov",
        "alexjoverm",
        "epicallan",
        "ikatyang",
        "wsmd",
        "JamieMason",
        "douglasduteil",
        "ahnpnl",
        "UselessPickles",
        "r3nya",
        "hotell",
        "sebald",
        "andys8",
        "antoinebrault",
        "gstamac",
        "ExE-Boss",
        "quassnoi",
        "Belco90",
        "tonyhallett",
        "ycmjason",
        "pawfa",
        "gerkindev",
        "domdomegg",
        "mrazauskas"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "jakebailey",
      "date": "2023-03-13T20:00:07.000Z",
      "isMaintainer": true
    },
    {
      "type": "approved",
      "reviewer": "mrazauskas",
      "date": "2023-03-13T17:57:46.000Z",
      "isMaintainer": false
    },
    {
      "type": "approved",
      "reviewer": "domdomegg",
      "date": "2023-03-05T18:15:35.000Z",
      "isMaintainer": false
    }
  ],
  "mainBotCommentID": 1378750382,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

🔔 @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @ahnpnl @UselessPickles @r3nya @Hotell @sebald @andys8 @antoinebrault @gstamac @ExE-Boss @quassnoi @Belco90 @tonyhallett @ycmjason @pawfa @GerkinDev @domdomegg @mrazauskas — 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.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Jan 11, 2023
@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Jan 11, 2023
@mrazauskas
Copy link
Contributor

Hm.. I just tried to implement this in Jest’s building typings and found out that following case current works, but fails after this change is made:

test.each([
    [
        { supportsDynamicImport: true, supportsStaticESM: true },
        { supportsDynamicImport: true, supportsStaticESM: true },
    ],
    [{ supportsDynamicImport: true }, { supportsDynamicImport: true, supportsStaticESM: false }],
])('%j -> %j', (input, output) => {
    console.log(input);
    console.log(output);
});

This and few more type errors surfaced in Jest repo. See CI failures in jestjs/jest#13756

Copy link
Contributor

@mrazauskas mrazauskas left a comment

Choose a reason for hiding this comment

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

Posting this 'request changes' review just to draw attention to the problem mentioned above. Jest repo does not use @types/jest, but this PR has the same issue which surfaced in the above mentioned PR. For example:

test.each([
  ['Boolean', {automock: []}],
  ['Array', {coverageReporters: {}}],
  ['String', {preset: 1337}],
  ['Object', {haste: 42}],

// requires to add this type cast, if change from this PR is implemented
// currently type check is passing without the cast

] as Array<[string, Record<string, unknown>]>)(
  'pretty prints valid config for %s',
  (_type, config) => {
    expect(() =>
      validate(config, {
        exampleConfig: validConfig,
      }),
    ).toThrowErrorMatchingSnapshot();
  },
);

@typescript-bot typescript-bot added Revision needed This PR needs code changes before it can be merged. and removed Owner Approved A listed owner of this package signed off on the pull request. labels Jan 11, 2023
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Needs Author Action in New Pull Request Status Board Jan 11, 2023
@typescript-bot
Copy link
Contributor

@staff0rd 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. Thank you!

@mrazauskas
Copy link
Contributor

@staff0rd Partial support for done callback typings just landed in Jest repo. One dimensional array, array of object literals and template literal table are supported. See jestjs/jest#13756

Perhaps this PR could take similar path for now?

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

@staff0rd 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 Feb 25th (in a week) if the issues aren't addressed.

@typescript-bot typescript-bot removed Revision needed This PR needs code changes before it can be merged. Abandoned This PR had no activity for a long time, and is considered abandoned labels Feb 22, 2023
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Feb 22, 2023
@typescript-bot
Copy link
Contributor

@mrazauskas, @domdomegg 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?

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Feb 22, 2023
@staff0rd
Copy link
Contributor Author

staff0rd commented Feb 22, 2023

@mrazauskas i added the test case you found to be breaking and reduced the typing to not cater for the array-of-arrays syntax

Copy link
Contributor

@mrazauskas mrazauskas left a comment

Choose a reason for hiding this comment

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

Thanks!

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

@domdomegg 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?

@typescript-bot
Copy link
Contributor

typescript-bot commented Mar 5, 2023

Re-ping @NoHomey, @jwbay, @asvetliakov, @alexjoverm, @epicallan, @ikatyang, @wsmd, @JamieMason, @douglasduteil, @ahnpnl, @UselessPickles, @r3nya, @Hotell, @sebald, @andys8, @antoinebrault, @gstamac, @ExE-Boss, @quassnoi, @Belco90, @tonyhallett, @ycmjason, @pawfa, @GerkinDev:

This PR has been out for over a week, yet I haven't seen any reviews.

Could someone please give it some attention? Thanks!

@typescript-bot typescript-bot added the Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. label Mar 5, 2023
@typescript-bot
Copy link
Contributor

It has been more than two weeks and this PR still has no reviews.

I'll bump it to the DT maintainer queue. Thank you for your patience, @staff0rd.

(Ping @NoHomey, @jwbay, @asvetliakov, @alexjoverm, @epicallan, @ikatyang, @wsmd, @JamieMason, @douglasduteil, @ahnpnl, @UselessPickles, @r3nya, @Hotell, @sebald, @andys8, @antoinebrault, @gstamac, @ExE-Boss, @quassnoi, @Belco90, @tonyhallett, @ycmjason, @pawfa, @GerkinDev.)

@typescript-bot typescript-bot moved this from Needs Maintainer Review to Needs Maintainer Action in New Pull Request Status Board Mar 12, 2023
@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner and removed Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. labels Mar 13, 2023
@typescript-bot typescript-bot moved this from Needs Maintainer Action to Waiting for Author to Merge in New Pull Request Status Board Mar 13, 2023
@mrazauskas
Copy link
Contributor

Ready to merge

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in New Pull Request Status Board Mar 15, 2023
@typescript-bot typescript-bot merged commit 6439217 into DefinitelyTyped:master Mar 15, 2023
@mrazauskas
Copy link
Contributor

Thanks again. I just wanted to see this merged finally.

@typescript-bot typescript-bot removed this from Recently Merged in New Pull Request Status Board Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Critical package Maintainer Approved Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants