Under EU law you can be bond for training costs up to two years and it has to be pro-rata (decrease with time).
If you ask for a leave of absence the bond stalls until you return.
But it's my understanding that if the training is a sinequanon requisite for you to work for the company, the bond is not valid.
For instance I understand you cannot be bond for the OCC, or when you join a flight school for the instructor standardisation.
A type rating is a grey area and I guess it depends on the country, judge, and how good your lawyer is presenting the case.
Having said that, if I was working for an honest corporation and I left because I found something better I would honor the agreement.