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