Skip to content

isColorSupported does not work with esm import #615

@JoeCap08055

Description

@JoeCap08055

The README says that isColorSupported may be used as follows:

import pretty from 'pino-pretty'

if (pretty.isColorSupported) {
  ...
}

However, doing so results in the following compile error:

TS2339: Property 'isColorSupported' does not exist on type 'typeof PinoPretty'.

If I change to:

import { isColorSupported } from 'pino-pretty';

if (isColorSupported) {
...
}

I get:

TS2693: 'isColorSupported' only refers to a type, but is being used as a value here.

Changing either of those imports to a CommonJS require, as in either:

const pretty = require('pino-pretty');
// or
const { isColorSupported } = require('pino-pretty');

works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions