Skip to content

Checking module.exports should not yield a This condition will always return true since this function is always defined error #48166

@weswigham

Description

@weswigham

Given a js file with

function clone(x) { return x; }
if (typeof module === 'object' && module.exports) {
  module.exports = clone;
}

we should not issue error TS2774: This condition will always return true since this function is always defined. Did you mean to call it instead? on the module.exports check - it's an environment check and may very well be undefined in non-node environments and is totally valid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Error MessagesThe issue relates to error messaging

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions