Typescript Check If Optional Function Parameter Python