From cfc40da29bebbe9adfc83c918dee9b4522ef3e16 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Tue, 15 Sep 2015 05:41:40 +0900 Subject: [PATCH] Add react-props-decorators@0.1.0 --- .../react-props-decorators-tests.ts | 17 ++++++++++++++ .../react-props-decorators-tests.ts.tscparams | 1 + .../react-props-decorators.d.ts | 23 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 react-props-decorators/react-props-decorators-tests.ts create mode 100644 react-props-decorators/react-props-decorators-tests.ts.tscparams create mode 100644 react-props-decorators/react-props-decorators.d.ts diff --git a/react-props-decorators/react-props-decorators-tests.ts b/react-props-decorators/react-props-decorators-tests.ts new file mode 100644 index 000000000..6ba9b7cef --- /dev/null +++ b/react-props-decorators/react-props-decorators-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +import React from 'react'; +import { propTypes, defaultProps } from 'react-props-decorators'; + +@propTypes({ + foo: React.PropTypes.string, + bar: React.PropTypes.number +}) +@defaultProps({ + foo: "defaultString", + bar: 100 +}) +class Baz extends React.Component { + /* ... */ +} diff --git a/react-props-decorators/react-props-decorators-tests.ts.tscparams b/react-props-decorators/react-props-decorators-tests.ts.tscparams new file mode 100644 index 000000000..3f0863ac6 --- /dev/null +++ b/react-props-decorators/react-props-decorators-tests.ts.tscparams @@ -0,0 +1 @@ +--experimentalDecorators --noImplicitAny --target ES5 diff --git a/react-props-decorators/react-props-decorators.d.ts b/react-props-decorators/react-props-decorators.d.ts new file mode 100644 index 000000000..98edc9884 --- /dev/null +++ b/react-props-decorators/react-props-decorators.d.ts @@ -0,0 +1,23 @@ +// Type definitions for react-props-decorators +// Project: https://github.com/popkirby/react-props-decorators +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "react-props-decorators" { + import * as React from 'react'; + + export interface ClassDecorator { + (target:TFunction): TFunction|void; + } + + var propTypes: (map: React.ValidationMap) => ClassDecorator; + var defaultProps: (defaultProps: any) => ClassDecorator; + + export { + propTypes, + defaultProps + } +} +