Add Types for react-coinhive (#27010)

* Add Types for react-coinhive

* Update TypeScript version (#27010)
This commit is contained in:
sktbcbbs
2018-07-03 09:28:29 -07:00
committed by Mohamed Hegazy
parent e5c9bcdaea
commit 7b43a570da
4 changed files with 92 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
// Type definitions for react-coinhive 1.0
// Project: https://github.com/dragma/react-coinhive
// Definitions by: sktbcbbs <https://github.com/sktbcbbs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
export interface CoinHiveProps {
autoThreads?: boolean;
run?: boolean;
siteKey: string;
src?: string;
threads?: number;
throttle?: number;
userName?: string;
onInit?: (callback: any) => void;
onStart?: (callback: any) => void;
onStop?: (callback: any) => void;
}
export default class CoinHive extends React.Component<CoinHiveProps, any> {
static getMinerData(miner: any): any;
static src: {
authedmine: string;
coinhive: string;
};
onInit(miner: any): any;
onStart(miner: any): any;
onStop(miner: any): any;
}
@@ -0,0 +1,23 @@
import * as React from "react";
import CoinHive, { CoinHiveProps } from "react-coinhive";
export class CoinHiveTest extends React.Component {
render() {
const props: CoinHiveProps = {
userName: "Maya",
siteKey: "tbzWvRTBa3VAKefxUmDZx6P6wjCSHXz0",
autoThreads: false,
threads: 2,
src: CoinHive.src.authedmine,
onInit: () => {},
onStart: () => {},
onStop: () => {},
};
return (
<div>
<CoinHive {...props} />
</div>
);
}
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"index.d.ts",
"react-coinhive-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }