Skip to content

tag

tag<Tag>(tag): tag<Tag>

Defined in: node_modules/.pnpm/effect@3.14.8/node_modules/effect/dist/dts/Schema.d.ts:1394

Returns a property signature that represents a tag. A tag is a literal value that is used to distinguish between different types of objects. The tag is optional when using the make method.

Type Parameters

Tag extends LiteralValue

Parameters

tag

Tag

Returns

tag<Tag>

Example

import * as assert from "node:assert"
import { Schema } from "effect"
const User = Schema.Struct({
_tag: Schema.tag("User"),
name: Schema.String,
age: Schema.Number
})
assert.deepStrictEqual(User.make({ name: "John", age: 44 }), { _tag: "User", name: "John", age: 44 })

See

TaggedStruct

Since

3.10.0