Skip to content

Incorrect inferred type with allowUndefinedOverrides: false #33

@tippfelher

Description

@tippfelher
import { merge } from "ts-deepmerge";

const a: { o: string } = { o: "Hello" };

const b: { o?: string } = {};

const c = merge.withOptions({ allowUndefinedOverrides: false }, a, b);

// this is incorrect
//   c is of type { o: string | undefined }
// but should be
//   { o: string }
// since c.o can never be undefined

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