Skip to content

Strange error involving 'never' #100

@mellis481

Description

@mellis481

I have an interface with properties of arrays of various types. Eg:

export interface IObject {
  ids: number[];
  types: string[];

If I use merge partially like this:

export const makeFakeObj = (override?: NestedPartial<MyObj>): MyObj => {
  return mergePartially.deep(
    {
      ids: [],
      types: ["test"],
    },
    override
  );
};

I'm seeing errors referencing the array props:

Types of property 'types' are incompatible.
      Type '_DeepPartialArray<string> | undefined' is not assignable to type '_DeepPartialArray<never> | undefined'.
        Type '_DeepPartialArray<string>' is not assignable to type '_DeepPartialArray<never>'.
          Type 'string' is not assignable to type 'never'.ts(2345)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions