From 24f2f2e8cb1006e517d13d1ec591b353fcf86619 Mon Sep 17 00:00:00 2001 From: Eric Cornelissen Date: Wed, 26 Feb 2020 03:03:31 +0200 Subject: [PATCH] Add types for simple-icons (#42541) * Create types for [simple-icons] * Add missing final newline * Update CODEOWNERS * Revert a53398139f1a05eba5acbc2c085ad8b5fce705f4 * Use `export =` instead of `export default` as suggested by @PranavSenthilnathan * fix lint errors --- types/simple-icons/index.d.ts | 15 +++++++++++++++ types/simple-icons/simple-icons-tests.ts | 9 +++++++++ types/simple-icons/tsconfig.json | 24 ++++++++++++++++++++++++ types/simple-icons/tslint.json | 1 + 4 files changed, 49 insertions(+) create mode 100644 types/simple-icons/index.d.ts create mode 100644 types/simple-icons/simple-icons-tests.ts create mode 100644 types/simple-icons/tsconfig.json create mode 100644 types/simple-icons/tslint.json diff --git a/types/simple-icons/index.d.ts b/types/simple-icons/index.d.ts new file mode 100644 index 0000000000..37422aca67 --- /dev/null +++ b/types/simple-icons/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for simple-icons 2.5 +// Project: https://www.simpleicons.org +// Definitions by: Eric Cornelissen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface SimpleIcon { + title: string; + slug: string; + svg: string; + path: string; + source: string; + hex: string; +} + +export function get(name: string): SimpleIcon; diff --git a/types/simple-icons/simple-icons-tests.ts b/types/simple-icons/simple-icons-tests.ts new file mode 100644 index 0000000000..c0d1efbfe4 --- /dev/null +++ b/types/simple-icons/simple-icons-tests.ts @@ -0,0 +1,9 @@ +import simpleIcons from 'simple-icons'; + +const icon = simpleIcons.get('Simple Icons'); // $ExpectType SimpleIcon +icon.title; // $ExpectType string +icon.slug; // $ExpectType string +icon.hex; // $ExpectType string +icon.source; // $ExpectType string +icon.svg; // $ExpectType string +icon.path; // $ExpectType string diff --git a/types/simple-icons/tsconfig.json b/types/simple-icons/tsconfig.json new file mode 100644 index 0000000000..5ac5a5518f --- /dev/null +++ b/types/simple-icons/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "simple-icons-tests.ts" + ] +} diff --git a/types/simple-icons/tslint.json b/types/simple-icons/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/simple-icons/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }