unjs / consola

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

[typescript] const consola = require('consola') type is wrong #89

Closed pi0 closed 1 year ago

pi0 commented 4 years ago

Ref: #80

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

// @ts-check

const consola = require('consola')

consola.green('foo')

Workaround:

// globals.d.ts

import { Consola } from 'consola'

declare module 'consola' {
  export = new Consola()
}
This question is available on Nuxt community (#c68)
pi0 commented 1 year ago

should be fixed in v3