Skip to content

Commit

Permalink
prepare repo for typescript definition publish.
Browse files Browse the repository at this point in the history
  • Loading branch information
unexge committed Mar 25, 2017
1 parent b4723c6 commit 26d8f6b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"version": "0.0.4",
"description": "Simple form validation library for React Native.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"prepublish": "npm run build",
"build": "tsc",
"test": "jest"
},
Expand Down
6 changes: 3 additions & 3 deletions src/control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ function isValidationRulesChanged(
return false;
}

interface Props {
export interface Props {
name: string;
children: (control: Control) => JSX.Element;

[validator: string]: any;
};

interface State {
export interface State {
touched: boolean;
};

interface Context {
export interface Context {
form: Form
};

Expand Down
6 changes: 3 additions & 3 deletions src/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { Component, PropTypes } from 'react';
import { FormErrors, Errors, Model, Status } from './type';
import Control from './control';

interface Props {
export interface Props {
children: (form: Form) => JSX.Element;
defaultValue?: Model;
onValidSubmit?: (model: Model) => void;
onInvalidSubmit?: (errors: FormErrors, model: Model) => void;
};

interface State {
export interface State {
value: Model;
controls: Map<string, Control>;
errors: FormErrors;
Expand Down Expand Up @@ -59,7 +59,7 @@ class Form extends Component<Props, State> {
get isInvalid() { return Status.INVALID === this.status; }
get isSubmitted() { return this.state.submitted; }

getChildContext() {
getChildContext(): { form: Form } {
return { form: this };
}

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"sourceMap": false,
"sourceMap": true,
"strictNullChecks": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"declaration": true,
"jsx": "react"
},
"include": [
Expand Down

0 comments on commit 26d8f6b

Please sign in to comment.