Repository: TypeScript
Issue: Generic derived value type
Labels: Suggestion,Experience Enhancement,Domain: Conditional Types

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section!

Please help us by doing the following steps before logging an issue:
  * Search: https://github.com/Microsoft/TypeScript/search?type=Issues
  * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ

Please fill in the *entire* template below.
-->
Hey guys.
I can not see if I'm doing anything wrong here. I am expecting to be able to get exact type from generic type ...
Is this just limitation of typescript or i am doing anything whrong here?


<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:**  3.1.3

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:**
Generic derived value type

**Code**

```ts
export type filterTypeName = 'price' | 'price_range';
export type priceFilterValue = {
  from: number;
  to: number;
};
export type priceRangeFilterValue = {
  fromRange: number;
  toRange: number;
};

export type filterValueType<T extends filterTypeName> =  
    T extends 'price' ? priceFilterValue
    : T extends 'price_range' ? priceRangeFilterValue : never;


type productFilterParameters<T extends filterTypeName> = {
  filter: T;
    value: filterValueType<T>;
};

function addProductFilter<T extends filterTypeName>(params: productFilterParameters<T>) { 
    switch (params.filter) { 
        case 'price':
            const priceFrom = params.value.from; //Property 'from' does not exist on type 'filterValueType<T>'    
            break;
        default:
            break;            
    }
}

// parameter value is derivered based on filter type... not working id function definition
addProductFilter({ filter: 'price', value: { from: 1, to: 2 } });

//expected behavior something like this

type productFilterParametersCorrect = {
    filter: 'price';
    value: priceFilterValue;
} | {
    filter: 'price_range';
    value: priceRangeFilterValue;
}

function addProductFilterCorrect(params: productFilterParametersCorrect) { 
    switch (params.filter) { 
        case 'price':            
            const priceFrom = params.value.from; // correct
            break;
        case 'price_range':
            const priceRangeFrom = params.value.fromRange; // correct
        default:
            break;            
    }
}
```

**Expected behavior:**
**Code**
```ts
const value: priceFilterValue
```
**Actual behavior:**
**Code**
```ts
const value: filterValueType<T>
```
**Playground Link:** 
[Playground](http://www.typescriptlang.org/play/#src=export%20type%20filterTypeName%20%3D%20'price'%20%7C%20'price_range'%3B%0D%0Aexport%20type%20priceFilterValue%20%3D%20%7B%0D%0A%20%20priceRangeFrom%3A%20number%3B%0D%0A%20%20priceRangeTo%3A%20number%3B%0D%0A%7D%3B%0D%0Aexport%20type%20priceRangeFilterValue%20%3D%20%7B%0D%0A%20%20from%3A%20number%3B%0D%0A%20%20to%3A%20number%3B%0D%0A%7D%3B%0D%0A%0D%0Aexport%20type%20filterValueType%3CT%20extends%20filterTypeName%3E%20%3D%20%20%0D%0A%20%20%20%20T%20extends%20'price'%20%3F%20priceFilterValue%0D%0A%20%20%20%20%3A%20T%20extends%20'price_range'%20%3F%20priceRangeFilterValue%20%3A%20never%3B%0D%0A%0D%0A%0D%0Atype%20productFilterParameters%3CT%20extends%20filterTypeName%3E%20%3D%20%7B%0D%0A%20%20filter%3A%20T%3B%0D%0A%20%20value%3A%20filterValueType%3CT%3E%3B%20%20%0D%0A%20%20clearOtherFilters%3A%20boolean%3B%0D%0A%7D%3B%0D%0A%0D%0Afunction%20addProductFilter%3CT%20extends%20filterTypeName%3E(params%3A%20productFilterParameters%3CT%3E)%20%7B%20%0D%0A%20%20%20%20switch%20(params.filter)%20%7B%20%0D%0A%20%20%20%20%20%20%20%20case%20'price'%3A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20const%20value%20%3D%20params.value%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20break%3B%0D%0A%20%20%20%20%20%20%20%20default%3A%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20break%3B%20%20%20%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%7D%0D%0A%7D)

**Related Issues:** <!-- Did you find other bugs that looked similar? -->