tests/cases/conformance/types/mapped/mappedTypes6.ts(23,5): error TS2322: Type 'T' is not assignable to type 'Required<T>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(24,5): error TS2322: Type 'Partial<T>' is not assignable to type 'Required<T>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(27,5): error TS2322: Type 'Partial<T>' is not assignable to type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'Partial<T>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(37,5): error TS2322: Type 'Required<T>' is not assignable to type 'Denullified<T>'.
  Type 'T[P]' is not assignable to type 'NonNullable<T[P]>'.
    Type 'T[keyof T]' is not assignable to type 'NonNullable<T[P]>'.
      Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'NonNullable<T[P]>'.
        Type 'T[string]' is not assignable to type 'NonNullable<T[P]>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(38,5): error TS2322: Type 'T' is not assignable to type 'Denullified<T>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(39,5): error TS2322: Type 'Partial<T>' is not assignable to type 'Denullified<T>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(42,5): error TS2322: Type 'T' is not assignable to type 'Required<T>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(43,5): error TS2322: Type 'Partial<T>' is not assignable to type 'Required<T>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(47,5): error TS2322: Type 'Partial<T>' is not assignable to type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'Partial<T>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(56,5): error TS2322: Type '{}' is not assignable to type 'Denullified<T>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(57,5): error TS2322: Type '{}' is not assignable to type 'Required<T>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(58,5): error TS2322: Type '{}' is not assignable to type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to '{}'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(92,1): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type 'Foo'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(104,1): error TS2739: Type '{ a: number; }' is missing the following properties from type 'Required<Foo>': b, c, d
tests/cases/conformance/types/mapped/mappedTypes6.ts(105,1): error TS2739: Type '{ a: number; b: number; }' is missing the following properties from type 'Required<Foo>': c, d
tests/cases/conformance/types/mapped/mappedTypes6.ts(106,1): error TS2741: Property 'd' is missing in type '{ a: number; b: number; c: number; }' but required in type 'Required<Foo>'.
tests/cases/conformance/types/mapped/mappedTypes6.ts(116,4): error TS2540: Cannot assign to 'b' because it is a read-only property.
tests/cases/conformance/types/mapped/mappedTypes6.ts(119,4): error TS2540: Cannot assign to 'a' because it is a read-only property.
tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Cannot assign to 'b' because it is a read-only property.


