unjs / consola

🐨 Elegant Console Logger for Node.js and Browser
Other
6.12k stars 175 forks source link

fix(types): const consola = require('consola') type is wrong #80

Closed Akryum closed 4 years ago

Akryum commented 4 years ago

Fix a typing issue that causes this to throw a typing error on consola.green:

// @ts-check

const consola = require('consola')

consola.green('foo')
Akryum commented 4 years ago

Workaround:

// globals.d.ts

import { Consola } from 'consola'

declare module 'consola' {
  export = new Consola()
}
pi0 commented 4 years ago

I had to revert this PR as of #88. ==> #89

Akryum commented 4 years ago

:|