Skip to content

In JS, empty object literal ignores type annotation in this-property assignments #26198

@sandersn

Description

@sandersn
class C {
    constructor() {
        /** @type {number} - should error! */
        this.x = {}
    }
    
}

Expected behavior:
Error

Actual behavior:
No error, and this.x: {}.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issuecheckJsRelates to checking JavaScript using TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions