-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
proposal: "is" keyword #1289
Comments
In my opinion this is very hard to implement feature, and I doubt it's feasible. Firstly it has been discussed in ECMAProposal about an interface MyIface {
new (): something;
(a: stringng): somethingElse
} Or very complex interface with union types etc etc. |
fdecampredon nailed it -- this varies from "way too much code" to "simply impossible". TypeScript intentionally avoids adding runtime type information overhead. |
Note that we would be able to do something like this for classes with instanceof and type guards (#1283) |
Could be supported via a user-defined 'is function':
Emits
|
I'd like to suggest a language feature. The "is" keyword would check if an object is of a specific type (using duck typing).
translates into:
The text was updated successfully, but these errors were encountered: