Hyperlinkv0.8.0-beta.28

Schema

Schema.UniqueSymbolfunctioneffect/Schema.ts:3157
UniqueSymbol<sym>

Creates a schema for a specific symbol. Only that exact symbol satisfies the schema.

Example (Defining a specific symbol)

import { Schema } from "effect"

const mySymbol = Symbol.for("mySymbol")
const schema = Schema.UniqueSymbol(mySymbol)
constructorsSymbol
Source effect/Schema.ts:315723 lines
export interface UniqueSymbol<sym extends symbol>
  extends Bottom<sym, sym, never, never, SchemaAST.UniqueSymbol, UniqueSymbol<sym>>
{}

/**
 * Creates a schema for a specific symbol. Only that exact symbol satisfies the schema.
 *
 * **Example** (Defining a specific symbol)
 *
 * ```ts
 * import { Schema } from "effect"
 *
 * const mySymbol = Symbol.for("mySymbol")
 * const schema = Schema.UniqueSymbol(mySymbol)
 * ```
 *
 * @see {@link Symbol} for a schema that accepts any symbol.
 * @category constructors
 * @since 4.0.0
 */
export function UniqueSymbol<const sym extends symbol>(symbol: sym): UniqueSymbol<sym> {
  return make(new SchemaAST.UniqueSymbol(symbol))
}
Referenced by 1 symbols