@serenity-js/core
Version:
The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure
31 lines (28 loc) • 1.44 kB
text/typescript
import type { Answerable } from '../Answerable';
import type { Question } from '../Question';
import type { MetaQuestion } from './MetaQuestion';
/**
* A chainable meta-question is a [`MetaQuestion`](https://serenity-js.org/api/core/interface/MetaQuestion/) that can be answered
* in the context of another [`Answerable`](https://serenity-js.org/api/core/#Answerable),
* and form a chain of transformations.
*
* [Meta-questions](https://serenity-js.org/api/core/interface/MetaQuestion/) are typically used when filtering a [`List`](https://serenity-js.org/api/core/class/List/).
*
* ## Learn more
* - [`List`](https://serenity-js.org/api/core/class/List/)
*
* @group Questions
*/
export interface ChainableMetaQuestion<
Supported_Context_Type,
Returned_Question_Type extends Question<unknown>
> extends MetaQuestion<Supported_Context_Type, Returned_Question_Type & ChainableMetaQuestion<Supported_Context_Type, Returned_Question_Type>> {
/**
* Answers the given `ChainableMetaQuestion` in the context of another [`Answerable`](https://serenity-js.org/api/core/#Answerable)
* and returns another `ChainableMetaQuestion` ready for further chaining.
*
* #### Learn more
* - [`List`](https://serenity-js.org/api/core/class/List/)
*/
of(context: Answerable<Supported_Context_Type>): Returned_Question_Type & ChainableMetaQuestion<Supported_Context_Type, Returned_Question_Type>;
}