@types/create-react-class
TypeScript icon, indicating that this package has built-in type declarations

15.6.8 • Public • Published

Installation

npm install --save @types/create-react-class

Summary

This package contains type definitions for create-react-class (https://facebook.github.io/react/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/create-react-class.

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> {
        mixins?: Array<Mixin<P, S>> | undefined;
        statics?: {
            [key: string]: any;
        } | undefined;

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

        getDefaultProps?(): P;
        getInitialState?(): S;
    }

    interface ComponentSpec<P, S> extends Mixin<P, S> {
        render(): ReactNode;

        [propertyName: string]: any;
    }
    interface ClassicComponent<P = {}, S = {}> extends Component<P, S> {
        replaceState(nextState: S, callback?: () => void): void;
        isMounted(): boolean;
        getInitialState?(): S;
    }

    interface ClassicComponentClass<P = {}> extends Omit<ComponentClass<P>, "new"> {
        new(props: P, context?: any): ClassicComponent<P, any>;
        getDefaultProps?(): P;
    }
}
declare function createReactClass<P, S = {}>(
    spec: createReactClass.ComponentSpec<P, S>,
): createReactClass.ClassicComponentClass<P>;

export as namespace createReactClass;
export = createReactClass;

Additional Details

Credits

These definitions were written by John Gozde.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/create-react-class

Weekly Downloads

47,453

Version

15.6.8

License

MIT

Unpacked Size

5.55 kB

Total Files

5

Last publish

Collaborators

  • types