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

fix: Ignore declarations used by code snippets that will never end up in the WGSL code

Aperta
#3,203 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

The reproduction is a test that calls tgpu.resolve([fn]) and checks the output with toMatchInlineSnapshot; run it first and compare the generated WGSL against the snapshot. The issue is that helper is emitted even though its only use sits in a branch that never reaches the output. Find where the resolver collects dependent declarations and where it decides which ones to emit. Done means helper is omitted in that case and the snapshot is updated.

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

Descrizione

[!NOTE]
This might not be worth the effort

This is not super urgent, it's mostly a cosmetic issue, but we might be able to (in rare cases) reduce the amount of code we generate.

test('...', ({ root }) => {
  const helper = () => {
    'use gpu';
    return 0;
  };
  const fn = () => {
    'use gpu';
    if (std.typeOf(helper()) === d.i32) {
      return 1;
    } else {
      return 0;
    }
  };

  expect(tgpu.resolve([fn])).toMatchInlineSnapshot(`
    "fn helper() -> i32 {
      return 0;
    }

    fn fn_1() -> i32 {
      return 1;
    }"
  `);
});
Lingua principale
TypeScript
Stelle
3.3k
Fork
135
Merge medio
4g 1h
PR unite (30g)
64

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 software-mansion/TypeGPU

Tutte le issue di software-mansion/TypeGPU

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.