patorjk / figlet.js

A FIG Driver written in JavaScript which aims to fully implement the FIGfont spec.
MIT License
2.61k stars 167 forks source link

How to use figlet on typescript? #31

Closed MarcosCostaDev closed 5 years ago

patorjk commented 7 years ago

I'm not that familiar with TypeScript. This is just a regular JavaScirpt library though, so you'd integrate it into your setup the same way you'd integrate any other JavaScript library.

sridharmallela commented 7 years ago

@marcoslcosta This is how i used figlet into typescript class. Here there is class to print input data with testFiglet method

import * as figlet from 'figlet';

class FigletTest() {

    testFiglet(testData: string) => {
        figlet(testData, (error: any, data: any) => {
            if (error) {
                return process.exit(1);
            }
            console.log(chalk.blue(data));
            console.log('');
            process.exit(0);
        });
    }
}
MarcosCostaDev commented 7 years ago

@sridharmallela Thank you, I'm going to test this way soon.