sindresorhus/conf
Do you want to work on this issue?
You can request for a bounty in order to promote it!
Improve the TypeScript types #86
sindresorhus posted onGitHub
I think the types could still be improved.
- Would be good to use
unknown
instead ofany
here: https://github.com/sindresorhus/conf/blob/bb24cfe32d39617a4b3983a92bd81596bd87c312/index.d.ts#L210 But it causes error on a valid usage:index.test-d.ts:123:13 ✖ 123:13 Argument of type "debug phase" is not assignable to parameter of type never.
- You cannot use dot-paths with a typed store:
config.set('foo.bar', true);
. We need to find a way to support that. Could possibly add support forconfig.set(['foo', 'bar'], true)
. - Reduce duplication if you use both a typed store and the
defaults
option. Maybe using theconst
keyword. - Could we make the types even stricter?
- Expose the type of the
schema
option, so it's easier to define it as a variable before passing it. Currently, you would have to doconst schema = {[Key in keyof TypedStore]: Conf.Schema} = {…};
. https://github.com/sindresorhus/conf/blob/bb24cfe32d39617a4b3983a92bd81596bd87c312/index.d.ts#L50
I'm open to other ideas on how to improve the types.