narrow
The method narrows the variable model doc type. It’s available on Doc
.
The method accepts a function that has to return the data of the target type or undefined
.
It allows checking the data structure on the runtime and also asserts the type. If the data structure checks aren’t sufficient, it will result in a type error.