Skip to content

esModuleInterop causes is not a constructor function type #21872

@corbinu

Description

@corbinu

TypeScript Version: 2.7.1 and 2.8.0-dev.20180211

Search Terms:
is not a constructor function type
is not a constructor function type esModuleInterop
is not a constructor function type module Interop

Code
I am using https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hapi for typing hapi 17

It works fine until I enable the new esModuleInterop then suddenly I get this error


node_modules/@types/hapi/definitions/server/server.d.ts:45:29 - error TS2507: Type '{ default: Podium; registerEvent(events: Events[]): void; registerEvent(events: Events): void; re...' is not a constructor function type.

45 export class Server extends Podium {

Expected behavior:
I believe the definition file should either be valid or not regardless of if esModuleInterop is enabled or not

Actual behavior:
If the type definition is invalid code and then should error either way. If it is valid code then it should not error either way.

Also if I //@ts-ignore the error the code compiles and runs fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions