-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Type compatibility/can assign #349
Comments
Hi, yes, you are technically correct. TypeScript has some weird behavior around Besides meaning any type, or union of all types, or the superset of all types, That's why you can do The In fact, the This type will be updated in the near future, but it will be a breaking change. |
Yes. The
For the inside a class/object, yes. That's the original purpose of the type and that is handled differently. I'm working on a new way to handle branching to maximize flexibility. btw, if you want to check for |
Um, thanks for pointing it out. I thought I have the doc updated. Seems like I have missed it. It is in the docs under the It is mainly for used during testing. The return value is merely a container of the type under inspection, as all the check are done with pure type anyway (the same for For runtime check, currently the |
Forgive me if I have understood wrong (the functionality) but the following code shouldn't work without compiler problems?
If the order is inverted, it works fine. Also, the following code apparently compiles:
StackBlitz print:
![image](https://private-user-images.githubusercontent.com/4553211/260619541-539f76d3-9ecf-4ef7-9e97-169403d3ec7e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU4MjczMjgsIm5iZiI6MTcyNTgyNzAyOCwicGF0aCI6Ii80NTUzMjExLzI2MDYxOTU0MS01MzlmNzZkMy05ZWNmLTRlZjctOWU5Ny0xNjk0MDNkM2VjN2UucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDhUMjAyMzQ4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmFkNjEwZDU5YzExMmIwYjE1NGI1MTQxNDFlZGI5MjA3YzRiNTI2OGYzNjZmNGVjZGUyMjYxM2UxZTQ5ZjhkMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.WocFQibs1egg3kWGktj-geUT2Q3LGgQuUPe7IR8wSF0)
Thank you :)
The text was updated successfully, but these errors were encountered: