Skip to content

isolatedDeclarations should not have warning for functions that have no return statementsΒ #58330

Closed
@Jack-Works

Description

@Jack-Works

πŸ”Ž Search Terms

isolatedDeclaration

πŸ•— Version & Regression Information

5.5.0

⏯ Playground Link

https://www.typescriptlang.org/play/?isolatedDeclarations=true&ts=5.5.0-dev.20240426#code/KYDwDg9gTgLgBAMwK4DsDGMCWEWIBQCUcA3gL5A

πŸ’» Code

export function f() {}

πŸ™ Actual behavior

Function must have an explicit return type annotation with --isolatedDeclarations. (9007)

πŸ™‚ Expected behavior

No error

Additional information about the issue

Functions with no return statements can be easily inferred as type void, so there is no need to give this warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeclinedThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions