Defining types that enforce a runtime structure (Schema validation logic).
Validator<T>(val: unknown) => Ttype Validator<T> = (val: unknown) => T;
const stringVal: Validator<string> = (v) => {
if (typeof v !== 'string') throw 'err';
return v;
};