Skip to content

tag

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

Defined in: node_modules/.pnpm/effect@3.15.2/node_modules/effect/dist/dts/Schema.d.ts:1369

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.

Tag extends LiteralValue

Tag

tag<Tag>

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 })

TaggedStruct

3.10.0