Skip to content

tsc produces invalid typings for parameter destructuring #3912

Closed
@uber5001

Description

@uber5001

I have an interface that is supposed to have a function signature of:

(param: {prop: boolean}): any

but I forget the parameter name (I'm not sure if this signature is considered valid):

({prop: boolean}): any

When compiling this invalid interface with the --declaration flag, an invalid .d.ts file results:

/* foo.ts */
export interface SomeInterface {
    ({prop: boolean}): any
}

tsc foo.ts --module commonjs --declaration

/* foo.d.ts */
export interface SomeInterface {
    ({prop: }: {
        prop: any;
    }): any;
}

If parameter names are optional, this should produce a valid .d.ts file. If parameter names are required, tsc should throw an error, or at least warn me that there is an issue.

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