[6a3a178] | 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
|
---|
| 6 |
|
---|
| 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.
|
---|
| 11 |
|
---|
| 12 | See the Apache Version 2.0 License for specific language governing permissions
|
---|
| 13 | and limitations under the License.
|
---|
| 14 | ***************************************************************************** */
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | /// <reference no-default-lib="true"/>
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | /// <reference lib="es2015.iterable" />
|
---|
| 22 |
|
---|
| 23 | interface 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 |
|
---|
| 31 | interface 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 |
|
---|
| 56 | interface 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 | }
|
---|