mavdotjs
mavdotjsā€¢8mo ago

[SOLVED] Unable to publish to JSR via gh action

I am using wasm to build a package, and I am using esbuild to compile the wasm & js into one js file, and I have added a .d.ts file to type the exported functions. when I run deno publish locally, it publishes just fine, yet in my github action, it claims there are slow types and gives "error[missing-explicit-return-type]: missing explicit return type in the public API" error, it only gives me this error for the funcitons I have declared in the .d.ts file.
4 Replies
mavdotjs
mavdotjsOPā€¢8mo ago
GitHub
this is making me insane Ā· ts-rex/wasm-bcrypt@6f41ba2
Rust written wasm bcrypt impl. Contribute to ts-rex/wasm-bcrypt development by creating an account on GitHub.
mavdotjs
mavdotjsOPā€¢8mo ago
GitHub
wasm-bcrypt/out/wasm.d.ts at master Ā· ts-rex/wasm-bcrypt
Rust written wasm bcrypt impl. Contribute to ts-rex/wasm-bcrypt development by creating an account on GitHub.
mavdotjs
mavdotjsOPā€¢8mo ago
omg did I just fix the issue šŸ¤¦ā€ā™‚ļø I put the wrong filename in the esbuild banner
Deno AI Helper
Deno AI Helperā€¢8mo ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the information you've provided, it seems like the issue might be related to the TypeScript configuration or the way the types are declared in your .d.ts file. The error message "error[missing-explicit-return-type]: missing explicit return type in the public API" suggests that the TypeScript compiler is expecting an explicit return type on functions that are part of the public API. In TypeScript, it's considered good practice to specify the return type of functions explicitly for better type checking and readability. Here's a quick check you can do: Make sure that all functions in your .d.ts file have an explicit return type. For example:
// Incorrect
function myFunction(param: string);

// Correct
function myFunction(param: string): ReturnType;
// Incorrect
function myFunction(param: string);

// Correct
function myFunction(param: string): ReturnType;
Replace ReturnType with the actual type you expect the function to return. Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. It's also possible that the TypeScript version or configuration used in your GitHub Actions environment differs from your local setup, which could lead to different behavior. Make sure that your local environment and CI/CD environment are as consistent as possible regarding versions and configurations.

Did you find this page helpful?