Skip to content

Predefined mapped types in lib.d.ts - #12276

Merged
ahejlsberg merged 4 commits into
masterfrom
libMappedTypes
Nov 15, 2016
Merged

Predefined mapped types in lib.d.ts#12276
ahejlsberg merged 4 commits into
masterfrom
libMappedTypes

Conversation

@ahejlsberg

Copy link
Copy Markdown
Member

This PR adds the following predefined mapped types to lib.d.ts:

// Make all properties in T optionaltypePartial<T>={[PinkeyofT]?: T[P];};// Make all properties in T readonlytypeReadonly<T>={readonly[PinkeyofT]: T[P];};// From T pick a set of properties KtypePick<T,KextendskeyofT>={[PinK]: T[P];}// Construct a type with a set of properties K of type TtypeRecord<Kextendsstring|number,T>={[PinK]: T;}

The PR also property implements the identity relation for mapped types.

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

@mhegazy Comments?

@ahejlsberg
ahejlsberg merged commit 0ba2348 into masterNov 15, 2016
@ahejlsberg
ahejlsberg deleted the libMappedTypes branch November 15, 2016 21:19
@ahejlsbergahejlsberg mentioned this pull request Nov 15, 2016
@microsoftmicrosoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for freeto 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.

3 participants

@ahejlsberg@mhegazy@msftclas