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
noImplicitReturns
seems to be enabled
#369
Comments
This is a great catch, however it looks like this is actually a bug in typescript. Check out these tests in TypeScript playground: With noImplicitReturns set to false: https://www.typescriptlang.org/play?strict=false&noImplicitReturns=false#code/GYVwdgxgLglg9mABAGznA1iADgCQKYCGAJlgBYJ4DOAsgWCMAdCAE54sAUEcqLAXIgBEAI2Qg8gxAB8hopukEBKAZSgsYYAOaIA3gChEiGMERcecFogC8N2WImLdBw4jZRWSEYSiVBAbmcAX0Q8ZEo8JxdZOHD-IL1AoA Both give the same error. The docs are correct, in that noImplicitReturns is set to false by default. |
It's not a bug in TypeScript. The error is because the function also returns export function lookupHeadphonesManufacturer(color: "blue" | "black"): string | undefined { // need to update to this
if (color === "blue") {
return "beats";
} else {
"bose";
// because this function implicitly returns undefined here
}
} Once that's done then there won't be an error, but with
|
According to the documentation
noImplicitReturns
is not enabled by default:deno-docs/runtime/manual/advanced/typescript/configuration.md
Line 56 in fc68d84
Taking the TypeScript example code for this option it errors.
This is exactly the message documented for this TypeScript option. I think the documentation is wrong here, and this option is enabled by default?
Interestingly when setting it to false via
deno.json
the error still comes up viadeno check
.I want this check, so it's not a problem for me. I just want to have the documentation being correct.
The text was updated successfully, but these errors were encountered: