Skip to content

Mapped types shouldn't transform unknown type #29793

Open
@falsandtru

Description

@falsandtru

@ahejlsberg Probably #29740 made this regression.

TypeScript Version: 3.4.0-dev.20190207

Search Terms:

Code

type DeepReadonly<T> =
  T extends void ? T :
  { readonly [P in keyof T]: DeepReadonly<T[P]>; };
type m = { a: unknown }; // Also unknown[].
type i = DeepReadonly<m>;

Expected behavior:

i is { readonly a: unknown; }.

Actual behavior:

i is { readonly a: {}; }.

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions