hyperweb-io / hyperweb-io/ts-codegen

Weird type issue

Ouverte
#95 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
126
Forks
31
Merge moyen
19 min
PR mergées (30 j)
2

Description

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`.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
typescript
Domaine
tooling
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.