Represents some type-level error which forces immediate attention rather than failing at runtime.
More inflexable type than never, and gives contextual error messages.
never
function unsupported(): TypeErr<'Unsupported operation'> { throw new Error('Unsupported operation');}// Doesn't compile with error:// Type TypeErr<'Unsupported operation'> is not assignable to type stringconst result: string = unsupported(); Copy
function unsupported(): TypeErr<'Unsupported operation'> { throw new Error('Unsupported operation');}// Doesn't compile with error:// Type TypeErr<'Unsupported operation'> is not assignable to type stringconst result: string = unsupported();
Represents some type-level error which forces immediate attention rather than failing at runtime.
More inflexable type than
never
, and gives contextual error messages.