The structure てよかった is used to express relief or gladness about something that happened or a decision that was made. It translates naturally to "I'm glad that…" or "It was good that…" in English. It reflects on a past event or action and expresses a positive feeling about the outcome.
Attach よかった (the past form of いい) to the て-form of a verb to express that you are glad something happened.
To express relief that something did not happen, use the negative て-form (〜~なくて) followed by よかった.
Be careful not to confuse てよかった (glad something happened) with ~ばよかった (wish something had happened). They express opposite feelings:
てよかった is used in everyday conversation to reflect on outcomes. Add です at the end for polite speech. It often appears with the particle ね to invite agreement or share the feeling of relief: