From 371c22e0dcc77e129be89a197b25e930ae9823e8 Mon Sep 17 00:00:00 2001 From: prakarshpandey Date: Wed, 28 Jun 2017 16:28:26 -0700 Subject: [PATCH] Fixed the index and test files to conform to DefinitelyTyped standards --- types/react-app/index.d.ts | 17 +++++++++-------- types/react-app/react-app-tests.tsx | 12 ++++++------ types/react-app/tsconfig.json | 3 ++- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/types/react-app/index.d.ts b/types/react-app/index.d.ts index 3fee3b6cf7..bd68aed103 100644 --- a/types/react-app/index.d.ts +++ b/types/react-app/index.d.ts @@ -1,12 +1,13 @@ -// Type definitions for react-app 1.0.0-alpha.3 +// Type definitions for react-app 1.0 // Project: https://github.com/kriasoft/react-app#readme // Definitions by: Prakarsh Pandey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Typescript Version: 2.3 import * as React from 'react'; export interface LinkProps { - to: string | object; + to: string; onClick?(): void; className?: string; } @@ -22,19 +23,19 @@ export interface RouteProps { // takes the form of universal-router routes export interface ChildProps { path: string; - action(params: any): object; + action(params: any): any; } export interface CreateAppObject { routes: RouteProps; - context: object; + context: {}; container: Element | null; } // exporting the createApp function export function createApp(createAppObject: CreateAppObject): JSX.Element; -export const Link: React.ComponentClass; -export const Layout: React.ComponentClass; -export const Header: React.ComponentClass<{}>; -export const Navigation: React.ComponentClass<{}>; +export class Link extends React.Component {} +export class Layout extends React.Component {} +export class Header extends React.Component {} +export class Navigation extends React.Component {} diff --git a/types/react-app/react-app-tests.tsx b/types/react-app/react-app-tests.tsx index f19b436412..3c33f36944 100644 --- a/types/react-app/react-app-tests.tsx +++ b/types/react-app/react-app-tests.tsx @@ -1,12 +1,12 @@ import * as React from 'react'; -import { Navigation, Link, Layout, Header, createApp } from './index'; +import { Navigation, Link, Layout, Header, createApp } from 'react-app'; const store = {}; const routes = { path: '/', - children: { - fooRoute: { - path = '/', + children: [ + { + path: '/', action() { return { title: 'Foo Page', @@ -14,7 +14,7 @@ const routes = { }; } }, - barRoute: { + { path: '/bar', action() { return { @@ -23,7 +23,7 @@ const routes = { }; } } - } + ] }; ; diff --git a/types/react-app/tsconfig.json b/types/react-app/tsconfig.json index 3a673038be..b1cf94dbd6 100644 --- a/types/react-app/tsconfig.json +++ b/types/react-app/tsconfig.json @@ -9,6 +9,7 @@ "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", + "jsx": "react", "typeRoots": [ "../" ], @@ -18,6 +19,6 @@ }, "files": [ "index.d.ts", - "react-app-tests.ts" + "react-app-tests.tsx" ] }