Support nullable params and returns in generated externs

See #2615.