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

TypeScript: Property 'Transport' does not exist on type 'typeof winston' #129

Closed
dinvlad opened this issue Jul 17, 2018 · 2 comments
Closed
Assignees
Labels
api: logging Issues related to the googleapis/nodejs-logging-winston API. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@dinvlad
Copy link

dinvlad commented Jul 17, 2018

Environment details

  • OS: MacOS Sierra (10.12.6)
  • Node.js version: 8.11.3
  • npm version: 5.6.0
  • @google-cloud/logging-winston version: 0.9.0
  • winston version: 3.0.0
  • typescript version: 2.9.2

Steps to reproduce

  1. Attempt to set LoggingWinston as a transport for winston:
import { LoggingWinston } from '@google-cloud/logging-winston';
import { createLogger } from 'winston';

const logger = createLogger({
  transports: [
    new LoggingWinston(),
  ],
});
  1. TypeScript throws the following error:
node_modules/@google-cloud/logging-winston/build/src/index.d.ts:19:53 - error TS2339: Property 'Transport' does not exist on type 'typeof winston'.

19 export declare class LoggingWinston extends winston.Transport {
                                                       ~~~~~~~~~
src/server.ts:13:29 - error TS2345: Argument of type '{ level: string; transports: (ConsoleTransportInstance | LoggingWinston)[]; }' is not assignable to parameter of type 'LoggerOptions | undefined'.
  Type '{ level: string; transports: (ConsoleTransportInstance | LoggingWinston)[]; }' is not assignable to type 'LoggerOptions'.
    Types of property 'transports' are incompatible.
      Type '(ConsoleTransportInstance | LoggingWinston)[]' is not assignable to type 'TransportStream | TransportStream[] | undefined'.
        Type '(ConsoleTransportInstance | LoggingWinston)[]' is not assignable to type 'TransportStream[]'.
          Type 'ConsoleTransportInstance | LoggingWinston' is not assignable to type 'TransportStream'.
            Type 'LoggingWinston' is not assignable to type 'TransportStream'.
              Property 'writable' is missing in type 'LoggingWinston'.

It appears that the TypeScript definition for LoggingWinston inherits from a non-existent class winston.Transport. Would it be possible to fix it?

Thanks!

@dinvlad dinvlad changed the title Typescript: Property 'Transport' does not exist on type 'typeof winston' TypeScript: Property 'Transport' does not exist on type 'typeof winston' Jul 17, 2018
@ofrobots
Copy link
Contributor

ofrobots commented Jul 17, 2018

This library doesn't support winston@3.0.0 just yet. See: #84. We are planning to work on that support soon. In the meanwhile you will have to use winston@2.x.

Closing as duplicate.

@dinvlad
Copy link
Author

dinvlad commented Jul 17, 2018

Thanks, I missed that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/nodejs-logging-winston API. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants