Skip to content

DT regression from Improved type inference for object literals #19613

Description

#19513 broke a DefinitelyTyped test. (Tested by building locally both with this commit and with the previous commit 4895d16) Go to DefinitelyTyped/types/baconjs and run tsc to see the error.

EDIT: Same for d3-selection-multi.

It's hard to say what exactly changed. Something that used to be assignable is no longer assignable.
In baconjs the error is:

baconjs-tests.ts(187,28): error TS2345: Argument of type '(groupedStream: EventStream<string, { id: number; type: string; val?: number; }>) => EventStream<...' is not assignable to parameter of type '(groupedStream: EventStream<{}, { id: number; type: string; val: number; } | { id: number; type: ...'.
  Types of parameters 'groupedStream' and 'groupedStream' are incompatible.
    Type 'EventStream<{}, { id: number; type: string; val: number; } | { id: number; type: string; val?: un...' is not assignable to type 'EventStream<string, { id: number; type: string; val?: number; }>'.
      Type '{}' is not assignable to type 'string'.
baconjs-tests.ts(188,22): error TS7006: Parameter 'groupedStream' implicitly has an 'any' type.
baconjs-tests.ts(188,62): error TS7006: Parameter 'acc' implicitly has an 'any' type.
baconjs-tests.ts(188,67): error TS7006: Parameter 'x' implicitly has an 'any' type.
baconjs-tests.ts(189,22): error TS7006: Parameter 'sum' implicitly has an 'any' type.

In d3-selection-multi the error is:

d3-selection-multi-tests.ts(37,29): error TS2345: Argument of type '(this: HTMLAnchorElement, d: string, i: number, g: ArrayLike<HTMLAnchorElement> | HTMLAnchorEleme...' is not assignable to parameter of type 'ValueFn<HTMLAnchorElement, string, ValueMap<HTMLAnchorElement, string>>'.
  Type '{ id?: undefined; } | { id: string; }' is not assignable to type 'ValueMap<HTMLAnchorElement, string>'.
    Type '{ id?: undefined; }' is not assignable to type 'ValueMap<HTMLAnchorElement, string>'.
      Property 'id' is incompatible with index signature.
        Type 'undefined' is not assignable to type 'string | number | boolean | ValueFn<HTMLAnchorElement, string, string | number | boolean | null> ...'.
d3-selection-multi-tests.ts(92,34): error TS2345: Argument of type '(this: HTMLAnchorElement, d: string, i: number, g: ArrayLike<HTMLAnchorElement> | HTMLAnchorEleme...' is not assignable to parameter of type 'ValueFn<HTMLAnchorElement, string, ValueMap<HTMLAnchorElement, string>>'.
  Type '{ href?: undefined; } | { href: string; }' is not assignable to type 'ValueMap<HTMLAnchorElement, string>'.
    Type '{ href?: undefined; }' is not assignable to type 'ValueMap<HTMLAnchorElement, string>'.
      Property 'href' is incompatible with index signature.
        Type 'undefined' is not assignable to type 'string | number | boolean | ValueFn<HTMLAnchorElement, string, string | number | boolean | null> ...'.
d3-selection-multi-tests.ts(121,31): error TS2345: Argument of type '(this: HTMLAnchorElement, d: string, i: number, g: ArrayLike<HTMLAnchorElement> | HTMLAnchorEleme...' is not assignable to parameter of type 'ValueFn<HTMLAnchorElement, string, ValueMap<HTMLAnchorElement, string>>'.
  Type '{ id?: undefined; } | { id: string; }' is not assignable to type 'ValueMap<HTMLAnchorElement, string>'.
    Type '{ id?: undefined; }' is not assignable to type 'ValueMap<HTMLAnchorElement, string>'.
      Property 'id' is incompatible with index signature.
        Type 'undefined' is not assignable to type 'string | number | boolean | ValueFn<HTMLAnchorElement, string, string | number | boolean | null> ...'.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions