Skip to content

JSDoc type reference resolves incorrectly if checked before the constructor function it refers to #34685

Closed
@sandersn

Description

@sandersn
// @filename: mod1.js
var Workspace = {}
Workspace.Project = function () { }
Workspace.Project.prototype = {
  isServiceProject() { }
}
// @filename: test.js
/** @param {Workspace.Project} p */
function demo(p) {
  p.isServiceProject()
}

Expected: no error, and p.isServiceProject(): void.

Actual: no error if you compile tsc mod1.js test.js, but an error with tsc test.js mod1.js:

Property 'isServiceProject' does not exist on type 'typeof Project'.

From chrome-devtools-frontend, failed in #34603

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions