Skip to content

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

Closed
@sandersn

Description

@sandersn
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').

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions