mia-platform / mia-platform/custom-plugin-lib

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

Open
#304 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
25
Forks
7
PR merge metrics
No merged PRs in 30d

Description

## 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` in the `customPlugin` namepsce is too restrictive with the `extends ServiceConfig` since `ServiceConfig` is a `NodeJS.Dict` by default. The type then breaks whenever you have a property in you config that is not a `string`or 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(envJsonSchema)
```

## The expected result for your bug
I would expect the `ServiceConfig` type to not be a `NodeJS.Dict` but a `NodeJS.Dict`

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the customPlugin namespace and the CustomService type definition, then inspect how ServiceConfig is used in the generic constraint. Update the configuration type so the boolean Env example is accepted, and run the library's existing type checks or tests to confirm current string and number configurations still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.