0.1.13 • Published 2 years ago

@thesunny/assert-type v0.1.13

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

AssertType

Getting Started

yarn add @thesunny/assert-type

Writing AssertType asserts

import { AssertType } from ".."

describe("AssertType", () => {
  describe("AssertType.Equal", () => {
    it("should check if two types are not equal", async () => {
      AssertType.NotEqual<0, 1>(true)
    })

    it("should check if two types are exactly equal", async () => {
      AssertType.Equal<88, 88>(true)
    })
  })

  describe("AssertType.Extends", () => {
    it("should check if a type cannot extend another", async () => {
      AssertType.NotExtends<number, 0>(true)
    })

    it("should check if a type can extend another", async () => {
      AssertType.Extends<0, number>(true)
    })
  })
})