Repository: TypeScript
Issue: should error on assignment that shadows a prototype method
Labels: Suggestion,Awaiting More Feedback

### 🔎 Search Terms

own property, shadow, prototype, method, field, inheritance

### 🕗 Version & Regression Information

- This is the behavior in every version I tried, and I reviewed 
   - https://github.com/microsoft/TypeScript/issues/13141
   - [MDN docs on classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes)
   - [TS docs on classes](https://www.typescriptlang.org/docs/handbook/2/classes.html)


### ⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.8.0-dev.20241201#code/MYGwhgzhAEBiD29oG8BQ0PWPAdhALgE4Cuw+8hAFAJQrqYP4AWAlhAHQAOh85+AnpwCmAWSHN4AE2gBeaDVkA+Og1WZseeCCHsQ8AOaUA5BCZhJ8AO4xuvXoKHQAtuKZSj1ANz01AXx-Q-gy2fA5iEpIKaGoYGhBaOnqGRi4R0LjQIfbCHt4M-r5AA

### 💻 Code

```ts
class Foo {
    constructor() {
        this.prototypeMethod = () => {
            console.log('shadows prototype method');
        }
    }
    prototypeMethod() {
        console.log('method on prototype');
    }
}
```


### 🙁 Actual behavior

no error

### 🙂 Expected behavior

error - something like "Type 'Foo' has no instance property named 'prototypeMethod'. If you meant to reassign the method 'prototypeMethod', it must be a function-valued instance property instead of a prototype method.".

I expect an error here because the code is effectively equivalent to 
```ts
class Foo {
    prototypeMethod = () => {
        console.log('shadows prototype method');
    };
    prototypeMethod() {
        console.log('method on prototype');
    }
}
```
which [is a TS error](https://www.typescriptlang.org/play/?ts=5.8.0-dev.20241201#code/MYGwhgzhAEBiD29oG8BQ0PQA4Cd4BcCBPLAUwFlT8ALeAE2gF5oAKASiYD4V1M-h4AOwjwQpAHQh4AcxYByCNTB14Adxi4CxMtAC2VWnTlsA3LwwBfM302F8JCgfrseffkJFjJM+fpr1oIWw8Owdja0wLVCjUAWF8aAAzRCZoQVJVOER2M2T4cVttR386HKA) (see https://github.com/microsoft/TypeScript/issues/13141).

Furthermore, it breaks error reporting in subclasses. The following code correctly reports a TS error due to the extended class not being able to override an instance property with a method:
([playground](https://www.typescriptlang.org/play/?ts=5.8.0-dev.20241201#code/MYGwhgzhAEBiD29oG8BQ0PQJYDsIBcwdgBTABQCd4AHEi-AT2gF5oAKAShYD4V1MBweHnggSAOhDwA5mwDkAMwCuxfFmEBaAG5gQSkgBNseQsRLRqVWvQZyOAbn4YAvqlepQkGACEwFaCQAHvgkOAYwCEhoAgD0MdAAKgDK0ACiAErpAPLpAFzQAMLgUNBykXLQBiQKuCQwuAREpNAAtiQtAEZ0FlZ0jKUNpqSUNH22ADTQHUr4AcGhVUaeJXK+FBVVNTh12LOQxo1mre1d-sqq6jjibABMACw3AKwcTgdD5L02nHwCgsIQogkUlkcngWjoFCwBiqOGgAHcsPgABbHZHwAx2V6udxCExTFjQbZw6BrTiODriQZND6jL4OaBxHq4fAwRQqYBqTQ6PSGN7Unq0xhyIA))
```ts
class Foo {
    instanceProperty = () => {
        console.log('function-valued instance property');
    }
}

class Bar extends Foo {
    // TS ERROR: Class 'Foo' defines instance member property 'instanceProperty', but extended class 'Bar' defines it as instance member function.(2425)
    instanceProperty() {
        console.log('overridden with method')
    }
}

const b = new Bar();
b.instanceProperty(); // prints 'function-valued instance property'
```

However, this does not ([playground](https://www.typescriptlang.org/play/?ts=5.8.0-dev.20241201#code/MYGwhgzhAEBiD29oG8BQ0PWPAdhALgE4Cuw+8hAFAJQrqYP4AWAlhAHQC2Aps-ACbQAvNBrCAfHQbTM2PPBDd2IeAHNKAcgBmxHGRa4AtADcwIYt0Es8+MHu7QADoXiPuhfAE8N1ejIC+ftCBDDx8-GJoMhhyEApKKuoaYUwCPgDcQYGo2aCQMABCYITQ3AAe+Nw4-DAISFGYAPSN0DhI7i4lTO4O0ABclEEpApFBDLHxymqa8MYdLPz8VdAA7izM0MP8Plk5qKix+NAARsKt3CvQRVTUmcdcvKkRt9DNToTW+DDauvpGpuZLNBrAQ7MAHM5XO4vBogA))
```ts
class Foo {
    constructor() {
        this.method = () => {
            console.log('function-valued instance property')
        }
    }
    method() {
        console.log('method');
    }

}

class Bar extends Foo {
    // no error here  :(
    method() {
        console.log('overridden with method')
    }
}

const b = new Bar();
b.method(); // prints 'function-valued instance property'
```

### Additional information about the issue

inspired by https://github.com/typescript-eslint/typescript-eslint/issues/10427

cc @miguel-leon