Add typing for react-compass (#45599)

* Added Types for react-compass

* Added directionNames prop

Co-authored-by: Rick Wilson <me@richardawilson.com>
This commit is contained in:
Rick Wilson 2020-06-21 03:45:34 -04:00 committed by GitHub
parent 159c123fef
commit bb09479b88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 0 deletions

17
types/react-compass/index.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
// Type definitions for react-compass 0.1
// Project: https://github.com/virtyaluk/react-compass
// Definitions by: Rick Wilson <https://github.com/rwilson504>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as React from "react";
export interface ReactCompassProps {
direction: number;
directionNames?: string[];
}
export function directionName(dir: number): string;
export function normalizeAngle(direction: number): number;
export class ReactCompass extends React.Component<ReactCompassProps, any> {}
export default ReactCompass;

View File

@ -0,0 +1,10 @@
import * as React from "react";
import ReactCompass from 'react-compass';
interface CompassProps {
direction: number;
}
const CompassComp: React.FC<CompassProps> = (props) => {
return (<ReactCompass direction={0} />);
};

View File

@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"jsx": "react",
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-compass-tests.tsx"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }