-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Conversation
Also move intersection types together with union types. Also some minor fixups. Squashed commit of the following: commit a86ccc5d9170c7581a7cf63c8d60301ea450b96f Merge: 620350d 819891d Author: Nathan Shively-Sanders <nathansa@microsoft.com> Date: Mon Jun 27 10:56:02 2016 -0700 Merge branch 'release-2.0' into discriminated-unions-WIP commit 620350dcfc0fe0be8bed7dd6894f7436e45dc059 Author: Nathan Shively-Sanders <nathansa@microsoft.com> Date: Mon Jun 27 10:49:47 2016 -0700 Finish exhaustiveness checking commit e5fabc82df929a04cf0f695d8f5f7aead19106b3 Author: Nathan Shively-Sanders <nathansa@microsoft.com> Date: Mon Jun 27 10:04:01 2016 -0700 Mostly done commit 572e93a1a9bc956011e12add5c60c18de1712b57 Author: Nathan Shively-Sanders <nathansa@microsoft.com> Date: Mon Jun 27 09:31:56 2016 -0700 One new example and minor wording tweaks commit 87f684499ce7c72a1d2067dd90f2889ecd164ea3 Author: Nathan Shively-Sanders <nathansa@microsoft.com> Date: Fri Jun 24 16:09:49 2016 -0700 Preparatory reorganisation 1. Move intersection types to the beginning. 2. Improve wording a little.
@DanielRosenwasser can you take a look? |
@@ -32,7 +74,7 @@ let indentedString = padLeft("Hello world", true); // passes at compile time, fa | |||
In traditional object-oriented code, we might abstract over the two types by creating a hierarchy of types. | |||
While this is much more explicit, it's also a little bit overkill. | |||
One of the nice things about the original version of `padLeft` was that we were able to just pass in primitives. | |||
That meant that usage was simple and not overly verbose. | |||
That meant that usage was simple and concise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concision ftw!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, looks like I'm Steve again.
@DanielRosenwasser now that I am back from vacation, can you take a look at the updated PR? |
One important difference is that type aliases cannot be extended or implemented from (nor can they extend/implement other types). | ||
One difference is that interfaces create a new name that is used everywhere. | ||
Type aliases don't create a new name — for instance, error messages won't use the alias name. | ||
In the code below, intellisense will show that `interfaced` requires and returns an `Interface`, but `aliased` will show object literal types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hovering over interfaced
in an editor that shows types in tooltips will show that it returns an Interface
, while hovering over aliased
will show it returns object literal type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Fixes #312
Also move intersection types together with union types.
Also some minor fixups.