Rules

no-type-predicate

Use Schema validation instead of handwritten type predicates.

Purpose and behavior

Use Schema validation instead of handwritten type predicates.

The rule reports TypeScript type predicate annotations in arrows and function declarations. The rule allows boolean return annotations. Use Schema or existing Effect predicates to keep validation and type narrowing consistent.

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 provides no automatic fix. Rewrite the code to preserve its intended behavior.

For a boundary exception, use oxlint-disable-next-line rules/no-type-predicate -- reason. Examples cover this rule only and may omit imports or declarations.

Source and tests

Enabled by the Effect preset.

no-type-predicate.ts · Tests