Skip to content

incomplete between parameter type annotation and default value, but no error is reported. #61627

Closed as not planned
@frokaikan

Description

@frokaikan

Acknowledgement

  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Comment

code:

interface I { }
class J { }
function X(arg1: number, arg2?: number, arg3: J = new J(), arg4?: I): number | null { return null; }
(arg1: number, arg2?: number, arg3: J = 11.33, arg4?: I): number | null => { return null; }

the arg3 in the lambda expression has type J, but its default value is a number. However, typescript engine gives no error.

The version of tsc is 5.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions