mockdeep / typewiz

Automatically discover and add missing types in your TypeScript code
https://medium.com/@urish/manual-typing-is-no-fun-introducing-typewiz-58e3e8813f4c
1.1k stars 46 forks source link

Don't add `undefined` type to optional arguments #4

Closed urish closed 6 years ago

urish commented 6 years ago

For instance, give the following input:

function optional(b?) {
  return b || 0;
}

console.log(optional() + optional(10));

typewiz would generate: function optional(b?: number|undefined) { while a valid code, the undefined type can be omitted, retaining the same semantics.