Skip to content
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

investigate downcast type safety #387

Closed
4 tasks
mmoskal opened this issue Sep 28, 2016 · 4 comments
Closed
4 tasks

investigate downcast type safety #387

mmoskal opened this issue Sep 28, 2016 · 4 comments

Comments

@mmoskal
Copy link
Member

mmoskal commented Sep 28, 2016

Following scenarios need investigating:

  • explicit downcast as in foo as Derived (or <Derived>foo)
  • implicit downcast due to bivariant function types: TS FAQ
  • covariant arrays
  • indexing types without explicit indexer

I think we could introduce some runtime checks for the above - upon explicit casting, entry into a lambda function, and upon assigning to arrays.

We cannot really support union types (there is currently no way to distinguish at runtime between a number and a reference for example). Intersection types are I think only compile-time feature.

@mmoskal
Copy link
Member Author

mmoskal commented Sep 28, 2016

CC @tballmsft

@tballmsft
Copy link
Contributor

forget about union/intersection types, say I.

@tballmsft
Copy link
Contributor

New type checker disallows downcasts, bivariance. Closing for now

@lock
Copy link

lock bot commented Sep 27, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants