Merge pull request #32095 from BendingBender/rgb-hex

[rgb-hex] Add types
This commit is contained in:
Daniel Rosenwasser 2019-01-14 14:24:34 -08:00 committed by GitHub
commit 1cd4b4e1fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 0 deletions

9
types/rgb-hex/index.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
// Type definitions for rgb-hex 2.1
// Project: https://github.com/sindresorhus/rgb-hex#readme
// Definitions by: BendingBender <https://github.com/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;

View File

@ -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

View File

@ -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"
]
}

View File

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