Skip to content

Runtime helpers to support TypeScript type checking of React code

License

Notifications You must be signed in to change notification settings

mattmccutchen/react-typescript-helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-typescript-helpers

Runtime helpers to support TypeScript type checking of React code.

Currently provided: asDefaultProps and asPropTypes. Example:

import * as React from "react";
import * as PropTypes from "prop-types";
import { asDefaultProps, asPropTypes } from "./index";

class MyComponentClass extends React.Component<{name: string}> {
    static defaultProps = asDefaultProps(MyComponentClass)({
        name: "Matt"
    });
    static propTypes = asPropTypes(MyComponentClass)({
        name: PropTypes.string.isRequired
    });
}

About

Runtime helpers to support TypeScript type checking of React code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published