You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interfaceFromJson{from(jsonString: string): ThisType<{}>;}classA{}AsatisfiesFromJson;// β works with type error:// Property 'from' is missing in type 'typeof A' but required in type 'FromJsonclassB{staticfrom(jsonString: string){returnnewB();}}BsatisfiesFromJson;// β works well, it ensures that the class B must to implement the `static from(...)`constB=(class{ ... })satisfiesFromJson;// workarounds in one line
but ... all-in-one-lined satisfies doesn't works for class
tralling satisfies after class body
classC{}satisfiesFromJson// β it doesn't works with error: Unexpected keyword or identifier.(1434)
and put satisfies before class body could have a better taste
classDsatisfiesFromJson{}// β it doesn't works with the same error
π Search Terms
"satisfies with class", "satisfies for static", "class static typing", "static member typing", "type check for static mehods"
β Viability Checklist
β Suggestion
satisfies
withclass
but ... all-in-one-lined
satisfies
doesn't works forclass
tralling
satisfies
after class bodyand put
satisfies
before class body could have a better tasteπ Motivating Example
π» Use Cases
What do you want to use this for?
for type-checking for
static member of class
in one lineWhat shortcomings exist with current approaches?
tralling
satisfies
after class body looks very bad forhuman eyes parsing
What workarounds are you using in the meantime?
expected :
The text was updated successfully, but these errors were encountered: