Skip to content

Union type fixes and optimizations #942

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

Merged
merged 2 commits into from
Oct 22, 2014
Merged

Union type fixes and optimizations #942

merged 2 commits into from
Oct 22, 2014

Conversation

ahejlsberg
Copy link
Member

This PR fixes issues relating to apparent types and union types and optimizes materialization of properties in union types. It also makes union types a separate kind of type, distinct from object types.

The following functions have changed:

Function Change
getPropertiesOfType Returns property list of any kind of type
getPropertyOfType Returns an (apparent) property of any kind of type
getSignaturesOfType Returns (apparent) call signatures of any kind of type
getIndexTypeOfType Returns an (apparent) index signature of any kind of type
getPropertiesOfObjectType Returns property list of an object type
getAugmentedPropertiesOfType Returns augmented property list of any kind of type
getPropertyOfObjectType Returns a property of an object type
getSignaturesOfObjectOrUnionType Returns call signatures of an object or union type
getIndexTypeOfObjectOrUnionType Returns index signature of an object or union type
resolveObjectOrUnionTypeMembers Resolves members of object or union types

The functions in bold are the ones that code would typically use. They now automatically create synthetic results for union types and convert primitives and type parameters to their apparent types before performing the operation.

The ResolvedObjectType type has been renamed to ResolvedType because it now covers both object and union types. The ApparentType type is no longer needed and has been removed.

Materialization of union type properties previously happened in resolveObjectTypeMembers but is now done on demand per property through the getPropertyOfType function.

ahejlsberg added a commit that referenced this pull request Oct 22, 2014
Union type fixes and optimizations
@ahejlsberg ahejlsberg merged commit 051478d into master Oct 22, 2014
@ahejlsberg ahejlsberg deleted the unionTypeFixes branch October 22, 2014 21:48
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant