Skip to content

Salsa does not use JSDoc all the way in type inference #6659

Closed
@egamma

Description

@egamma

From @alexandrudima on January 27, 2016 12:40

Testing #2218

I would expect Person and Person2 to behave the same given the JSDoc "types" age to be a number.

/**
 * @param {number} age
 */
function Person(age) {
    this.age = age; // <- it knows age is a number
}

function Person2() {
    this.age = 13;
}

var p1 = new Person();
var p2 = new Person2();

var a = p1.age; // <- it doesn't know this is a number
var b = p2.age; // <- it knows this is a number

Copied from original issue: microsoft/vscode#2437

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions