-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capability generate User-Defined Type Guards (enable basic TypeCheck at Runtime) #27
Labels
Milestone
Comments
Thank you. I hope it will be implemented in the 0.3.x milestone. |
Proposal: implement as static method on Person class. So we can call Person.isInstance(object) |
There are several issues to be resolved:
|
dzuvic
added a commit
that referenced
this issue
Sep 17, 2017
dzuvic
added a commit
that referenced
this issue
Sep 17, 2017
First try using undefined:
@CanKattwinkel is this the right way? |
dzuvic
added a commit
that referenced
this issue
Oct 30, 2017
added handling of supertypes: IMHO this feature is ready to be tested. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since we are working with plain objects in JavaScript and not with class-instances we can't do
typeof
checks. TypeScript has a feature called Type Guards that can help you with that.Example:
https://codepen.io/anon/pen/weJbEr
So it'd be nice to have a setting || annotation to enable the generation for instanceOfX functions.
User-Defined Type Guards - TypeScript Docs
TypeScript Deep Dive
The text was updated successfully, but these errors were encountered: