镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Errors not reported on properties inside function calls #25695

Description

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:

Activity

  1. CyrusNajmabadi commented on Aug 30, 2018

    @CyrusNajmabadi
    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!

  2. RyanCavanaugh commented on Aug 30, 2018

    @RyanCavanaugh
    Member

    👋 !

  3. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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