Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TransformableInfo Typing out of date. #111

Closed
dscalzi opened this issue Aug 24, 2020 · 3 comments
Closed

TransformableInfo Typing out of date. #111

dscalzi opened this issue Aug 24, 2020 · 3 comments

Comments

@dscalzi
Copy link

dscalzi commented Aug 24, 2020

The TransformableInfo key is no longer restricted to only a string. triple-beam changed their typings such that the constants are no longer strings.

see triple-beam change: DefinitelyTyped/DefinitelyTyped#46490

usage in winston: https://github.com/winstonjs/winston/blob/68ea786e053e50b51396e0cc8993c67ff789609c/lib/winston/logger.js#L251

Location of required change: https://github.com/winstonjs/logform/blob/master/index.d.ts#L10

TL;DR the type needs to support strings and unique symbol.

Current ugly workaround for projects using these typings:

import { SPLAT as SPLAT_Symbol } from 'triple-beam'
const SPLAT = SPLAT_Symbol as unknown as string // this is not a string

...
format.printf(info => {
    if(info[SPLAT]) { ... }
})
@bradennapier
Copy link

bradennapier commented Sep 1, 2020

Yep, running into the same, although I fixed this without casting by just adding the splat to the interface:

import { SPLAT } from 'triple-beam';

declare module 'logform' {
  export interface TransformableInfo {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    [SPLAT]: any;
  }
}

@joechrz
Copy link

joechrz commented Jun 30, 2021

Any plans to merge this PR? Running into this issue as well.

@dscalzi
Copy link
Author

dscalzi commented Oct 31, 2021

@yurijmikhalevich can this be given some attention? Still a problem over a year later and it's causing a big headache getting tsc to work on gh-actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants