1 /*! *****************************************************************************
2 Copyright (c) Microsoft Corporation. All rights reserved.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the
5 License at http://www.apache.org/licenses/LICENSE-2.0
7 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 MERCHANTABLITY OR NON-INFRINGEMENT.
12 See the Apache Version 2.0 License for specific language governing permissions
13 and limitations under the License.
14 ***************************************************************************** */
18 /// <reference no-default-lib="true"/>
\r
21 /// <reference lib="es2015.iterable" />
\r
23 interface Generator<T = unknown, TReturn = any, TNext = unknown> extends Iterator<T, TReturn, TNext> {
\r
24 // NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
\r
25 next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
\r
26 return(value: TReturn): IteratorResult<T, TReturn>;
\r
27 throw(e: any): IteratorResult<T, TReturn>;
\r
28 [Symbol.iterator](): Generator<T, TReturn, TNext>;
\r
31 interface GeneratorFunction {
\r
33 * Creates a new Generator object.
\r
34 * @param args A list of arguments the function accepts.
\r
36 new (...args: any[]): Generator;
\r
38 * Creates a new Generator object.
\r
39 * @param args A list of arguments the function accepts.
\r
41 (...args: any[]): Generator;
\r
43 * The length of the arguments.
\r
45 readonly length: number;
\r
47 * Returns the name of the function.
\r
49 readonly name: string;
\r
51 * A reference to the prototype.
\r
53 readonly prototype: Generator;
\r
56 interface GeneratorFunctionConstructor {
\r
58 * Creates a new Generator function.
\r
59 * @param args A list of arguments the function accepts.
\r
61 new (...args: string[]): GeneratorFunction;
\r
63 * Creates a new Generator function.
\r
64 * @param args A list of arguments the function accepts.
\r
66 (...args: string[]): GeneratorFunction;
\r
68 * The length of the arguments.
\r
70 readonly length: number;
\r
72 * Returns the name of the function.
\r
74 readonly name: string;
\r
76 * A reference to the prototype.
\r
78 readonly prototype: GeneratorFunction;
\r