Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`beforeSend`: type `event_id` and `timestamp` as required

Aperta Adatta ai principianti
#25,286 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Inizia tracciando _processEvent attraverso prepareEvent fino a processBeforeSend e individua i tipi di callback beforeSend e beforeSendTransaction in @sentry/core. Aggiorna i tipi dei parametri in modo che gli eventi preparati richiedano event_id e timestamp, quindi esegui i controlli dei tipi TypeScript e i test correlati. Il lavoro è completato quando entrambi i callback espongono questi campi come obbligatori e i tipi di ritorno esistenti dei callback restano invariati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Core Feature: Typescript Meta: Breaking
Problem Statement

beforeSend receives an ErrorEvent, which inherits event_id?: string and timestamp?: number from Event. But by the time beforeSend runs, both are always set: _processEvent only calls processBeforeSend with the result of prepareEvent, which does

event_id: event.event_id || hint.event_id || uuid4(),
timestamp: event.timestamp || dateTimestampInSeconds(),

So a common beforeSend use, like showing the user the event ID in a "report this error" link, needs a ! or a fallback that can never run.

Solution Brainstorm

Type the beforeSend parameter as ErrorEvent & { event_id: string; timestamp: number } (or a named "prepared event" type), and do the same for beforeSendTransaction. This only narrows a callback parameter, so existing callbacks still type-check, and the return type can stay ErrorEvent | null.

Additional Context

@sentry/core 11.6.0

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Lingua principale
TypeScript
Stelle
8.8k
Fork
1.9k
Merge medio
1g 10h
PR unite (30g)
562

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di getsentry/sentry-javascript

Tutte le issue di getsentry/sentry-javascript

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.