mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #32094 from BendingBender/hex-rgb
[hex-rgb] Add types
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
import hexRgb = require('hex-rgb');
|
||||
|
||||
hexRgb('#cd2222cc'); // $ExpectType RgbaObj
|
||||
hexRgb('#cd2222cc', { format: 'array' }); // $ExpectType [number, number, number, number]
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for hex-rgb 3.0
|
||||
// Project: https://github.com/sindresorhus/hex-rgb#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = hexRgb;
|
||||
|
||||
declare function hexRgb(hex: string): hexRgb.RgbaObj;
|
||||
declare function hexRgb(hex: string, options: hexRgb.Options): hexRgb.RgbaArr;
|
||||
|
||||
declare namespace hexRgb {
|
||||
interface Options {
|
||||
format: 'array';
|
||||
}
|
||||
|
||||
interface RgbaObj {
|
||||
red: number;
|
||||
green: number;
|
||||
blue: number;
|
||||
alpha: number;
|
||||
}
|
||||
|
||||
type RgbaArr = [number, number, number, number];
|
||||
}
|
||||
@@ -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",
|
||||
"hex-rgb-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user