typeArgInference2.ts(7,14): error TS2345: Argument of type 'null' is not assignable to parameter of type 'Item | undefined'.
typeArgInference2.ts(9,16): error TS2322: Type 'null' is not assignable to type 'string'.


==== typeArgInference2.ts (2 errors) ====
    interface Item {
        name: string;
    }
    
    declare function foo<T extends Item>(x?: T, y?: T): T;
    
    var z1 = foo(null);                   // any
                 ~~~~
!!! error TS2345: Argument of type 'null' is not assignable to parameter of type 'Item | undefined'.
    var z2 = foo();                       // Item
    var z3 = foo({ name: null });         // { name: any }
                   ~~~~
!!! error TS2322: Type 'null' is not assignable to type 'string'.
    var z4 = foo({ name: "abc" });        // { name: string }
    var z5 = foo({ name: "abc", a: 5 });  // { name: string; a: number }
    var z6 = foo({ name: "abc", a: 5 }, { name: "def", b: 5 });  // error