Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

JS typings, missing file reference for error TS2355 when tyiping functions with @type #43160

Copy link
Copy link
@dbellavista

Description

@dbellavista
Issue body actions

Bug Report

In javascript when defining a callback and applying the type to a function which doesn't return anything, an error of type TS2355 is raised. And this is the correct behavior.

However tsc fails to show both the file and the line number of the problem. This can be quite annoying when dealing with a very big project :D

🔎 Search Terms

  • TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
  • jsdoc @type @callback

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about javascript

⏯ Playground Link

Playground link with relevant code

💻 Code

/**
 * @callback Func
 * @returns {Promise<number>}
 */

/** @type {Func} */
function test() {
  console.log("Nope");
}

🙁 Actual behavior

  • The error TS2355 is correctly detected but the line number (and also the file when dealing with a project) is not reported

🙂 Expected behavior

  • The tsc compiler should correctly report both line number and file
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationHelp WantedYou can do thisYou can do this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.