Ocaml has exactly the same kinds of escape hatches, like Obj.magic or unsafe accessors. The way I see it. it's a matter of community practice more than language capabilities. Typescript in practice has has the safety net of being interpreted rather than compiled, so I guess people tend to abuse its type flexibility more.
But if you write without the escape hatches in both languages, in my experience the safety is exactly the same and the cost of that safety is lower in TypeScript.
A very common example I've encountered is values in a const array which you want to iterate on and have guarantees about. TypeScript has a great idiom for this:
```
const arr = ['a', 'b'] as const;
type arrType = typeof arr[number];
for (const x of arr) {
if (x === 'a') {
...
} else {
// Type checker knows x === 'b'
}
}
```
I haven't experienced the same with Ocaml