diff --git a/types/rgb-hex/index.d.ts b/types/rgb-hex/index.d.ts new file mode 100644 index 0000000000..44a54bad35 --- /dev/null +++ b/types/rgb-hex/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for rgb-hex 2.1 +// Project: https://github.com/sindresorhus/rgb-hex#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = rgbHex; + +declare function rgbHex(rgba: string): string; +declare function rgbHex(red: number, green: number, blue: number, alpha?: string | number): string; diff --git a/types/rgb-hex/rgb-hex-tests.ts b/types/rgb-hex/rgb-hex-tests.ts new file mode 100644 index 0000000000..b2c950dd1b --- /dev/null +++ b/types/rgb-hex/rgb-hex-tests.ts @@ -0,0 +1,6 @@ +import rgbHex = require('rgb-hex'); + +rgbHex('rgb(40, 42, 54)'); // $ExpectType string +rgbHex(65, 131, 196); // $ExpectType string +rgbHex(65, 131, 196, 0.2); // $ExpectType string +rgbHex(40, 42, 54, '75%'); // $ExpectType string diff --git a/types/rgb-hex/tsconfig.json b/types/rgb-hex/tsconfig.json new file mode 100644 index 0000000000..cb4498db23 --- /dev/null +++ b/types/rgb-hex/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "rgb-hex-tests.ts" + ] +} diff --git a/types/rgb-hex/tslint.json b/types/rgb-hex/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rgb-hex/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }