noRuntimeInTypeFileType files are exempt from runtime tests because they must erase completely. Move this runtime code to a tested source module.small-rules/no-runtime-in-type-filesDisallow runtime code in files that hold only types.
Some projects exempt type files from their test rules by filename. That’s only safe while the files contain
nothing that runs. Runtime code added there escapes its tests. This rule reports each top-level statement in
a matching file that stays in the output. That covers values, functions, classes, enums, namespaces, bare
imports, and imports or exports of values. Type imports and exports pass, and so do interfaces, type
aliases, function signatures, and declare forms.
files holds the glob patterns for those files, matched against the full path. The default,
**/packages/*/src/lib/**/*-types.ts, covers *-types.ts modules under a package’s src/lib.
noRuntimeInTypeFileType files are exempt from runtime tests because they must erase completely. Move this runtime code to a tested source module.This rule accepts one options object after the severity.
import type { Input } from "./input";export const value = 1;import type { Input } from "./input";declare const brand: unique symbol;export interface Output { readonly value: Input; }export type Branded = Output & { readonly [brand]: true };