Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors not reported on properties inside function calls #25695

Closed
mhegazy opened this issue Jul 16, 2018 · 2 comments
Closed

Errors not reported on properties inside function calls #25695

mhegazy opened this issue Jul 16, 2018 · 2 comments
Assignees
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging Fixed A PR has been merged for this issue

Comments

@mhegazy
Copy link
Contributor

mhegazy commented Jul 16, 2018

TypeScript Version: 3.0.0-dev.201xxxxx

Search Terms:

The changes from #25140, did not seem to work on function calls.

Code

type Options = { x: number, y: string };
declare function foo(options: Options): void;

foo({ x: 1, y: 10 });
//  ^^^^^^^^^^^^^^^
// Argument of type '{ x: number; y: number; }' is not assignable to parameter of type 'Options'.
//   Types of property 'y' are incompatible.
//    Type 'number' is not assignable to type 'string'.


var m: Options;
m = { x: 1, y: 2 };
//          ^
//  Type 'number' is not assignable to type 'string'.

Expected behavior:

Actual behavior:

Playground Link:

Related Issues:

@CyrusNajmabadi
Copy link
Contributor

hey Mohamed/Dan/Ryan :) This is definitely affecting us over here. Many of our APIs are intended to be used as factory constructors, where the construction values are passed in through large complex objects.

We'd definitely like get the new minimal-error experience as it's really much better for our domain. Just adding a +1 to having this improved in an upcoming release. Thanks!

@RyanCavanaugh
Copy link
Member

👋 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

5 participants