Skip to content

TypeScript typings errors for ScenarioConfig.config and FeatureConfig.config #4848

Closed
@danielrentz

Description

@danielrentz

In https://codecept.io/advanced/#dynamic-configuration it is documented that Scenario().config can be called with (options), (string, options), or (function).

The type signature in types.d.ts is

    class ScenarioConfig {
        config(helper: string | { [key: string]: any; }, obj?: {[key: string]: any; }): this;
    }

which allows (string), (options), (string, options), or (options, options). The function variant is missing completely.

Better signature would be

    class ScenarioConfig {
        config(obj: {[key: string]: any; }): this;
        config(helper: string, obj: {[key: string]: any; }): this;
        config(fn: (test: TestObject) => unknown): this;
    }

(with the correct type for the test object).

Similar but even worse problem for Feature().config: Documentation only shows (options), but types.d.ts contains

    class FeatureConfig {
        config(helper: string | number, obj: any): this;
    }

Btw, in v3.6.10 the type definition of FeatureConfig.config was equal to ScenarioConfig.config, what was the reason for changing it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions