-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed as not planned
Labels
Out of ScopeThis idea sits outside of the TypeScript language design constraintsThis idea sits outside of the TypeScript language design constraintsSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Acknowledgement
- I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment
I was thinking about this topic : #31670
The conversation can go on.
The facts :
private
is a Typescript keywordprivate field
does not get transpiled into#field
or any constraining code, as per Typescript philosophy.#
is Javascript syntax.#
is considered awkward by many Typescript devs, because:- it's carried around alongside the variable name.
- it's stealing the spot of what
private
would be used for in the vast majority of OOP languages.
There's got to be a way of getting the best of both.
What do you think of this ?
- A new typescript keyword, '#private'
- It gets transpiled into a #field
- Example :
#private field: number
. Then in Typescript it's used normally:this.field = 12;
. In Javascript it's compiled asthis.#field = 12;
xiBread
Metadata
Metadata
Assignees
Labels
Out of ScopeThis idea sits outside of the TypeScript language design constraintsThis idea sits outside of the TypeScript language design constraintsSuggestionAn idea for TypeScriptAn idea for TypeScript