You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What feature(s) would you like to see in RepoSense
Specify the return type of relevant functions in the frontend codebase. This is important because it can help catch errors early in the development process.
Is the feature request related to a problem?
Currently, many functions on the frontend do not have a return type even after the files were migrated to TypeScript. If we don't specify the return types for functions, TypeScript will try to infer it based on the function's implementation. However, this inference can sometimes be incorrect, leading to unexpected behavior or errors.
By specifying the return type explicitly, we can help TypeScript catch any type errors before the code even runs. Additionally, specifying return types can make the code more readable and self-documenting, as it makes it clear what type of value the function will return.
…in *.vue files (#2125)
Many frontend functions lack return types after migration to
TypeScript, which can cause errors due to TypeScript's attempted type
inference being incorrect. Specifying return type explicitly can allow
TypeScript to catch errors before the code is run.
Let us add return type annotations to TypeScript functions within Vue
files.
---------
Co-authored-by: David <[email protected]>
While #2125 adds type annotations in the .vue files, the functions in the raw .ts files still lack return type annotations. Let's add these too in a separate PR so that we can close this issue.
What feature(s) would you like to see in RepoSense
Specify the return type of relevant functions in the frontend codebase. This is important because it can help catch errors early in the development process.
Is the feature request related to a problem?
Currently, many functions on the frontend do not have a return type even after the files were migrated to TypeScript. If we don't specify the return types for functions, TypeScript will try to infer it based on the function's implementation. However, this inference can sometimes be incorrect, leading to unexpected behavior or errors.
By specifying the return type explicitly, we can help TypeScript catch any type errors before the code even runs. Additionally, specifying return types can make the code more readable and self-documenting, as it makes it clear what type of value the function will return.
If possible, describe the solution
For official TypeScript docs on using return types, one can refer to https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#return-type-annotations.
Additional context
Discussed in #1969
The text was updated successfully, but these errors were encountered: