From Optional to Gradual Typing via Transient Checks