Skip to content

Error: Debug Failure. False expression: parameter should have errors when reporting errors #33732

Closed
@amcasey

Description

@amcasey

TypeScript Version: 3dd7b84

Code

interface I1 {
    prop1: string;
}

interface I2 {
    prop2: string;
}

interface I3 extends Record<string, string> {
    prop3: string;
}

type Properties =
    | { [key: string]: never }
    | I1
    | I2
    | I3
    ;


declare const prop1: string;
declare const prop2: string | undefined;

// Error: Debug Failure. False expression: parameter should have errors when reporting errors
function F1(_arg: { props: Properties }) { }
F1({
    props: {
        prop1,
        prop2,
    },
});

// Error: Debug Failure. No error for last overload signature
function F2(_props: Properties) { }
F2({
    prop1,
    prop2,
});

Expected behavior: Compiles successfully in strict mode

Actual behavior: Asserts in strict mode (different asserts for F1 and F2)

Edit: current best guess is that checkRelatedTo should be true and that's why there's no error message. This seems to be related to excess-property checking (related to the fresh object literal at the call site and the index signature in the union).

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions