Skip to content

Commit

Permalink
Rename 'promised' to 'awaited'
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Aug 28, 2017
1 parent b10b0bf commit af083df
Show file tree
Hide file tree
Showing 63 changed files with 1,555 additions and 1,555 deletions.
216 changes: 108 additions & 108 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/compiler/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ namespace ts {
return <ThisTypeNode>createSynthesizedNode(SyntaxKind.ThisType);
}

export function createTypeOperatorNode(type: TypeNode, operator: SyntaxKind.KeyOfKeyword | SyntaxKind.PromisedKeyword) {
export function createTypeOperatorNode(type: TypeNode, operator: SyntaxKind.KeyOfKeyword | SyntaxKind.AwaitedKeyword) {
const node = createSynthesizedNode(SyntaxKind.TypeOperator) as TypeOperatorNode;
node.operator = operator;
node.type = parenthesizeElementTypeMember(type);
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2782,7 +2782,7 @@ namespace ts {
return type;
}

function parseTypeOperator(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.PromisedKeyword) {
function parseTypeOperator(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.AwaitedKeyword) {
const node = <TypeOperatorNode>createNode(SyntaxKind.TypeOperator);
parseExpected(operator);
node.operator = operator;
Expand All @@ -2794,7 +2794,7 @@ namespace ts {
const keyword = token();
switch (keyword) {
case SyntaxKind.KeyOfKeyword:
case SyntaxKind.PromisedKeyword:
case SyntaxKind.AwaitedKeyword:
return parseTypeOperator(keyword);
}
return parseArrayTypeOrHigher();
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace ts {
"abstract": SyntaxKind.AbstractKeyword,
"any": SyntaxKind.AnyKeyword,
"as": SyntaxKind.AsKeyword,
"awaited": SyntaxKind.AwaitedKeyword,
"boolean": SyntaxKind.BooleanKeyword,
"break": SyntaxKind.BreakKeyword,
"case": SyntaxKind.CaseKeyword,
Expand Down Expand Up @@ -104,7 +105,6 @@ namespace ts {
"package": SyntaxKind.PackageKeyword,
"private": SyntaxKind.PrivateKeyword,
"protected": SyntaxKind.ProtectedKeyword,
"promised": SyntaxKind.PromisedKeyword,
"public": SyntaxKind.PublicKeyword,
"readonly": SyntaxKind.ReadonlyKeyword,
"require": SyntaxKind.RequireKeyword,
Expand Down
22 changes: 11 additions & 11 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ namespace ts {
ModuleKeyword,
NamespaceKeyword,
NeverKeyword,
PromisedKeyword,
AwaitedKeyword,
ReadonlyKeyword,
RequireKeyword,
NumberKeyword,
Expand Down Expand Up @@ -973,7 +973,7 @@ namespace ts {

export interface TypeOperatorNode extends TypeNode {
kind: SyntaxKind.TypeOperator;
operator: SyntaxKind.KeyOfKeyword | SyntaxKind.PromisedKeyword;
operator: SyntaxKind.KeyOfKeyword | SyntaxKind.AwaitedKeyword;
type: TypeNode;
}

Expand Down Expand Up @@ -3141,7 +3141,7 @@ namespace ts {
Intersection = 1 << 17, // Intersection (T & U)
Index = 1 << 18, // keyof T
IndexedAccess = 1 << 19, // T[K]
Promised = 1 << 20, // promised T
Awaited = 1 << 20, // awaited T
/* @internal */
FreshLiteral = 1 << 21, // Fresh literal type
/* @internal */
Expand Down Expand Up @@ -3171,12 +3171,12 @@ namespace ts {
EnumLike = Enum | EnumLiteral,
UnionOrIntersection = Union | Intersection,
StructuredType = Object | Union | Intersection,
StructuredOrTypeVariable = StructuredType | TypeParameter | Index | IndexedAccess | Promised,
TypeVariable = TypeParameter | IndexedAccess | Promised,
StructuredOrTypeVariable = StructuredType | TypeParameter | Index | IndexedAccess | Awaited,
TypeVariable = TypeParameter | IndexedAccess | Awaited,

// 'Narrowable' types are types where narrowing actually narrows.
// This *should* be every type other than null, undefined, void, and never
Narrowable = Any | StructuredType | TypeParameter | Index | IndexedAccess | StringLike | NumberLike | BooleanLike | ESSymbol | NonPrimitive | Promised,
Narrowable = Any | StructuredType | TypeParameter | Index | IndexedAccess | StringLike | NumberLike | BooleanLike | ESSymbol | NonPrimitive | Awaited,
NotUnionOrUnit = Any | ESSymbol | Object | NonPrimitive,
/* @internal */
RequiresWidening = ContainsWideningType | ContainsObjectLiteral,
Expand Down Expand Up @@ -3299,7 +3299,7 @@ namespace ts {
/* @internal */
couldContainTypeVariables: boolean;
/* @internal */
resolvedPromisedType: PromisedType;
resolvedAwaitedType: AwaitedType;
}

export interface UnionType extends UnionOrIntersectionType { }
Expand Down Expand Up @@ -3364,7 +3364,7 @@ namespace ts {
/* @internal */
export interface PromiseOrAwaitableType extends ObjectType, UnionType {
fulfillmentType?: Type; // Type of `value` parameter of `onfulfilled` callback.
promisedType?: Type; // The "fulfillment type" if a Promise-like, otherwise this type.
awaitedType?: Type; // The "fulfillment type" if a Promise-like, otherwise this type.
}

/* @internal */
Expand All @@ -3378,7 +3378,7 @@ namespace ts {
/* @internal */
resolvedIndexType: IndexType;
/* @internal */
resolvedPromisedType: PromisedType;
resolvedAwaitedType: AwaitedType;
}

// Type parameters (TypeFlags.TypeParameter)
Expand Down Expand Up @@ -3409,8 +3409,8 @@ namespace ts {
type: TypeVariable | UnionOrIntersectionType;
}

// promised T types (TypeFlags.Promised)
export interface PromisedType extends Type {
// awaited T types (TypeFlags.Awaited)
export interface AwaitedType extends Type {
type: TypeVariable;
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/es2015.iterable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ interface PromiseConstructor {
* @param values An array of Promises.
* @returns A new Promise.
*/
all<TAll>(values: Iterable<TAll>): Promise<(promised TAll)[]>;
all<TAll>(values: Iterable<TAll>): Promise<(awaited TAll)[]>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T>(values: Iterable<T>): Promise<promised T>;
race<T>(values: Iterable<T>): Promise<awaited T>;
}

declare namespace Reflect {
Expand Down
44 changes: 22 additions & 22 deletions src/lib/es2015.promise.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,159 +18,159 @@ interface PromiseConstructor {
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]): Promise<[promised T1, promised T2, promised T3, promised T4, promised T5, promised T6, promised T7, promised T8, promised T9, promised T10]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]): Promise<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5, awaited T6, awaited T7, awaited T8, awaited T9, awaited T10]>;

/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1, T2, T3, T4, T5, T6, T7, T8, T9]): Promise<[promised T1, promised T2, promised T3, promised T4, promised T5, promised T6, promised T7, promised T8, promised T9]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1, T2, T3, T4, T5, T6, T7, T8, T9]): Promise<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5, awaited T6, awaited T7, awaited T8, awaited T9]>;

/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1, T2, T3, T4, T5, T6, T7, T8]): Promise<[promised T1, promised T2, promised T3, promised T4, promised T5, promised T6, promised T7, promised T8]>;
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1, T2, T3, T4, T5, T6, T7, T8]): Promise<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5, awaited T6, awaited T7, awaited T8]>;

/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1, T2, T3, T4, T5, T6, T7]): Promise<[promised T1, promised T2, promised T3, promised T4, promised T5, promised T6, promised T7]>;
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1, T2, T3, T4, T5, T6, T7]): Promise<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5, awaited T6, awaited T7]>;

/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6>(values: [T1, T2, T3, T4, T5, T6]): Promise<[promised T1, promised T2, promised T3, promised T4, promised T5, promised T6]>;
all<T1, T2, T3, T4, T5, T6>(values: [T1, T2, T3, T4, T5, T6]): Promise<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5, awaited T6]>;

/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5>(values: [T1, T2, T3, T4, T5]): Promise<[promised T1, promised T2, promised T3, promised T4, promised T5]>;
all<T1, T2, T3, T4, T5>(values: [T1, T2, T3, T4, T5]): Promise<[awaited T1, awaited T2, awaited T3, awaited T4, awaited T5]>;

/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4>(values: [T1, T2, T3, T4]): Promise<[promised T1, promised T2, promised T3, promised T4]>;
all<T1, T2, T3, T4>(values: [T1, T2, T3, T4]): Promise<[awaited T1, awaited T2, awaited T3, awaited T4]>;

/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3>(values: [T1, T2, T3]): Promise<[promised T1, promised T2, promised T3]>;
all<T1, T2, T3>(values: [T1, T2, T3]): Promise<[awaited T1, awaited T2, awaited T3]>;

/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2>(values: [T1, T2]): Promise<[promised T1, promised T2]>;
all<T1, T2>(values: [T1, T2]): Promise<[awaited T1, awaited T2]>;

