Add type definition for react-native-navbar (#28746)

This commit is contained in:
Ryokik
2018-09-10 17:07:22 -07:00
committed by Ryan Cavanaugh
parent 8a155514f4
commit a177a87c7d
4 changed files with 68 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for react-global-configuration 1.3
// Project: https://github.com/morenofa/react-global-configuration#readme
// Definitions by: Ryo Kikuchi <https://github.com/ryokik>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export interface Options {
freeze: boolean;
assign: boolean;
}
declare namespace ReactGlobalConfiguration {
function set(newConfiguration: any, newOptions?: Options): void;
function get(key?: string): any;
function get<Value = any>(key: string, fallbackValue: Value): Value;
function serialize(): string;
}
export default ReactGlobalConfiguration;
@@ -0,0 +1,25 @@
import config from "react-global-configuration";
interface UserConfig {
a: number;
b: string;
c: {
ca: 123;
cb: 'ABC';
};
}
config.set({
a: 456,
b: "DEF",
c: {
ca: 123,
cb: 'ABC',
}
});
config.serialize();
const all = config.get(); // all: any
const a = config.get<number>('a', 789); // a: number
const d = config.get('d'); // d: any
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-global-configuration-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }