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

No error for setter with self-referential, implicit any argument #48432

Copy link
Copy link
@gabritto

Description

@gabritto
Issue body actions

Bug Report

A setter can have an argument with a self-referential annotation, and this argument will implicitly have type any, with TS producing no errors for it.

🔎 Search Terms

setter, implicit any

🕗 Version & Regression Information

As far back as 4.3 (when we first let setters/getters in type literals).

⏯ Playground Link

Playground link with relevant code

💻 Code

declare var y: {
    set prop2(arg: typeof y.prop2);
};

🙁 Actual behavior

We don't get any errors, even with noImplicitAny set.
But arg has implicitly type any, because its type annotation refers to the type of the setter itself, and there are no getters.

🙂 Expected behavior

An error on prop2 or arg, at least under noImplicitAny.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue

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.