/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T>(values: T[]): Promise<(promised T)[]>;
all<T>(values: T[]): Promise<(awaited T)[]>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]): Promise<promised T1 | promised T2 | promised T3 | promised T4 | promised T5 | promised T6 | promised T7 | promised T8 | promised T9 | promised T10>;
race<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]): Promise<awaited T1 | awaited T2 | awaited T3 | awaited T4 | awaited T5 | awaited T6 | awaited T7 | awaited T8 | awaited T9 | awaited T10>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1, T2, T3, T4, T5, T6, T7, T8, T9]): Promise<promised T1 | promised T2 | promised T3 | promised T4 | promised T5 | promised T6 | promised T7 | promised T8 | promised T9>;
race<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1, T2, T3, T4, T5, T6, T7, T8, T9]): Promise<awaited T1 | awaited T2 | awaited T3 | awaited T4 | awaited T5 | awaited T6 | awaited T7 | awaited T8 | awaited T9>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1, T2, T3, T4, T5, T6, T7, T8]): Promise<promised T1 | promised T2 | promised T3 | promised T4 | promised T5 | promised T6 | promised T7 | promised T8>;
race<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1, T2, T3, T4, T5, T6, T7, T8]): Promise<awaited T1 | awaited T2 | awaited T3 | awaited T4 | awaited T5 | awaited T6 | awaited T7 | awaited T8>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T1, T2, T3, T4, T5, T6, T7>(values: [T1, T2, T3, T4, T5, T6, T7]): Promise<promised T1 | promised T2 | promised T3 | promised T4 | promised T5 | promised T6 | promised T7>;
race<T1, T2, T3, T4, T5, T6, T7>(values: [T1, T2, T3, T4, T5, T6, T7]): Promise<awaited T1 | awaited T2 | awaited T3 | awaited T4 | awaited T5 | awaited T6 | awaited T7>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T1, T2, T3, T4, T5, T6>(values: [T1, T2, T3, T4, T5, T6]): Promise<promised T1 | promised T2 | promised T3 | promised T4 | promised T5 | promised T6>;
race<T1, T2, T3, T4, T5, T6>(values: [T1, T2, T3, T4, T5, T6]): Promise<awaited T1 | awaited T2 | awaited T3 | awaited T4 | awaited T5 | awaited T6>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T1, T2, T3, T4, T5>(values: [T1, T2, T3, T4, T5]): Promise<promised T1 | promised T2 | promised T3 | promised T4 | promised T5>;
race<T1, T2, T3, T4, T5>(values: [T1, T2, T3, T4, T5]): Promise<awaited T1 | awaited T2 | awaited T3 | awaited T4 | awaited T5>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T1, T2, T3, T4>(values: [T1, T2, T3, T4]): Promise<promised T1 | promised T2 | promised T3 | promised T4>;
race<T1, T2, T3, T4>(values: [T1, T2, T3, T4]): Promise<awaited T1 | awaited T2 | awaited T3 | awaited T4>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T1, T2, T3>(values: [T1, T2, T3]): Promise<promised T1 | promised T2 | promised T3>;
race<T1, T2, T3>(values: [T1, T2, T3]): Promise<awaited T1 | awaited T2 | awaited T3>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T1, T2>(values: [T1, T2]): Promise<promised T1 | promised T2>;
race<T1, T2>(values: [T1, T2]): Promise<awaited T1 | awaited T2>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T>(values: T[]): Promise<promised T>;
race<T>(values: T[]): Promise<awaited T>;

/**
* Creates a new rejected promise for the provided reason.
Expand All @@ -184,14 +184,14 @@ interface PromiseConstructor {
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject<T>(reason: any): Promise<promised T>;
reject<T>(reason: any): Promise<awaited T>;

/**
* Creates a new resolved promise for the provided value.
* @param value A promise.
* @returns A promise whose internal state matches the provided promise.
*/
resolve<T>(value: T): Promise<promised T>;
resolve<T>(value: T): Promise<awaited T>;

/**
* Creates a new resolved promise .
Expand Down
6 changes: 3 additions & 3 deletions src/lib/es5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ interface PromiseLike<T> {
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: promised T) => TResult1) | undefined | null, onrejected?: ((reason: any) => TResult2) | undefined | null): PromiseLike<promised TResult1 | promised TResult2>;
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: awaited T) => TResult1) | undefined | null, onrejected?: ((reason: any) => TResult2) | undefined | null): PromiseLike<awaited TResult1 | awaited TResult2>;
}

/**
Expand All @@ -1272,14 +1272,14 @@ interface Promise<T> {
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: promised T) => TResult1) | undefined | null, onrejected?: ((reason: any) => TResult2) | undefined | null): Promise<promised TResult1 | promised TResult2>;
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: awaited T) => TResult1) | undefined | null, onrejected?: ((reason: any) => TResult2) | undefined | null): Promise<awaited TResult1 | awaited TResult2>;

/**
* Attaches a callback for only the rejection of the Promise.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of the callback.
*/
catch<TResult = never>(onrejected?: ((reason: any) => TResult) | undefined | null): Promise<promised T | promised TResult>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult) | undefined | null): Promise<awaited T | awaited TResult>;
}

interface ArrayLike<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class C {
>method : () => void

var fn = async () => await this;
>fn : () => Promise<promised this>
>async () => await this : () => Promise<promised this>
>await this : promised this
>fn : () => Promise<awaited this>
>async () => await this : () => Promise<awaited this>
>await this : awaited this
>this : this
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class C {
>method : () => void

var fn = async () => await this;
>fn : () => Promise<promised this>
>async () => await this : () => Promise<promised this>
>await this : promised this
>fn : () => Promise<awaited this>
>async () => await this : () => Promise<awaited this>
>await this : awaited this
>this : this
}
}
Expand Down
Loading

0 comments on commit af083df

Please sign in to comment.