title: Transform an existing type into a new type with one property change
body: <p>How to transform an existing type into a new type with one property change?</p>
  <p><a href="https://www.typescriptlang.org/play?#code/C4TwDgpgBAyg9gWwgYUWANhAHgFXNAXigGdgAnASwDsBzKAenqgCsBXUqAMzjKmwEMEGCACgRjKAGN%20VKnGBQARtEkALGTQgATEaEhQA8mGAU4VYgB4cAPihEA3iKjOocYwEYAXErhxMMqAAfKFYqLQhOam0AbicXN2AAJm8qVgRlMliXV2MAZgB%20b3gkVCFMXHws%20OMAFm8cEQBfMQlkAOUpdVptFqYACTgAdyhgOE6NaAT3EbH%20SUkIY1cqdBARslZoGS0oak4IXnlVA5yTMxH8YnzdfCgAaQgQYjsoAGtHuE5DY1NzCxkQNYxJgFGRvPYoABtO67Kj3R7EAC63hh2GAEDCzwA5FMsVB8utNlBvACoM1xEwAOK%20HYACmIqjgrHQO0GPFeAEoRLwHKcvISIAAaU7JKCJYUJXLeLHuLES2reabNHlQCFTbzkTbypLecWnKVQGVy051Q2kMh48kSABC-DpDKZLKU0AOZB4XJVao83k4-HQxCFIsV2oNWPNxoSpqVDCYUxIjOZOw6mtEnr5Go2gYSorD5AjeWl4e1UbJMZF8cdSegqXSB25Ly9wH5Ke1OaL%20uDJsVpYkkoriedsEQKDQ5TwkCAA" rel="nofollow noreferrer">Typesctipt sandbox</a></p>
  <p>Example:</p>
  <pre><code>type SomeComplexType = string // just for example
  
  // cannot be changed
  type Options&lt;T&gt; = {
      opt1: boolean | undefined;
      opt2: number;
      opt3?: SomeComplexType;
      opt4: T
  }
  
  // Can be changed
  
  // How to change opt1 to accept only true and infer other option types?
  type Keys = keyof Options&lt;any&gt;
  
  let r: { [K in Keys]: K extends 'opt1' ? true : any }
  
  // Good (should work)
  r = { opt1: true, opt2: 2, opt3: '1', opt4: 1 }
  r = { opt1: true, opt2: 2, opt3: '1', opt4: 'str' }
  
  // Bad (should be error)
  r = { opt1: false, opt2: 1, opt3: 'str', opt4: 1 } // opt1 should be true
  r = { opt1: true, opt2: 'str', opt3: 'str', opt4: 1 } // opt2 should be number
  r = { opt1: true, opt2: 'str', opt3: 1, opt4: 1 } // opt3 should be 
  </code></pre>