single-spa-react: typings (#27777)

* single-spa-react: typings

* fix ts version
This commit is contained in:
Garrett Smith
2018-08-01 13:10:15 -07:00
committed by Sheetal Nandi
parent 992112dedc
commit a5544dce7b
4 changed files with 63 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
// Type definitions for single-spa-react 2.8
// Project: https://github.com/CanopyTax/single-spa-react
// Definitions by: Garrett Smith <https://github.com/Garrett-Smith-iq>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from 'react';
import * as ReactDOM from 'react-dom';
export = SingleSpaReact;
declare function SingleSpaReact(opts: SingleSpaReact.Options): SingleSpaReact.Lifecycles;
declare namespace SingleSpaReact {
interface Options {
React: typeof React;
ReactDOM: typeof ReactDOM;
rootComponent?: React.ComponentClass;
loadRootComponent?: () => Promise<React.ComponentClass>;
domElementGetter?: () => Element;
suppressComponentDidCatchWarning?: boolean;
parcelCanUpdate?: boolean;
}
interface Lifecycles {
bootstrap: (opts: Options, props: any) => Promise<void>;
mount: (opts: Options, props: any) => Promise<void>;
unmount: (opts: Options, props: any) => Promise<void>;
}
}
@@ -0,0 +1,10 @@
import singleSpaReact = require('single-spa-react');
import { Lifecycles } from 'single-spa-react';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
// $ExpectType Lifecycles
singleSpaReact({
React,
ReactDOM,
});
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"single-spa-react-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }