Q:

How can I express a function contract in Typescript? 

I have a function that can return undefined when its argument is undefined, otherwise it always returns a value derived from its argument.  For example:
function triple(value?:  number) : number | undefined {
  return value && value * 3;
}

Now when I use this function, I know  that it won't return undefined when I supply a parameter:
const x = 3;
const tripleValue : number = triple(x);

Unsurprisingly, TypeScript gives me TS2322: Type 'number|undefined' is not assignable to type 'number'.  Type 'undefined' is not assignable to type 'number'. 
Is there any way I can tell TypeScript that triple never returns undefined when its argument is defined? 
I'm using TypeScript 3.4.5 with strictNullChecks. 
To reproduce, see this TS playground.  Make sure to click Options and check strictNullChecks. 

A:

I'll answer this myself, as @jonrsharpe hasn't. 
The solution (as per @jonrsharpe's comment) is to create two signatures for the function, using overloads. 
This lets you have two or more different signatures for the same function implementation. 
To express that the function will always return a number when its argument is a number, but may return undefined when its argument is undefined, we need two different signatures:
function triple(value : number) : number;
function triple(value?:  number) : number | undefined {
    return value && value * 3;
}

This lets me use the function without TSC complaining:
const x = 3;
const tripleValue : number = triple(x);

See the TS playground for demonstration, remember to enable strictNullChecks under Options.