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

Strongly typed generatePath from react-router #50295

Merged
merged 3 commits into from Dec 28, 2020

Conversation

apieceofbart
Copy link
Contributor

Please fill in this template.

Select one of these and delete the others:

If adding a new definition:

  • The package does not already provide its own types, or cannot have its .d.ts files generated via --declaration
  • If this is for an npm package, match the name. If not, do not conflict with the name of an npm package.
  • Create it with dts-gen --dt, not by basing it on an existing project.
  • Represents shape of module/library correctly
  • tslint.json should contain { "extends": "dtslint/dt.json" }, and no additional rules.
  • tsconfig.json should have noImplicitAny, noImplicitThis, strictNullChecks, and strictFunctionTypes set to true.

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: <>
  • 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 removing a declaration:

  • If a package was never on Definitely Typed, you don't need to do anything. (If you wrote a package and provided types, you don't need to register it with us.)
  • Delete the package's directory.
  • Add it to notNeededPackages.json.

@typescript-bot typescript-bot added Critical package Check Config Changes a module config files labels Dec 27, 2020
@typescript-bot typescript-bot added this to Waiting for Code Reviews in New Pull Request Status Board Dec 27, 2020
@typescript-bot
Copy link
Contributor

typescript-bot commented Dec 27, 2020

@apieceofbart Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.

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 passed
  • ❌ 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.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 50295,
  "author": "apieceofbart",
  "headCommitAbbrOid": "f10e624",
  "headCommitOid": "f10e6243343b87d6f21cde9a90e057f2e1f93b42",
  "lastPushDate": "2020-12-27T21:38:11.000Z",
  "lastActivityDate": "2020-12-28T09:19:24.000Z",
  "maintainerBlessed": false,
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "react-router",
      "kind": "edit",
      "files": [
        {
          "path": "types/react-router/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react-router/package.json",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/react-router/test/generatePath.ts",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react-router/ts4.0/test/Children.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/InheritingRoute.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/MemoryRouter.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/NavigateWithContext.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/Prompt.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/RouterContext.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/Switch.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/WithRouter.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/Ambiguous.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/Animation.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/Auth.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/Basic.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/CustomLink.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/ModalGallery.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/NoMatch.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/Params.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/PreventingTransitions.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/README.md",
          "kind": "markdown"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/Recursive.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/RouteConfig.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/Sidebar.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/examples-from-react-router-website/StaticRouter.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/test/hooks.tsx",
          "kind": "test"
        },
        {
          "path": "types/react-router/ts4.0/tsconfig.json",
          "kind": "package-meta",
          "suspect": "not [the required form](https://github.com/DefinitelyTyped/DefinitelyTyped#user-content-tsconfigjson)"
        },
        {
          "path": "types/react-router/ts4.0/tslint.json",
          "kind": "package-meta",
          "suspect": "not [the required form](https://github.com/DefinitelyTyped/DefinitelyTyped#user-content-linter-tslintjson)"
        },
        {
          "path": "types/react-router/tsconfig.json",
          "kind": "package-meta-ok"
        }
      ],
      "owners": [
        "sergey-buturlakin",
        "mrk21",
        "vasek17",
        "ngbrown",
        "awendland",
        "KostyaEsmukov",
        "johnnyreilly",
        "LKay",
        "DovydasNavickas",
        "huy-nguyen",
        "grmiade",
        "DaIgeb",
        "egorshulga",
        "rraina",
        "t49tran",
        "8enSmith",
        "wezleytsai",
        "eps1lon",
        "HipsterBrown",
        "pawfa"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "eps1lon",
      "date": "2020-12-28T09:19:24.000Z",
      "isMaintainer": false
    }
  ],
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

🔔 @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @huy-nguyen @Grmiade @DaIgeb @egorshulga @rraina @t49tran @8enSmith @wezleytsai @eps1lon @HipsterBrown @pawfa — 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 Dec 27, 2020
@apieceofbart
Copy link
Contributor Author

There's an issue with older version of typescript. Please check this comment
Help would be appreciated

@apieceofbart apieceofbart changed the title Strongly type generatePath from react-router Strongly typed generatePath from react-router Dec 27, 2020
@typescript-bot
Copy link
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

Comparison details 📊
master #50295 diff
Batch compilation
Memory usage (MiB) 177.8 180.6 +1.6%
Type count 45145 45221 0%
Assignability cache size 14614 14637 0%
Language service
Samples taken 788 788 0%
Identifiers in tests 2029 2039 0%
getCompletionsAtPosition
    Mean duration (ms) 978.1 979.6 +0.2%
    Mean CV 7.8% 7.5%
    Worst duration (ms) 1326.6 1372.7 +3.5%
    Worst identifier props props
getQuickInfoAtPosition
    Mean duration (ms) 949.6 948.7 -0.1%
    Mean CV 7.5% 7.4%
    Worst duration (ms) 1313.6 1268.2 -3.5%
    Worst identifier i props

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added the Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. label Dec 27, 2020
Copy link
Collaborator

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

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

testing from 4.1 to 4.2 in /home/runner/work/DefinitelyTyped/DefinitelyTyped/types/react-router

-- https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50295/checks?check_run_id=1614952244#step:5:153

Looks good 👍

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Dec 28, 2020
@johnnyreilly johnnyreilly merged commit 39e9091 into DefinitelyTyped:master Dec 28, 2020
@typescript-bot typescript-bot removed this from Needs Maintainer Review in New Pull Request Status Board Dec 28, 2020
@johnnyreilly
Copy link
Member

This a really exciting addition BTW - well done!

@typescript-bot
Copy link
Contributor

I just published @types/react-router@5.1.9 to npm.

kaznovac pushed a commit to kaznovac/DefinitelyTyped that referenced this pull request Mar 2, 2021
* react-router-issue-50142: add folder for typescript 4.0 and below and copy existing types there

* react-router-issue-50142: add tests for generatePath

* react-router-issue-50142: rever removing typescript version in root index.d.ts

Co-authored-by: Bartek Kozera <bartek.kozera@du.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Check Config Changes a module config files Critical package Owner Approved A listed owner of this package signed off on the pull request. Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants