Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

TypeScript, having a purely structural type system, means any class has an interface. Unfortunately, if the class has any private or protected members, its interface becomes unimplementable.


Yeah, tricky one, that.

At least you have the workaround

    type PublicPart<T> = {[K in keyof T]: T[K]}; //keyof only sees public properties




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: