Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

index.ts: LoopState is part of the PromptGenerator extension contract but is not re-exported from the package root

Abierto Apto para principiantes
#39 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
1/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
88/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
api

Línea de trabajo

Empieza en src/index.ts y compara sus exportaciones públicas de tipos con la definición de LoopState en src/util/loop-state.ts. Comprueba el uso existente en src/test/loop.test.ts y, después, ejecuta las pruebas de TypeScript pertinentes o la compilación. Se considera terminado cuando un consumidor puede importar LoopState desde la raíz del paquete sin usar la subruta no documentada.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug S3

Observed behavior

src/index.ts re-exports the types needed to implement the documented extension points (Agent, PromptGenerator, Reporter) but it does not re-export LoopState. LoopState appears in the public PromptGenerator contract:

// src/prompt-generators.ts
export interface PromptGenerator {
  generate(loopState: LoopState): AsyncIterable<Prompt>;
}

A consumer who follows the README's "Custom Prompt Generator" pattern and depends only on the package root cannot type the loopState parameter:

import type { Prompt, PromptGenerator } from 'loop-the-loop';
import type { LoopState } from 'loop-the-loop';
// error TS2305: Module '"loop-the-loop"' has no exported member 'LoopState'.

The class still has to declare a parameter, so today the only working option is to reach into an undocumented subpath:

import type { LoopState } from 'loop-the-loop/util/loop-state';

The in-tree integration test already does exactly this (src/__test__/loop.test.ts line 18), which suggests it was not a deliberate omission so much as a missing re-export.

Expected behavior

LoopState should be re-exported from src/index.ts so that a downstream PromptGenerator implementation can be written using only import ... from 'loop-the-loop'. The README in fact already advertises this contract:

All extension-relevant types are exported from the package root (src/index.ts)

LoopState is currently the only extension-relevant type that violates that claim.

Minimal reproduction

// repro.ts
import type { Prompt, PromptGenerator } from 'loop-the-loop';
import type { LoopState } from 'loop-the-loop';

class MyGen implements PromptGenerator {
  async *generate(_state: LoopState): AsyncIterable<Prompt> {
    yield { id: '1', prompt: 'hi' };
  }
}
$ tsc --noEmit repro.ts
repro.ts(2,15): error TS2305: Module '"loop-the-loop"' has no exported member 'LoopState'.

Suggested fix

Add a type-only re-export to src/index.ts:

export type { LoopState } from './util/loop-state.js';

LoopState exposes mutating methods (begin, end, save), so a type-only export feels right for the extension surface; consumers of PromptGenerator only need isOutstanding(id) to author a generator.

Severity

S3. The library is still usable: the deep import path works thanks to the "./*" wildcard in package.json#exports. The bug is that the documented extension contract is incomplete, so writing a custom PromptGenerator from the package root currently requires an undocumented internal path.

Lenguaje dominante
TypeScript
Estrellas
2
Forks
1
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de joewalker/loop-the-loop

Todos los issues de joewalker/loop-the-loop

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.