In software engineering, type safety is a mundane promise with enormous consequences: a value cannot…