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

[react] Deprecate types that are related to the prop-types package #69002

Merged

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Mar 15, 2024

React 19 will ignore .propTypes which means we no longer have any use for the types related to that.

Turns out that we don't even need most of the related types since these are just aliases to prop-types types. So if you use runtime validation with prop-types and TypeScript, you can continue using the relevant types from prop-types instead of react.

To ease migration, I ported the WeakValidationMap type which was introduced in #31280.

The following types are deprecated:

  • WeakValidationMap
  • ValidationMap
  • Requireable
  • Validator
  • ReactPropTypes

To keep using these types, the following diff is required (can be handled with the deprecated-react-prop-types-types codemod):

+import * as PropTypes from 'prop-types'

-React.WeakValidationMap;
+PropTypes.WeakValidationMap;

-React.ValidationMap;
+PropTypes.ValidationMap;

-React.Requireable;
+PropTypes.Requireable;

-React.Validator;
+PropTypes.Validator;

ReactPropTypes is deprecated without removal. You should pick the relevant validators from PropTypes instead.

Migration away from the deprecated types within DT is illustrated in #69011 which I'll split out into one PR per package.

@typescript-bot
Copy link
Contributor

typescript-bot commented Mar 15, 2024

@eps1lon Thank you for submitting this PR!

This is a live comment which I will keep updated.

2 packages in this PR

Code Reviews

This PR can be merged once it's reviewed.

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

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • 🕐 All owners or a DT maintainer needs to approve changes which affect more than one package
    • 🕐 prop-types
    • 🕐 react

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 7 days.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 69002,
  "author": "eps1lon",
  "headCommitOid": "575b3a778985459b2191f7b185af999673a84002",
  "mergeBaseOid": "b0e683d4a7c4aaa3df73b397dcaa4e80bea25cb6",
  "lastPushDate": "2024-03-15T11:17:05.000Z",
  "lastActivityDate": "2024-03-18T18:45:21.000Z",
  "maintainerBlessed": "Waiting for Code Reviews",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "prop-types",
      "kind": "edit",
      "files": [
        {
          "path": "types/prop-types/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/prop-types/prop-types-tests.ts",
          "kind": "test"
        }
      ],
      "owners": [
        "DovydasNavickas",
        "ferdaber",
        "eps1lon"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    },
    {
      "name": "react",
      "kind": "edit",
      "files": [
        {
          "path": "types/react/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/ts5.0/index.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "johnnyreilly",
        "bbenezech",
        "pzavolinsky",
        "ericanderson",
        "DovydasNavickas",
        "theruther4d",
        "guilhermehubner",
        "ferdaber",
        "jrakotoharisoa",
        "pascaloliv",
        "hotell",
        "franklixuefei",
        "Jessidhia",
        "saranshkataria",
        "lukyth",
        "eps1lon",
        "zieka",
        "dancerphil",
        "dimitropoulos",
        "disjukr",
        "vhfmag",
        "hellatan",
        "priyanshurav",
        "Semigradsky",
        "mattpocock"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [],
  "mainBotCommentID": 2000567435,
  "ciResult": "pass"
}

@typescript-bot typescript-bot added Critical package Edits multiple packages Author is Owner The author of this PR is a listed owner of the package. labels Mar 15, 2024
@typescript-bot typescript-bot moved this from Needs Author Action to Needs Maintainer Review in New Pull Request Status Board Mar 15, 2024
@typescript-bot
Copy link
Contributor

@sheetalkamat sheetalkamat moved this from Needs Maintainer Review to Waiting for Code Reviews in New Pull Request Status Board Mar 18, 2024
@eps1lon
Copy link
Collaborator Author

eps1lon commented Mar 22, 2024

Landing since nobody seems to have an issue with this.

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 Edits multiple packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants