hyperweb-io / hyperweb-io/ts-codegen

Weird type issue

オープン
#95 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
126
フォーク
31
平均マージ
19分
マージ済み PR(30日)
2

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。