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

Fix data type of TransformedData.fields #221

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aeharvlee
Copy link

@aeharvlee aeharvlee commented Jul 19, 2022

The real type of Transfromed.fields is Object, not string.
Currently we cannot use official example.

  const { ElasticsearchTransformer } = require('winston-elasticsearch');
  const esTransportOpts = {
  transformer: (logData) => {
   const transformed = ElasticsearchTransformer(logData);
   transformed.fields.customField = 'customValue'
   return transformed;
 }};
const esTransport = new ElasticsearchTransport(esTransportOpts);

Cannot use transformed.fields.customField = 'customValue' because transformed.fields is a string type, so TypeScript compiler throw error about this when do compile.

As you can see, the real data type of TransformedData.fields is Object, not string.
image

The real type of Transfromed.fields is Object, not string.
So If we deinfe this type as string, we cannot use `TransformedDAta.fields`.
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 this pull request may close these issues.

None yet

1 participant