Skip to content

JS Class expression with js-valued return type methods cause duplicated errors #24252

Closed
@weswigham

Description

@weswigham

Found in #24247

TypeScript Version: 2.9.0-dev.201xxxxx

Search Terms:

Code

// @ts-check
var A = {};
A.B = {};
A.B.C = [
    {
        o: "no",
        y: 42
    }
];

A.Foo = class {
    /**
     * @returns {?A}
     */
    foo() {
        return A.B.C.find(x => !!x);
    }
}

Expected behavior:
image

Actual behavior:
image
(2 errors instead of 1 - one without elaboration)
In trying to edit this down further, I've found that removing the nested namespace on B seems to remove the bug, as does changing the return type of foo to not reference A, or changing from a class to an object literal for A.Foo - so it seems a great deal of things must be kept in place to reproduce this error.

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