-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not require specifying "void" and "Promise<void>" return types #8832
Labels
tests
related to tests
Comments
I believe we dropped the linting rule requiring explicit return type annotations. I will check later but I believe this compiles and passes linting: Deno.test({
name: "Worker with top-level-await",
aync fn() {
const promise = deferred();
const worker = new Worker(
new URL("./worker_with_top_level_await.ts", import.meta.url).href,
{ deno: true, type: "module" },
);
worker.onmessage = (e) => {
console.log("received from worker", e.data);
worker.postMessage("from main");
promise.resolve();
};
await promise;
worker.terminate();
},
}); |
@ry I checked, the following passes type checking and import { deferred } from "https://deno.land/std@0.81.0/async/deferred.ts";
Deno.test({
name: "Worker with top-level-await",
async fn() {
const promise = deferred();
const worker = new Worker(
new URL("./worker_with_top_level_await.ts", import.meta.url).href,
{ deno: true, type: "module" },
);
worker.onmessage = (e) => {
console.log("received from worker", e.data);
worker.postMessage("from main");
promise.resolve();
};
await promise;
worker.terminate();
},
}); Any concerns with that? |
This was referenced Apr 2, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We should strive for concise code.
void
andPromoise<void>
return types are unnecessary boilerplate.Example:
The text was updated successfully, but these errors were encountered: