From 787ac3cc6662ee26e48407f771e2253b60b3b4b4 Mon Sep 17 00:00:00 2001 From: Arjan Jassal Date: Wed, 31 Oct 2018 20:39:08 -0700 Subject: [PATCH] refactor and fix linting --- types/styled-theming/index.d.ts | 24 +++++++++----------- types/styled-theming/styled-theming-tests.ts | 2 +- types/styled-theming/tsconfig.json | 14 ++++-------- 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/types/styled-theming/index.d.ts b/types/styled-theming/index.d.ts index 235666cf16..227fb5aba1 100644 --- a/types/styled-theming/index.d.ts +++ b/types/styled-theming/index.d.ts @@ -2,9 +2,11 @@ // Project: https://github.com/styled-components/styled-theming#readme // Definitions by: Arjan Jassal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.1.1 +// TypeScript Version: 2.2 -declare module "styled-theming" { +declare function theme(name: string, values: theme.ThemeMap): theme.ThemeSet; + +declare namespace theme { type ThemeValueFn = (props: object) => string; type ThemeValue = string | ThemeValueFn; @@ -19,15 +21,11 @@ declare module "styled-theming" { type ThemeSet = (props: object) => string; type VariantSet = (props: object) => string; - namespace theme { - export function variants( - name: string, - prop: string, - values: VariantMap - ): VariantSet; - } - - function theme(name: string, values: ThemeMap): ThemeSet; - - export = theme; + function variants( + name: string, + prop: string, + values: VariantMap + ): VariantSet; } + +export default theme; diff --git a/types/styled-theming/styled-theming-tests.ts b/types/styled-theming/styled-theming-tests.ts index a4b1caa60d..2d9e947009 100644 --- a/types/styled-theming/styled-theming-tests.ts +++ b/types/styled-theming/styled-theming-tests.ts @@ -1,4 +1,4 @@ -import * as theme from "styled-theming"; +import theme from "styled-theming"; const textColor = theme("mode", { dark: "white", diff --git a/types/styled-theming/tsconfig.json b/types/styled-theming/tsconfig.json index b94e3593fc..790a9ddd81 100644 --- a/types/styled-theming/tsconfig.json +++ b/types/styled-theming/tsconfig.json @@ -1,22 +1,16 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, + "strictFunctionTypes": true, "strictNullChecks": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "styled-theming-tests.ts" - ] + "files": ["index.d.ts", "styled-theming-tests.ts"] }