subbed
subbed4mo ago

deno check does not accept noImplicitReturns

hello. i have the following config inside deno.json:
{
"compilerOptions": {
"strict": true,
"noImplicitReturns": true
},
...
}
{
"compilerOptions": {
"strict": true,
"noImplicitReturns": true
},
...
}
running deno check still allows function signatures without the return type. how can i enforce the deno check to fail if no return type is present?
11 Replies
subbed
subbedOP4mo ago
for example, deno check does not error on the following, even though the Response return type is not provided:
const rootHandler = (ctx: Context) => {
return ctx.json({ shade: "?", random: randomInt(0, 256) });
};
const rootHandler = (ctx: Context) => {
return ctx.json({ shade: "?", random: randomInt(0, 256) });
};
please ping me if you reply to this post, thank you
bartlomieju
bartlomieju4mo ago
@subbed could you please open an issue in Deno repo about it? It looks like a bug
subbed
subbedOP4mo ago
GitHub
deno check does not enforce noImplicitReturns · Issue #26265 · deno...
deno 2.0.0 (stable, release, x86_64-unknown-linux-gnu) v8 12.9.202.13-rusty typescript 5.6.2 deno check seemigly does not enforce the noImplicitReturns clause. Having the following deno.json snippe...
bartlomieju
bartlomieju4mo ago
Thank you :deno_thankyou:
Danyil
Danyil4mo ago
as temporary workaround you can use biome.js along with deno lint
subbed
subbedOP4mo ago
i have used biome for quite a while now. regardless, it is an additional config file on the root, so a fix would be appreciated
Danyil
Danyil4mo ago
as i said, temporary
subbed
subbedOP4mo ago
correct, and as i said, i have been using it thus far. thank you for your recommendation regardless
subbed
subbedOP4mo ago
@bartlomieju ok so, considering this reply here on the issue, is there even an option to truly enforce strict checks, enforcing return types? https://github.com/denoland/deno/issues/26265#issuecomment-2413938566
GitHub
deno check does not enforce noImplicitReturns · Issue #26265 · deno...
deno 2.0.0 (stable, release, x86_64-unknown-linux-gnu) v8 12.9.202.13-rusty typescript 5.6.2 deno check seemigly does not enforce the noImplicitReturns clause. Having the following deno.json snippe...
bartlomieju
bartlomieju4mo ago
TBH I'm not sure - we're at the mercy of TS compiler here - if it has an option for it then we support it Responded in the issue - we have a lint for that https://lint.deno.land/rules/explicit-function-return-type
subbed
subbedOP4mo ago
ah, awesome, thank you!

Did you find this page helpful?