hyperweb-io / hyperweb-io/ts-codegen

Weird type issue

Offen
#95 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
126
Forks
31
Ø Merge
19 Min.
Gemergte PRs (30 T.)
2

Beschreibung

While generating the schema for a query message that returns `Option`, ts-codegen fails with:

```
contracts/cw-vesting/CwVesting.client.ts:25:31 - error TS2552: Cannot find name 'NullableDuration'. Did you mean 'Nullable_Duration'?

25 vestDuration: () => Promise;
~~~~~~~~~~~~~~~~

contracts/cw-vesting/CwVesting.client.ts:81:36 - error TS2552: Cannot find name 'NullableDuration'. Did you mean 'Nullable_Duration'?

81 vestDuration = async (): Promise => {
~~~~~~~~~~~~~~~~
```

It appears that it generates a type `Nullable_Duration` that is correct, and the uses a different one `NullableDuration` as the query return value. [This CI job](https://github.com/DA0-DA0/dao-contracts/actions/runs/4358741481/jobs/7619698495) has a branch on which this fails. You can reproduce the issue by checking out that branch and running ts-codegen with `just gen`.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Check out the linked reproduction branch and run `just gen` to inspect the generated `contracts/cw-vesting/CwVesting.client.ts`. Trace how the `Option` query return type becomes `Nullable_Duration` while its uses become `NullableDuration`; done means the generated client consistently references the declared type and compiles without the reported TypeScript errors.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.