==== tests/cases/conformance/types/mapped/mappedTypes6.ts (19 errors) ====
    type T00<T> = { [P in keyof T]: T[P] };
    type T01<T> = { [P in keyof T]?: T[P] };
    type T02<T> = { [P in keyof T]+?: T[P] };
    type T03<T> = { [P in keyof T]-?: T[P] };
    
    type T04<T> = { readonly [P in keyof T]: T[P] };
    type T05<T> = { readonly [P in keyof T]?: T[P] };
    type T06<T> = { readonly [P in keyof T]+?: T[P] };
    type T07<T> = { readonly [P in keyof T]-?: T[P] };
    
    type T08<T> = { +readonly [P in keyof T]: T[P] };
    type T09<T> = { +readonly [P in keyof T]?: T[P] };
    type T10<T> = { +readonly [P in keyof T]+?: T[P] };
    type T11<T> = { +readonly [P in keyof T]-?: T[P] };
    
    type T12<T> = { -readonly [P in keyof T]: T[P] };
    type T13<T> = { -readonly [P in keyof T]?: T[P] };
    type T14<T> = { -readonly [P in keyof T]+?: T[P] };
    type T15<T> = { -readonly [P in keyof T]-?: T[P] };
    
    function f1<T>(x: Required<T>, y: T, z: Partial<T>) {
        x = x;
        x = y;  // Error
        ~
!!! error TS2322: Type 'T' is not assignable to type 'Required<T>'.
        x = z;  // Error
        ~
!!! error TS2322: Type 'Partial<T>' is not assignable to type 'Required<T>'.
        y = x;
        y = y;
        y = z;  // Error
        ~
!!! error TS2322: Type 'Partial<T>' is not assignable to type 'T'.
!!! error TS2322:   'T' could be instantiated with an arbitrary type which could be unrelated to 'Partial<T>'.
        z = x;
        z = y;
        z = z;
    }
    
    type Denullified<T> = { [P in keyof T]-?: NonNullable<T[P]> };
    
    function f2<T>(w: Denullified<T>, x: Required<T>, y: T, z: Partial<T>) {
        w = w;
        w = x;  // Error
        ~
!!! error TS2322: Type 'Required<T>' is not assignable to type 'Denullified<T>'.
!!! error TS2322:   Type 'T[P]' is not assignable to type 'NonNullable<T[P]>'.
!!! error TS2322:     Type 'T[keyof T]' is not assignable to type 'NonNullable<T[P]>'.
!!! error TS2322:       Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'NonNullable<T[P]>'.
!!! error TS2322:         Type 'T[string]' is not assignable to type 'NonNullable<T[P]>'.
        w = y;  // Error
        ~
!!! error TS2322: Type 'T' is not assignable to type 'Denullified<T>'.
        w = z;  // Error
        ~
!!! error TS2322: Type 'Partial<T>' is not assignable to type 'Denullified<T>'.
        x = w;
        x = x;
        x = y;  // Error
        ~
!!! error TS2322: Type 'T' is not assignable to type 'Required<T>'.
        x = z;  // Error
        ~
!!! error TS2322: Type 'Partial<T>' is not assignable to type 'Required<T>'.
        y = w;
        y = x;
        y = y;
        y = z;  // Error
        ~
!!! error TS2322: Type 'Partial<T>' is not assignable to type 'T'.
!!! error TS2322:   'T' could be instantiated with an arbitrary type which could be unrelated to 'Partial<T>'.
        z = w;
        z = x;
        z = y;
        z = z;
    }
    
    
    function f3<T>(w: Denullified<T>, x: Required<T>, y: T, z: Partial<T>) {
        w = {};  // Error
        ~
!!! error TS2322: Type '{}' is not assignable to type 'Denullified<T>'.
        x = {};  // Error
        ~
!!! error TS2322: Type '{}' is not assignable to type 'Required<T>'.
        y = {};  // Error
        ~
!!! error TS2322: Type '{}' is not assignable to type 'T'.
!!! error TS2322:   'T' could be instantiated with an arbitrary type which could be unrelated to '{}'.
        z = {};
    }
    
    type Readwrite<T> = {
        -readonly [P in keyof T]: T[P];
    }
    
    function f10<T>(x: Readonly<T>, y: T, z: Readwrite<T>) {
        x = x;
        x = y;
        x = z;
        y = x;
        y = y;
        y = z;
        z = x;
        z = y;
        z = z;
    }
    
    type Foo = {
        a: number;
        b: number | undefined;
        c?: number;
        d?: number | undefined;
    }
    
    declare let x1: Foo;
    
    x1.a;  // number
    x1.b;  // number | undefined
    x1.c;  // number | undefined
    x1.d;  // number | undefined
    
    x1 = { a: 1 };  // Error
    ~~
!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type 'Foo'.
!!! related TS2728 tests/cases/conformance/types/mapped/mappedTypes6.ts:80:5: 'b' is declared here.
    x1 = { a: 1, b: 1 };
    x1 = { a: 1, b: 1, c: 1 };
    x1 = { a: 1, b: 1, c: 1, d: 1 };
    
    declare let x2: Required<Foo>;
    
    x1.a;  // number
    x1.b;  // number | undefined
    x1.c;  // number
    x1.d;  // number
    
    x2 = { a: 1 };  // Error
    ~~
!!! error TS2739: Type '{ a: number; }' is missing the following properties from type 'Required<Foo>': b, c, d
    x2 = { a: 1, b: 1 };  // Error
    ~~
!!! error TS2739: Type '{ a: number; b: number; }' is missing the following properties from type 'Required<Foo>': c, d
    x2 = { a: 1, b: 1, c: 1 };  // Error
    ~~
!!! error TS2741: Property 'd' is missing in type '{ a: number; b: number; c: number; }' but required in type 'Required<Foo>'.
!!! related TS2728 tests/cases/conformance/types/mapped/mappedTypes6.ts:82:5: 'd' is declared here.
    x2 = { a: 1, b: 1, c: 1, d: 1 };
    
    type Bar = {
        a: number;
        readonly b: number;
    }
    
    declare let x3: Bar;
    x3.a = 1;
    x3.b = 1;  // Error
       ~
!!! error TS2540: Cannot assign to 'b' because it is a read-only property.
    
    declare let x4: Readonly<Bar>;
    x4.a = 1;  // Error
       ~
!!! error TS2540: Cannot assign to 'a' because it is a read-only property.
    x4.b = 1;  // Error
       ~
!!! error TS2540: Cannot assign to 'b' because it is a read-only property.
    
    declare let x5: Readwrite<Bar>;
    x5.a = 1;
    x5.b = 1;
    