Rules

no-type-predicate

Prefer schema-derived validation to hand-written type predicates.

Purpose and behavior

Prefer schema-derived validation to hand-written type predicates.

Reports TypeScript type predicate annotations, including arrow and function declarations. Ordinary boolean return annotations are allowed. Use Schema or existing Effect predicates where validation and narrowing need to stay aligned.

Options

No configurable options. Enable with "rules/no-type-predicate": "error".

Invalid example

const isUser = (value: unknown): value is User => true

Valid example

const check = (value: unknown): boolean => Boolean(value)

Fixes and exceptions

This rule reports diagnostics without an automatic fix. Rewrite the code deliberately rather than guessing its intended semantics.

For a genuine boundary exception, use an oxlint-disable-next-line rules/no-type-predicate -- reason comment. Examples illustrate this rule alone and may omit imports and declarations.

Source and tests

Enabled by the Effect preset.

no-type-predicate.ts · Tests