Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Nov 1, 2023

@DangerBotOSS
Copy link

DangerBotOSS commented Nov 1, 2023

Inspecting the JavaScript source for this package found some properties that are not in the .d.ts files.
The check for missing properties isn't always right, so take this list as advice, not a requirement.

react-dom (unpkg)

was missing the following properties:

  1. createRoot
  2. hydrateRoot

Formatting

The following files are not formatted:

  1. types/react-dom/test/canary-tests.tsx

Consider running pnpm dprint fmt on these files to make review easier.

Generated by 🚫 dangerJS against d823c70

@eps1lon eps1lon marked this pull request as ready for review November 1, 2023 16:23
@eps1lon eps1lon requested a review from Jessidhia as a code owner November 1, 2023 16:23
@typescript-bot
Copy link
Contributor

typescript-bot commented Nov 1, 2023

@eps1lon Thank you for submitting this PR!

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it.

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 type definition owners or DT maintainers

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


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 67266,
  "author": "eps1lon",
  "headCommitOid": "d823c700844a1303aca97d10207b7c6f0af1bf74",
  "mergeBaseOid": "705e209914666815cdbf379eb6ee486cc603bf9f",
  "lastPushDate": "2023-11-01T16:03:02.000Z",
  "lastActivityDate": "2023-11-06T20:34:09.000Z",
  "maintainerBlessed": "Waiting for Code Reviews",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "react-dom",
      "kind": "edit",
      "files": [
        {
          "path": "types/react-dom/canary.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react-dom/test/canary-tests.tsx",
          "kind": "test"
        }
      ],
      "owners": [
        "MartynasZilinskas",
        "theruther4d",
        "Jessidhia",
        "eps1lon"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "unstubbable",
      "date": "2023-11-06T20:34:09.000Z",
      "isMaintainer": false
    }
  ],
  "mainBotCommentID": 1789259088,
  "ciResult": "pass"
}

@typescript-bot typescript-bot added Critical package Author is Owner The author of this PR is a listed owner of the package. labels Nov 1, 2023
@typescript-bot
Copy link
Contributor

🔔 @MartynasZilinskas @theruther4d @Jessidhia — 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.

useFormState(
action,
// @ts-expect-error
Promise.resolve(1),
Copy link
Contributor

Choose a reason for hiding this comment

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

Omitting the Awaited from the initial state does not give me the expected error in this playground? What's the difference to the changes proposed in this PR? Are the tests running with different compiler settings? Or am I overlooking something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yours is also missing the overload. I don't think tests here run with different options. But the diff is too big between my version and yours to say for sure what's happening.

Copy link
Contributor

@unstubbable unstubbable Nov 1, 2023

Choose a reason for hiding this comment

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

I've found the difference in this playground. It does not yield the expected error when using a closure where the action state param type is inferred, instead of explicitly being annotated (as in your action function):

useFormState(async (prevState) => prevState + 1, Promise.resolve(0));

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is now handled since we also wanted to reduce useFormState<Promise<T>> to State being T at every position.

@eps1lon eps1lon requested a review from unstubbable November 5, 2023 09:03
@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Nov 5, 2023
@typescript-bot
Copy link
Contributor

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

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

Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review.

@typescript-bot typescript-bot added The CI failed When GH Actions fails and removed The CI failed When GH Actions fails labels Nov 5, 2023
@typescript-bot
Copy link
Contributor

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

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

Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review.

@typescript-bot typescript-bot added Other Approved This PR was reviewed and signed-off by a community member. The CI failed When GH Actions fails and removed Other Approved This PR was reviewed and signed-off by a community member. The CI failed When GH Actions fails labels Nov 5, 2023
@typescript-bot
Copy link
Contributor

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

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

Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review.

Fixes
```
Error: /home/runner/work/DefinitelyTyped/DefinitelyTyped/types/react-dom/test/canary-tests.tsx:158:9
ERROR: 158:9   expect  [email protected] expected type to be:
  number
got:
  0
ERROR: 158:22  expect  Compile error in [email protected] but not in [email protected].
Fix by adding '"minimumTypeScriptVersion": "5.0"' to package.json.
No overload matches this call.
  Overload 1 of 2, '(action: (state: number) => number | Promise<number>, initialState: number, permalink?: string | undefined): [state: number, dispatch: () => void]', gave the following error.
    Argument of type '(prevState: 0) => Promise<number>' is not assignable to parameter of type '(state: number) => number | Promise<number>'.
      Types of parameters 'prevState' and 'state' are incompatible.
        Type 'number' is not assignable to type '0'.
  Overload 2 of 2, '(action: (state: number, payload: unknown) => number | Promise<number>, initialState: number, permalink?: string | undefined): [state: number, dispatch: (payload: unknown) => void]', gave the following error.
    Argument of type '(prevState: 0) => Promise<number>' is not assignable to parameter of type '(state: number, payload: unknown) => number | Promise<number>'.
      Types of parameters 'prevState' and 'state' are incompatible.
        Type 'number' is not assignable to type '0'.

    at testTypesVersion (/home/runner/work/DefinitelyTyped/DefinitelyTyped/node_modules/.pnpm/@DefinitelyTyped[email protected][email protected]/node_modules/@definitelytyped/dtslint/src/index.ts:202:11)
    at runTests (/home/runner/work/DefinitelyTyped/DefinitelyTyped/node_modules/.pnpm/@DefinitelyTyped[email protected][email protected]/node_modules/@definitelytyped/dtslint/src/index.ts:170:7)
 ELIFECYCLE  Command failed with exit code 1.
```
@eps1lon eps1lon force-pushed the feat/react/sync-actions branch from 8f37f63 to d823c70 Compare November 6, 2023 20:17
@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Nov 6, 2023
@typescript-bot
Copy link
Contributor

@unstubbable 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 added the Other Approved This PR was reviewed and signed-off by a community member. label Nov 6, 2023
@eps1lon eps1lon merged commit 70dd23b into DefinitelyTyped:master Nov 7, 2023
@eps1lon eps1lon deleted the feat/react/sync-actions branch November 7, 2023 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author is Owner The author of this PR is a listed owner of the package. Critical package Other Approved This PR was reviewed and signed-off by a community member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants