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

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

Closed
weswigham opened this issue Mar 7, 2022 · 0 comments · Fixed by #48337
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging

Comments

@weswigham
Copy link
Member

weswigham commented Mar 7, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging
Projects
None yet
1 participant