-
Notifications
You must be signed in to change notification settings - Fork 9
Deserialize config into type #58
Comments
That would be indeed a very reasonable thing to do, I agree. The roots of this package are coming from Node, where nobody could care less about types. Now that it is done in Typescript, makes so more sense to kick some types Again, I can try and develop this, but my PRs are not getting reviewed. If anyone can get ahold of the author — I would gladly take on and do this feature |
Here is the trouble with this issue. Type information is not stored at the runtime, so const appConfig = config() as MyAppConfig; which does not really check anything — or you would have to provide the list of variables to it in some way, e.g.: const appConfig = config<MyAppConfig>({ safe: true }, ["MySecret", "TwitterApiKey"]); At this point I don't know if it makes a lot of sense to implement it this way, because you would have to maintain such a list of variables in sync with your configuration interface Any suggestions are welcome on the matter |
related? #36 |
Not really. If you, or whoever, wants to have booleans — why just not consider regular json format? You'll also have your undefines, and nulls and integers. |
Have you considered providing an option something like the below that allows strongly typed config?
The text was updated successfully, but these errors were encountered: