Hacker News new | past | comments | ask | show | jobs | submit login

I had the same initial reaction, but it turns out that if you have at least one private member, even with the same signature, it works as the parent comment suggests.

For example, these two classes are distinct to TypeScript:

    class Name {
        constructor(private value: string) {}

        getValue() {
            return this.value;
        }
    }

    class Email {
        constructor(private value: string) {}

        getValue() {
            return this.value;
        }
    }

    const email: Email = new Name(“Tim”); // Error: (paraphrasing) conflicting private declaration of “value”.



You’re right. This is what I meant, but I was not at all clear in my original comment.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: