Skip to content

DatasetV2 Owned typing failure #661

Description

@abulte

The DatasetV2 type is not compatible with Owned, even though it is composed with it.

See the example fiddle. I would expect dataset to be compatible with the signature of useMyComposable but there's the following error:

Argument of type 'DatasetV2' is not assignable to parameter of type 'Owned'.
  Type 'DatasetV2' is not assignable to type '{ organization: null; owner: User; }'.
    Types of property 'organization' are incompatible.
      Type 'Organization | null' is not assignable to type 'null'.
        Type 'Organization' is not assignable to type 'null'.

For reference, a Owned like this would work (but less smart):

interface Owned {
  organization?: Organization | null;
  owner?: User | null;
}

Metadata

Metadata

Assignees

No one assigned

    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