Skip to content

Missing optional modifier in conversion of eagerly resolved mapped types #2200

@Gerrit0

Description

@Gerrit0

Search terms

missing optional, mapped types

Bug

When TypeDoc is given the following to document, it says the type of Test is { x: 1 | undefined } instead of { x?: 1 | undefined }

declare function buildObj<T>(x: T): {
    [K in keyof T]?: 1;
};

export const Test = buildObj({ x: 1 });

This happens with exactOptionalPropertyTypes both on and off.

Environment

  • Typedoc version: 0.23 + 0.24
  • TypeScript version: 4.9.5
  • Node.js version: 18
  • OS: Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions