diff --git a/types/react-flags-select/index.d.ts b/types/react-flags-select/index.d.ts new file mode 100644 index 0000000000..6a2e1dc964 --- /dev/null +++ b/types/react-flags-select/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for react-flags-select 1.1 +// Project: https://github.com/ekwonye-richard/react-flags-select#readme +// Definitions by: Artur Sianiuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Component } from 'react'; + +interface Props { + countries?: string[]; + blackList?: boolean; + customLabels?: {[propName: string]: string}; + selectedSize?: number; + optionsSize?: number; + defaultCountry?: string; + placeholder?: string; + className?: string; + showSelectedLabel?: boolean; + showOptionLabel?: boolean; + alignOptions?: string; + onSelect?: (countryCode: string) => void; + disabled?: boolean; + searchable?: boolean; +} +declare class ReactFlagsSelect extends Component { + updateSelected(countryCode: string): void; +} + +export default ReactFlagsSelect; diff --git a/types/react-flags-select/react-flags-select-tests.tsx b/types/react-flags-select/react-flags-select-tests.tsx new file mode 100644 index 0000000000..31bf921154 --- /dev/null +++ b/types/react-flags-select/react-flags-select-tests.tsx @@ -0,0 +1,73 @@ +import * as React from 'react'; +import ReactFlagsSelect from 'react-flags-select'; + +export class ReactFlagsSelectTest extends React.Component { + countries = ['US', 'GB', 'FR', 'DE', 'IT']; + customLabels = {US: 'EN-US', GB: 'EN-GB', FR: 'FR', DE: 'DE', IT: 'IT'}; + onSelectFlag(countryCode: string) { } + render() { + return ( +
+ + + + + + + + + + + + + + + + +
+ ); + } +} diff --git a/types/react-flags-select/tsconfig.json b/types/react-flags-select/tsconfig.json new file mode 100644 index 0000000000..f42fa48c4a --- /dev/null +++ b/types/react-flags-select/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-flags-select-tests.tsx" + ] +} diff --git a/types/react-flags-select/tslint.json b/types/react-flags-select/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/react-flags-select/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file