Skip to content

Instantly share code, notes, and snippets.

@thebeebs
Created February 12, 2014 21:24
Show Gist options
  • Save thebeebs/8964846 to your computer and use it in GitHub Desktop.
Save thebeebs/8964846 to your computer and use it in GitHub Desktop.
You can make (c) optional by postfixing it with a question mark. This means it's still there but it is not required. If you do try and pass C it must be of type boolean. Therefore the param is optional however the type is not.
interface Thing {
a: number;
b: string;
c?: boolean;
}
function process(x: Thing){
return x.a;
}
var n = process({a: 10, b:'Beeby', c:'fail' });
n.toFixed(0.0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment