TypeScript/lib/lib.es2018.asynciterable.d.ts

45 lines
1.7 KiB
TypeScript
Raw Normal View History

2019-02-28 23:35:03 +01:00
/*! *****************************************************************************
2020-02-27 23:24:21 +01:00
Copyright (c) Microsoft Corporation. All rights reserved.
2019-02-28 23:35:03 +01:00
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
2020-02-27 23:24:21 +01:00
License at http://www.apache.org/licenses/LICENSE-2.0
2019-02-28 23:35:03 +01:00
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
2020-02-27 23:24:21 +01:00
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
2019-02-28 23:35:03 +01:00
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" />
/// <reference lib="es2015.iterable" />
interface SymbolConstructor {
/**
* A method that returns the default async iterator for an object. Called by the semantics of
* the for-await-of statement.
*/
2021-06-04 01:35:05 +02:00
readonly asyncIterator: unique symbol;
2019-02-28 23:35:03 +01:00
}
interface AsyncIterator<T, TReturn = any, TNext = undefined> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
2019-10-01 22:17:17 +02:00
next(...args: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
return?(value?: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>;
throw?(e?: any): Promise<IteratorResult<T, TReturn>>;
2019-02-28 23:35:03 +01:00
}
interface AsyncIterable<T> {
[Symbol.asyncIterator](): AsyncIterator<T>;
}
interface AsyncIterableIterator<T> extends AsyncIterator<T> {
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
}