* ```
*
* See also: {@link Predicate.Any}, {@link Refinement.In}
*
* @since 3.6.0
* @category type-level
*/
export type In (property: P): (self: unknown) => self is { [K in P]: unknown }
/**
* Checks whether a value has a given property key.
*
* When to use:
* - You need to guard property access on `unknown` values.
* - You want a simple structural guard for objects.
*
* Behavior:
* - Pure; does not mutate input.
* - Uses the `in` operator and {@link isObjectKeyword}.
* - Does not check property value types.
*
* **Example** (Guard property)
*
* ```ts
* import { Predicate } from "effect"
*
* const hasName = Predicate.hasProperty("name")
* const data: unknown = { name: "Ada" }
*
* if (hasName(data)) {
* console.log(data.name)
* }
* ```
*
* See also: {@link isTagged}, {@link isObjectKeyword}
*
* @category guards
* @since 2.0.0
*/
(self: unknown, property: P): self is { [K in P]: unknown }
} = dual(
2,
(self: unknown, property: P): self is { [K in P]: unknown } =>
isObjectKeyword(self) && (property in self)
)
/**
* Checks whether a value has a `_tag` property equal to the given tag.
*
* When to use:
* - You model tagged unions with a `_tag` field.
* - You want a quick, structural guard for tagged values.
*
* Behavior:
* - Pure; does not mutate input.
* - Uses {@link hasProperty} and strict equality on `_tag`.
*
* **Example** (Guard tagged)
*
* ```ts
* import { Predicate } from "effect"
*
* const isOk = Predicate.isTagged("Ok")
*
* console.log(isOk({ _tag: "Ok", value: 1 }))
* ```
*
* See also: {@link hasProperty}
*
* @category guards
* @since 2.0.0
*/
export const isTagged: {
/**
* Checks whether a value has a `_tag` property equal to the given tag.
*
* When to use:
* - You model tagged unions with a `_tag` field.
* - You want a quick, structural guard for tagged values.
*
* Behavior:
* - Pure; does not mutate input.
* - Uses {@link hasProperty} and strict equality on `_tag`.
*
* **Example** (Guard tagged)
*
* ```ts
* import { Predicate } from "effect"
*
* const isOk = Predicate.isTagged("Ok")
*
* console.log(isOk({ _tag: "Ok", value: 1 }))
* ```
*
* See also: {@link hasProperty}
*
* @category guards
* @since 2.0.0
*/