Skip to main content

Built and signed on GitHub Actions

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
52%
Published
a week ago (0.1.1)
type alias IsEqual

Returns a boolean for whether the two given types are equal.

https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796

Use-cases:

  • If you want to make a conditional branch based on the result of a comparison of two types.

Examples

Example 1

import type {IsEqual} from 'type-fest';

// This type returns a boolean for whether the given array includes the given item.
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
type Includes<Value extends readonly any[], Item> =
	Value extends readonly [Value[0], ...infer rest]
		? IsEqual<Value[0], Item> extends true
			? true
			: Includes<rest, Item>
		: false;

Type Parameters

Definition

(<G>() => G extends A ? 1 : 2) extends <G>() => G extends B ? 1 : 2 ? true : false

Add Package

deno add jsr:@inngest/realtime

Import symbol

import { type IsEqual } from "@inngest/realtime";

---- OR ----

Import directly with a jsr specifier

import { type IsEqual } from "jsr:@inngest/realtime";

Add Package

npx jsr add @inngest/realtime

Import symbol

import { type IsEqual } from "@inngest/realtime";

Add Package

yarn dlx jsr add @inngest/realtime

Import symbol

import { type IsEqual } from "@inngest/realtime";

Add Package

pnpm dlx jsr add @inngest/realtime

Import symbol

import { type IsEqual } from "@inngest/realtime";

Add Package

bunx jsr add @inngest/realtime

Import symbol

import { type IsEqual } from "@inngest/realtime";