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

module.exports.property results in a property of type any #25621

Closed
sandersn opened this issue Jul 12, 2018 · 0 comments · Fixed by #25732
Closed

module.exports.property results in a property of type any #25621

sandersn opened this issue Jul 12, 2018 · 0 comments · Fixed by #25732
Assignees
Labels
Bug A bug in TypeScript

Comments

@sandersn
Copy link
Member

sandersn commented Jul 12, 2018

module.exports.y = "hi"
let u = module.exports.y/**/

Get quick info at position.

Expected behavior:

The type of module.exports.y is reported as string.

Actual behavior:

The type of module.exports.y is reported as any, and there aren't any completions, so it seems like it actually is any.

Edit:

  1. Repros on 2.9.2 and master.
  2. When imported, the type is correct
var { y } = require('./mod')
y/**/

The declared type is used if there is one, even if it contradicts the initialiser (eg /** @type {number} */ module.exports.y = 'hi').

@sandersn sandersn added Bug A bug in TypeScript Salsa labels Jul 12, 2018
@sandersn sandersn changed the title module.exports.property isn't recognized module.exports.property results in a property of type any Jul 12, 2018
@mhegazy mhegazy added this to the TypeScript 3.1 milestone Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants