feat(flow): flow type definition for 'stderr'

This commit is contained in:
Pavel Lang 2018-12-27 20:58:12 +01:00
parent 35bebfa849
commit 48d8210536
No known key found for this signature in database
GPG key ID: 623A223A57974B55
2 changed files with 10 additions and 0 deletions

5
stderr.js.flow Normal file
View file

@ -0,0 +1,5 @@
// @flow strict
import { Chalk } from './index';
declare module.exports: Chalk;

View file

@ -1,5 +1,6 @@
// @flow
import chalk from '..';
import cherr from '../stderr';
// $ExpectError (Can't have typo in option name)
chalk.constructor({levl: 1});
@ -13,6 +14,10 @@ new chalk.constructor({enabled: true});
chalk.underline(null);
chalk.underline('foo');
// $ExpectError (Can't pass in null)
cherr.underline(null);
cherr.underline('foo');
// $ExpectError (Can't have typo in chalk method)
chalk.rd('foo');
chalk.red('foo');