Marak / colors.js

get colors in your node.js console
https://github.com/Marak/colors.js
Other
5.17k stars 446 forks source link

include Typescript declarations (.d.ts) file #171

Closed MarcusCalidus closed 6 years ago

MarcusCalidus commented 7 years ago

Hi folks,

please be so kind as to add typescript declaration files into colors. Thank you.

Here's an example for the "unsafe" API that works for me:

colors.d.ts


// https://github.com/Marak/colors.js

// import _colors = module("colors");
// var colors = require('colors');

declare module 'colors' {
    function colors(): void;
}

declare interface String {
    //styles
    bold: string;
    italic: string;
    underline: string;
    inverse: string;
    reset: string;
    dim: string;
    hidden: string;
    strikethrough: string;

    //colors
    white: string;
    grey: string;
    black: string;
    blue: string;
    cyan: string;
    green: string;
    magenta: string;
    red: string;
    yellow: string;

    //background colors
    bgBlack: string;
    bgRed: string;
    bgGreen: string;
    bgYellow: string;
    bgBlue: string;
    bgMagenta: string;
    bgCyan: string;
    bgWhite: string;

    //extras
    rainbow: string;
    zebra: string;
    america: string;
    trap: string;
    random: string;
}
DABH commented 6 years ago

Typings already exist (@types/colors) -- please submit a PR to DefinitelyTyped if you have any issues with them. At some point we'll try to move the typings into this repo instead.

ohabash commented 4 years ago

how do i install one of these in my TS project?

Property 'green' does not exist on type