Skip to content

Node v14+ support and fix for TypeScript and EventEmitter #25

@fidian

Description

@fidian

Node v14 is the active LTS and it switches to "maintenance" tomorrow, making Node v16 the current LTS as of Tuesday. It would be great to be able to upgrade the project so it builds without errors. When I try, I get the following:

node_modules/@fluent-org/logger/build/src/server.d.ts:63:43 - error TS2507: Type 'typeof EventEmitter' is not a constructor function type.

63 export declare class FluentServer extends EventEmitter {
                                             ~~~~~~~~~~~~

node_modules/@fluent-org/logger/build/src/socket.d.ts:164:43 - error TS2507: Type 'typeof EventEmitter' is not a constructor function type.

164 export declare class FluentSocket extends EventEmitter {
                                              ~~~~~~~~~~~~


Found 2 errors.

From what I see at DefinitelyTyped, the upgrade at 13.4 or 13.5 caused issues. Geckos.io has a simple fix, as does cheap-watch. It basically means you have to change the import line.

// Old
import * as EventEmitter from "events";

// New
import { EventEmitter } from 'events';

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