Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#69120 [create-react-class] Replace usage o…
Browse files Browse the repository at this point in the history
…f deprecated types related to propTypes with their counterpart from the prop-types package by @eps1lon
  • Loading branch information
eps1lon authored Mar 23, 2024
1 parent 5ce839b commit e1386bb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 2 additions & 3 deletions types/create-react-class/create-react-class-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
import type * as PropTypes from "prop-types";
import * as DOM from "react-dom-factories";
import createReactClass = require("create-react-class");

Expand Down Expand Up @@ -97,7 +96,7 @@ const ClassicComponentNoState: createReactClass.ClassicComponentClass<{ text: st

const displayName: string | undefined = ClassicComponent.displayName;
const defaultProps: Props = ClassicComponent.getDefaultProps ? ClassicComponent.getDefaultProps() : {} as Props;
const propTypes: React.ValidationMap<Props> | undefined = ClassicComponent.propTypes;
const propTypes: PropTypes.ValidationMap<Props> | undefined = ClassicComponent.propTypes;

//
// Component API
Expand Down
9 changes: 5 additions & 4 deletions types/create-react-class/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, ComponentClass, ComponentLifecycle, ReactNode, ValidationMap } from "react";
import type * as PropTypes from "prop-types";
import { Component, ComponentClass, ComponentLifecycle, ReactNode } from "react";

declare namespace createReactClass {
interface Mixin<P, S> extends ComponentLifecycle<P, S> {
Expand All @@ -8,9 +9,9 @@ declare namespace createReactClass {
} | undefined;

displayName?: string | undefined;
propTypes?: ValidationMap<any> | undefined;
contextTypes?: ValidationMap<any> | undefined;
childContextTypes?: ValidationMap<any> | undefined;
propTypes?: PropTypes.ValidationMap<any> | undefined;
contextTypes?: PropTypes.ValidationMap<any> | undefined;
childContextTypes?: PropTypes.ValidationMap<any> | undefined;

getDefaultProps?(): P;
getInitialState?(): S;
Expand Down
3 changes: 2 additions & 1 deletion types/create-react-class/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"https://facebook.github.io/react/"
],
"dependencies": {
"@types/react": "*"
"@types/react": "*",
"@types/prop-types": "*"
},
"devDependencies": {
"@types/create-react-class": "workspace:.",
Expand Down

0 comments on commit e1386bb

Please sign in to comment.