custom-plugin-lib icon indicating copy to clipboard operation
custom-plugin-lib copied to clipboard

`Config` type in the `CustomService` is too restrictive

Open ianFar96 opened this issue 3 years ago • 0 comments

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

ianFar96 avatar Oct 27 '22 09:10 ianFar96