Skip to content

Function call gives bogus error about type arguments when real problem is a missing argument #25683

Closed
@mattmccutchen

Description

@mattmccutchen

TypeScript Version: master (60986ad)

Search Terms: "expected" "type arguments but got"

Code

function f<A, B = {}>(arg: number) {}
f<number>();

Expected behavior: Error: Expected 1 arguments, but got 0.

Actual behavior: Error: Expected 1-2 type arguments, but got 1.

Playground Link: link

Related Issues: #19374

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions