Skip to content

Call signature is not recognized as 'extra' in object literals #14170

Closed
@anvish

Description

@anvish

TypeScript Version: 2.1.6

Code

interface A {
    a?: string
}
const a1: A = { b: 2 } // correct: error "Object literal may only specify known properties"
const a2: A = () => { } // incorrect: no error

Expected behavior:
Call signature is treated like an excessive property, so both lines emit an error.
Actual behavior:
Only properties are checked, so only first line emits an error.

See #3755

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions