I'd like to be able to use [union discrimination](https://basarat.gitbooks.io/typescript/docs/types/discriminated-unions.html) with a generic. However, it doesn't seem to be working:

Example Code ([view on typescript playground)](http://www.typescriptlang.org/play/#src=interface%20Foo%7B%0D%0A%20%20%20%20type%3A%20'foo'%3B%0D%0A%20%20%20%20fooProp%3A%20string%0D%0A%7D%0D%0A%0D%0Ainterface%20Bar%7B%0D%0A%20%20%20%20type%3A%20'bar'%0D%0A%20%20%20%20barProp%3A%20number%0D%0A%7D%0D%0A%0D%0Ainterface%20GenericThing%3CT%3E%20%7B%0D%0A%20%20%20%20item%3A%20T%3B%0D%0A%7D%0D%0A%0D%0A%0D%0Alet%20func%20%3D%20(genericThing%3A%20GenericThing%3CFoo%20%7C%20Bar%3E)%20%3D%3E%20%7B%0D%0A%20%20%20%20if%20(genericThing.item.type%20%3D%3D%3D%20'foo')%20%7B%0D%0A%0D%0A%20%20%20%20%20%20%20%20genericThing.item.fooProp%3B%20%2F%2F%20this%20works%2C%20but%20type%20of%20genericThing%20is%20still%20GenericThing%3CFoo%20%7C%20Bar%3E%0D%0A%0D%0A%20%20%20%20%20%20%20%20let%20fooThing%20%3D%20genericThing%3B%0D%0A%20%20%20%20%20%20%20%20fooThing.item.fooProp%3B%20%2F%2Ferror!%0D%0A%20%20%20%20%7D%0D%0A%7D%0D%0A):

```
interface Foo{
    type: 'foo';
    fooProp: string
}

interface Bar{
    type: 'bar'
    barProp: number
}

interface GenericThing<T> {
    item: T;
}

let func = (genericThing: GenericThing<Foo | Bar>) => {
    if (genericThing.item.type === 'foo') {

        genericThing.item.fooProp; // this works, but type of genericThing is still GenericThing<Foo | Bar>

        let fooThing = genericThing;
        fooThing.item.fooProp; //error!
    }
}

```

I was hoping that typescript would recognize that since I discriminated on the generic `item` property, that `genericThing` must be `GenericThing<Foo>`. 

I'm guess this just isn't supported? 

Also, kinda weird that after straight assignment, it `fooThing.item` loses it's discrimination.