-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
Don't know would this go against "type safety" in general.
I think with flow analysis this is now possible.
class Foo() {
constructor() {
this.a = 1 // automatically create property `private a: any` or `private a: number`
}
do() {
this.b = this.a
// automatically create property `private b: any` or `private b: number | undefined`
// because `do()` may not be called.
}
do2() {
this.c = this.b
// automatically create proeprty `private c: any` or `private c: number | undefined`
// because `do()` and `do2()` many not be called.
}
}EDIT: It's a pain to see allowJS works with Javascript like this but not within TypeScript. 🌷
EDIT2: add private
EDIT3: yay, my first "thumb-down", showing that I'm pushing the boundary. 🌷
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created