Conversation
76127fe to
4c74a7a
Compare
biblicalph
left a comment
There was a problem hiding this comment.
So autocomplete is enabled by the type system correct?
4c74a7a to
ba93399
Compare
Yes, indeed. The "typings" file |
There was a problem hiding this comment.
Generally for open source things we want to target functionality that works with out extraneous tooling or that makes assumptions about a developers workflow. It should work with stock node. even in the REPL
in this case that would be typescript or vscode/typescript-language-server.
while this is generally fine to add, it doesn't work for everyone or in all cases
How could would make something like this work w/o those tools?
There was a problem hiding this comment.
That's a great call-out!
We should also rename Env, within index.js, to be Config. If we refrain from assumptions around tooling, as you suggest, we have the case where someone is using TypeScript, and it's confusing to have to "alias" Env to Config within source code during import. A solution to this confusion, that would fit both JavaScript and TypeScript and remove existing assumptions (ie: only JS users), would be to rename Env to Config within index.js.
There was a problem hiding this comment.
I've updated my contribution to be inclusive of vanilla JavaScript, and REPL, users and renamed Env to Config to reduce confusion and be more inclusive of TypeScript users who don't wish to alias the import.
ba93399 to
5e420b1
Compare
|
Nevermind :) |
597a58a to
812284f
Compare
Adds autocomplete to `config.get` and type
inference to the value assigned. For example
if you type `config.get('` you'll see a list
of suggested values that come directly from
whatever was configured by the user in `config.js`.
If you've confgiured "port" to be a number in
`config.js` and assign a variable like so:
`const port = config.get('port')`
The variable "port" will be inferred to be a number.
Auto-complete works under JavaScript, REPL, and
TypeScript. JavaScript users can continue to use
the Config constructor method but must switch
to using the `createConfig` helper method to
enjoy auto-complete.
Ref: NA
812284f to
86916ea
Compare
Adds autocomplete to
config.getand typeinference to the value assigned.
Auto-complete works under JavaScript, REPL, and
TypeScript. JavaScript users can continue to use
the Config constructor method but must switch
to using the
createConfighelper method toenjoy auto-complete.
Auto-Complete Example:
If you type
config.get('<tab>you'll see a listof suggested values that come directly from
whatever was configured by the user in their
config.js.Type Inference Example:
If you've configured "port" to be a number in
config.jsand assign a variable like so:const port = config.get('port')The variable "port" will be inferred to be a number.
Ref: NA