Function assertIsDate

Asserts that the input is a Date object.

An error if the input is not a Date object.

const fn = (x: unknown) => {
assertIsDate(x);
return x; // x has inferred type Date
};
  • Parameters

    • x: unknown

      The input value to be asserted.

    Returns asserts x is Date