Skip to content
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

[perf] deno source code should explicit return type #2777

Closed
loynoir opened this issue Oct 14, 2022 · 1 comment
Closed

[perf] deno source code should explicit return type #2777

loynoir opened this issue Oct 14, 2022 · 1 comment

Comments

@loynoir
Copy link
Contributor

loynoir commented Oct 14, 2022

https://typescript-eslint.io/rules/explicit-function-return-type/

Functions in TypeScript often don't need to be given an explicit return type annotation. Leaving off the return type is less > code to read or write and allows the compiler to infer it from the contents of the function.

However, explicit return types do make it visually more clear what type is returned by a function. They can also speed up > TypeScript type checking performance in large codebases with many large functions.

This rule enforces that functions do have an explicit return type annotation.

1 + 1 === 2 at worst case deno test takes 30 seconds, due to type checking is included by default.

denoland/deno#16116

https://deno.land/std@0.158.0/node/assert.ts?source#L240

@loynoir loynoir changed the title explicit return type deno source code should explicit return type Oct 14, 2022
@loynoir loynoir changed the title deno source code should explicit return type [perf] deno source code should explicit return type Oct 14, 2022
@littledivy littledivy transferred this issue from denoland/deno Oct 14, 2022
@kt3k
Copy link
Member

kt3k commented Oct 29, 2022

We intentionally don't write return types if they are void or Promise<void>. We consider those are unnecessary boilerplate

ref: denoland/deno#8832

Also the performance issue reported in denoland/deno#16116 looks like caused by the network download, not by typing issue. deno test now doesn't type check the remote modules by default. ref: https://deno.com/blog/v1.23#no-type-checking-by-default

@kt3k kt3k closed this as completed Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants