Comments (5)
add skipLibCheck": true
on your tsconfig to fix the error
from ngx-env.
I think it is better to exclude just src/env.d.ts
"exclude": ["src/env.d.ts"],
from ngx-env.
Figured a better way to merge process types:
declare namespace NodeJS {
export interface ProcessEnv {
/**
* Built-in environment variable.
* @see Docs https://github.com/chihab/ngx-env#ng_app_env.
*/
readonly NG_APP_ENV: string;
// Replace the line below with your environment variable for better type checking
readonly [key: string]: any;
}
}
from ngx-env.
Is it a project from scratch? If not could you please try to reproduce you error in a project from scratch?
npx @angular/cli@11 new ng-app11
cd ng-app11 && npx ng add @ngx-env/[email protected]
npm start
With that, if you don't have the error (I hope so), try to spot the difference with your project?
Could you please share your Angular and TS exact versions?
Thanks @widipa
from ngx-env.
Hi @chihab. I created the project from scratch (via npx -p @angular/cli ng new
and npx ng add @ngx-env/builder
) and faced the same issue. Please see my repository with a reproduction of the issue https://github.com/chernodub/ngx-env-repro/.
Error: src/env.d.ts:1:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'process' must be of type 'Process', but here has type '{ env: { [key: string]: any; NG_APP_ENV: string; }; }'.
1 declare var process: {
~~~~~~~
node_modules/@types/node/ts4.8/globals.d.ts:27:13
27 declare var process: NodeJS.Process;
~~~~~~~
'process' was also declared here.
💡 By the way, to solve the issue, I believe it would be more reasonable to add @ts-ignore
to env.d.ts
, rather than disabling the lib check for the whole project (via skipLibCheck
)
// To silently merge declarations with global process
// @ts-ignore
declare var process: {
env: {
NG_APP_ENV: string;
// Replace the line below with your environment variable for better type checking
[key: string]: any;
};
};
from ngx-env.
Related Issues (20)
- How to use with jest? HOT 3
- Problem with module federation HOT 2
- I cannot access my environment variables in my environment.ts HOT 2
- version info for import.meta.env HOT 1
- Thank you for making this HOT 1
- environment variables not being set HOT 2
- ng build throws rxjs switchmap error HOT 5
- Do the `secret` keys get included in the final build? HOT 2
- Document usage with custom builder and @dotenv-run/webpack
- Prepare stackblitz playground
- Support angular workspace for ng-add
- Angular 17 support HOT 8
- Issue while building with v17 when SSR is disabled HOT 10
- Replace variables on pre-rendered pages HOT 4
- Design a logo
- @ngx-env not loading variables HOT 6
- Schema validation failed on `ng serve` HOT 7
- @ngx-env/builder Mistargets File Path for index.server.html. ( Nx + Angular ) monorepo HOT 4
- Add browser-esbuild builder HOT 2
- how to apply Env Vars to multiple npm scripts HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-env.