Improve the TypeScript types
See original GitHub issueI think the types could still be improved.
- Would be good to use
unknowninstead ofanyhere: 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
defaultsoption. Maybe using theconstkeyword. - Could we make the types even stricter?
- Expose the type of the
schemaoption, 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 - Maybe rename the current
Schematype to something clearer likeSchemaValue,SchemaOptionValue? Need some naming suggestions.
I’m open to other ideas on how to improve the types.
IssueHunt Summary
superjo149 has been rewarded.
Backers (Total: $80.00)
issuehunt ($80.00)
Submitted pull Requests
Tips
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on IssueHunt to raise funds.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Documentation - Advanced Types - TypeScript
This page lists some of the more advanced ways in which you can model types, it works in tandem with the Utility Types...
Read more >Write fewer tests by creating better TypeScript types
Type -driven development is writing your TypeScript program around types and choosing types that make it easy for the type checker to catch...
Read more >Effective TypeScript: 62 Specific Ways to Improve Your ...
Avoid TypeScript object wrapper types. Use the primitive types instead: string instead of String, number instead of Number, boolean instead of Boolean, symbol ......
Read more >How I improve my skills in Typescript #1 : Typeguard & Type ...
I will share with us some tips that improved my skill in Typescript ! Typeguard. Typeguard allow you to validate the type of...
Read more >Improve your TypeScript Skills with Type Challenges
Improve your TypeScript Skills with Type Challenges ... Typescript is the superset of JavaScript. The repository of Typescript challenges makes it ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@sindresorhus has rewarded $72.00 to @superjo149. See it on IssueHunt
For anyone that wants to work on this, see the initial attempt and feedback in https://github.com/sindresorhus/conf/pull/96. You can start from there.