Handle interfaces in the generate-externs task

See #2615.
Fixed.