-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already createdSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Right now interfaces use the same syntax for properties with and without accessors. This is fine for duck typed interfaces, but the problem is, there is no way to specify properties with only one part (getter or setter) present. Usually, they are read only, without setter. The problem is, we can't tell this to a compiler, so it will not warn us when assigning to such a prop and JS runtime will simply ignore this assignment without throwing.
It would be good to have syntax like this
interface IEmployee{
get fullName: string;
set firstName: string;
set lastName: string;
}
to prevent such errors.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already createdSuggestionAn idea for TypeScriptAn idea for TypeScript