Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@weswigham

Description

@weswigham
Issue body actions

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.