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

Playground static-assets example throws ReferenceError on Submit because message is undefined, hidden by another example's ambient global

Abierto Apto para principiantes
#1,805 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
85/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
react, typescript
Área
frontend, testing

Línea de trabajo

Empieza con apps/playground/src/instruments/examples/interactive/Interactive-With-Static-Assets/index.ts y su fragment.html; compara el controlador Submit con la validationSchema del ejemplo. Lee también Interactive-With-Legacy-Script/legacy.d.ts para entender por qué la comprobación de tipos no detecta el identificador indefinido. Añade una comprobación de extremo a extremo en testing/src/specs/playground.spec.ts; se considera terminado cuando al enviar este ejemplo se completa correctamente con un mensaje válido.

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

Descripción

Area: Playground Bug Difficulty: Low Good First Issue Priority: Low

The playground's "Interactive Instrument with Static Assets" example can never be completed. Its Submit handler calls done({ message }), but nothing in the instrument defines message, so clicking Submit throws ReferenceError: message is not defined and done is never called. Type-checking does not catch it, because a different example, Interactive-With-Legacy-Script/legacy.d.ts, declares declare let message: 'hello' as an ambient global. That declaration is in scope for every file under apps/playground/src, so tsc (and pnpm lint) accept the undefined identifier.

Where

apps/playground/src/instruments/examples/interactive/Interactive-With-Static-Assets/index.ts:18-23:

render(done) {
  const button = document.getElementById('submit-btn')!;
  button.addEventListener('click', () => {
    done({ message });
  });
},

The global that hides it, apps/playground/src/instruments/examples/interactive/Interactive-With-Legacy-Script/legacy.d.ts:1:

declare let message: 'hello';

fragment.html has no element with id="message" either, so no named-element global exists at runtime.

Reproduce

  1. Open the playground and select Examples → Interactive Instrument with Static Assets.
  2. Click Submit in the preview.

Actual: the browser console shows ReferenceError: message is not defined, and the instrument never completes.
Expected: the instrument completes with a message string that satisfies its validationSchema.

Tests

The playground's vitest project only covers pure modules, so the e2e test is the guard: in testing/src/specs/playground.spec.ts, select this example, click Submit in the preview frame, and assert that the instrument reaches its completed state.

Suggested fix

Pass a literal, e.g. done({ message: 'Hello' }). Then scope the legacy example's ambient declaration so it cannot mask undefined identifiers in other examples, for example by declaring it as window.message (declare global { interface Window { message: 'hello' } }) and reading it as window.message in that example.

Lenguaje dominante
TypeScript
Estrellas
119
Forks
19
Merge medio
1 d 2 h
PR fusionados (30 d)
56

Preparar el entorno

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 DouglasNeuroInformatics/OpenDataCapture

Todos los issues de DouglasNeuroInformatics/OpenDataCapture

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.