golevelup / ts-ecosystem Goto Github PK
View Code? Open in Web Editor NEWAwesome packages and enhancements to existing OSS projects that make the TypeScript ecosystem better and more fun to use
License: MIT License
Awesome packages and enhancements to existing OSS projects that make the TypeScript ecosystem better and more fun to use
License: MIT License
The current @types/convict version does not allow you to specify the nullable
option for config values.
i.e.
type ConfigOptions {
valueA: string
}
export default createProfiguration<ConfigOptions>({
valueA: {
format: String,
env: 'SOME_CONFIG_VALUE',
default: null,
nullable: true // typescript will complain because v5.2.0 @types/convict definition does not define this property
});
The convict version on the package is ^6.0.0
which would be 6.2.4
if downloaded from npm, but @types/convict
is 5.2.0
which should be updated to 6.1.1
Hello @WonderPanda
What is the best way to use te profiguration without .env file? I mean when the project is developing I can create a .env file locally but when I "dockerize" this is not a god idea build the project with the .env file inside.
I think the dotenv.config()
is the key.
I hope you can understand me.
The following works:
const appName = config.get('app.name');
// appName is now type string
But everywhere where a type is required TypeScript throws an error:
const appName: string = config.get('app.name');
// Error: Type instantiation is excessively deep and possibly infinite.
I am currently on Typescript 4.0.5
By adding "repository" to package.json the npm package website links to readme and repo.
Currently the repo is hard to find from npm.
A convict Config object will yield the appropriate type with:
const configType = ReturnType<Config['getProperties']>
Is there some additional reason to manually define an interface for the config? If there is, could the additional type restriction of the interface be merged with the above to reduce duplication?
HI
is it possible to add typing to the config object?
for now, I implemented the sample example and its not working
which typing config. will not complete to "get" and also fir the properties
It might be noted in the readme that it is requried to install @types/convict
to have intellisense and typechecking.
Would be great to use dotenv-exapand which makes it possible to work with variables in env files:
MONGO_PORT=27017
MONGO_URL=mongodb://localhost:${MONGO_PORT}
Hi thanks for developing this package. Just a quick couple of questions.
Is this module still maintained? It would be good to keep it update to with convict and any security updates.
Also could it be moved into the main golevelup/nestjs
repo or is there a reason it lives in this repo?
Thanks again
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.