Skip to content

Config type in the CustomService is too restrictive #304

@ianFar96

Description

@ianFar96

The feauture or bug you are proposing

The user should be able to use a config with any property value type.

The description of the bug or the rationale of your proposal

the type type CustomService<Config extends ServiceConfig = ServiceConfig> in the customPlugin namepsce is too restrictive with the extends ServiceConfig since ServiceConfig is a NodeJS.Dict<string | number> by default. The type then breaks whenever you have a property in you config that is not a stringor a number (ex. a boolean)

A snippet of code for replicating the issue or showing the proposal usage if applicable

The type breaks if you declare something as such:

type Env = {prop: boolean}
const customService = customPlugin<Env>(envJsonSchema)

The expected result for your bug

I would expect the ServiceConfig type to not be a NodeJS.Dict<string | number> but a NodeJS.Dict<unknown>

Your environment

node: v16.17.0
custom-plugin-lib: 5.1.3
os: Ubuntu

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