winston-elasticsearch icon indicating copy to clipboard operation
winston-elasticsearch copied to clipboard

Type definition of `fields` in TransformedData may be mistake

Open yeongjet opened this issue 10 months ago • 0 comments

https://github.com/vanthome/winston-elasticsearch/blob/d948fa1b705269a4713480593ea657de34c0a942/index.d.ts#L55

while using transformer:

new ElasticsearchTransport(
  ...
  transformer: logData => {
      const transformed = ElasticsearchTransformer(logData)
      const requestId = this.cls.get('requestId')
      if (requestId) {
          // ERROR: Property 'requestId' does not exist on type 'string'.ts(2339)
          transformed.fields.requestId = requestId
      }
      return transformed
  }
}

yeongjet avatar Sep 20 '23 11:09 yeongjet