openapi-ts icon indicating copy to clipboard operation
openapi-ts copied to clipboard

Add explicit type for jsr compliance

Open wendrul opened this issue 1 year ago • 6 comments

We are trying to publish our client generated through openapi-ts to jsr. However, we run into the following error:


$ npx jsr publish --dry-run

Checking for slow types in the public API...
error[missing-explicit-return-type]: missing explicit return type in the public API
  --> /home/wendrul/windmill-dev/jsr/typescript-client/src/core/CancelablePromise.ts:83:6
   |
83 |   get [Symbol.toStringTag]() {
   |       ^^^^^^^^^^^^^^^^^^^^ this function is missing an explicit return type
   = hint: add an explicit return type to the function

  info: all functions in the public API must have an explicit return type
  docs: https://jsr.io/go/slow-type-missing-explicit-return-type
...

After doing this change the publish command succeeds.

For more info about jsr: https://jsr.io/#why-jsr

wendrul avatar Apr 25 '24 14:04 wendrul

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

⚠️ No Changeset found

Latest commit: e0ddf4c9e392bd06124c6b9eec72330ec134cf1b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Apr 25 '24 14:04 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hey-api-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2024 1:27pm

vercel[bot] avatar Apr 25 '24 14:04 vercel[bot]

Looks good to me, thanks!

mrlubos avatar Apr 25 '24 15:04 mrlubos

I just changed the test files to add the same type annotation on the getter, however please note that I'm not familiar with how your testing works, so make sure that changing those files makes sense

wendrul avatar Apr 26 '24 13:04 wendrul

Yeah there's no rush at all, feel free to use this or close it as you best see fit.

We already found a workaround for now where we just sed this change before publishing to jsr. We also build with --schemas false to avoid the problem from #493.

wendrul avatar Apr 26 '24 16:04 wendrul