types.ts: LoopCliConfig.maxPrompts docstring claims 'null/undefined' is unlimited, but the type only permits 'undefined'

Open Beginner friendly
#79 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
90/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript
Domain
documentation

Research direction

Open src/types.ts around line 86 and compare the maxPrompts JSDoc with its optional number type. Check schema/loop-the-loop.schema.json to confirm the field is a non-nullable integer. Done means the documentation matches the supported type and schema, with the relevant TypeScript checks or tests passing.

Written by the indexing model from the issue text.

Description

bug S4

Observed behavior

The docstring on LoopCliConfig.maxPrompts in src/types.ts reads:

/**
 * Maximum number of prompts to process. Unlimited when null/undefined.
 */
readonly maxPrompts?: number;

The doc says the field is unlimited when set to null or undefined. But the field's TypeScript type is number | undefined (optional number), so a strict TypeScript caller cannot legally pass null. The implementation in loop.ts does coalesce with ?? Infinity, which would accept null at runtime, but the type contract forbids it.

This is a small TS/JS hazard: a JavaScript caller reading the JSDoc might set maxPrompts: null and have it work; a TypeScript caller doing the same will see a compile error and assume the JSDoc is wrong.

Expected behavior

Either:

  1. The docstring should drop the mention of null and read "Unlimited when omitted" (matching the JSON schema in schema/loop-the-loop.schema.json, which also requires an integer); or
  2. The type should be widened to number | null | undefined if null is genuinely supported.

Option 1 matches existing intent (the JSON schema requires integer >= 0, not nullable).

Minimal reproduction

Open src/types.ts at line 86 and compare the JSDoc with the field type immediately below it. Also note that schema/loop-the-loop.schema.json declares maxPrompts as a non-nullable integer.

Suggested fix

Change the docstring to "Maximum number of prompts to process. Unlimited when omitted."

Dominant language
TypeScript
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from joewalker/loop-the-loop

All issues in joewalker/loop-the-loop

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.