-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find name 'Config' #16
Comments
having the same problem |
@Cuneytt Sorry for the late response. Is your project on github somewhere? Also can u confirm the version of the library you are using? |
Thank you for the reply @tusharmath. Solved it for now using process.env directly and plan to get to it later. In the meantime, maybe @rburgst will be able to provide details he is running into. |
@Cuneytt I also tried your tsc config and got this error —
I was able to solve the problem by removing |
@tusharmath Thanks, Will you please post the entire tsconfig.json you used to cross check with mine |
Does NOT work {
"compilerOptions": {
"declaration": false,
"module": "commonjs",
"moduleResolution": "node",
"newLine": "LF",
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": false,
"sourceMap": true,
"strictNullChecks": true,
"strict": true,
"target": "es6",
"typeRoots": ["config", "node_modules/@types"]
},
"exclude": ["node_modules"]
} Working {
"compilerOptions": {
"declaration": false,
"module": "commonjs",
"moduleResolution": "node",
"newLine": "LF",
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": false,
"sourceMap": true,
"strictNullChecks": true,
"strict": true,
"target": "es6",
"typeRoots": ["node_modules/@types"]
},
"exclude": ["node_modules"]
} |
Thank you very much @tusharmath |
In case anyone hits this issue, it can also be caused by tsconfig.json including a "includes" section. If "includes" is not commented out (the default), it's necessary to add ./config to "includes" or tsc won't find the declaration for the Config interface. e.g
|
I try import { AuthenticationService } from '../authentication.service'; |
This is my tsconfig.json
}, "angularCompilerOptions": { |
What is the error?
Tushar Mathur
tusharmath.com ( https://tusharmath.com )
…On Sun, Nov 17, 2019 at 07:19:36, Larry Robinson < ***@***.*** > wrote:
This is my tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [ "config", ***@***.***" ], "lib": [ "es2018", "dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
it is different than any of the above ones. Can someone help me understand
what is happening here
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub (
#16?email_source=notifications&email_token=AABPPMVBSZJJ7MX7EPLF3LLQUCPLBA5CNFSM4FHJ3NMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEH7EWY#issuecomment-554693211
) , or unsubscribe (
https://github.com/notifications/unsubscribe-auth/AABPPMUWO6VRZPPFD6PTY33QUCPLBANCNFSM4FHJ3NMA
).
|
My apologies to all. I had myself under the perception that all here were here for the same reason and bug. cannot find name 'Config' |
@larka06 assuming tsconfig is in the same folder as node_modules (if not, what's the reason?), are you sure it's necessary to include a typeRoots entry? I don't know that it's a contributing factor but as typeRoots is generally not needed in a TS project, simplifying your tsconfig by removing typeRoots might help with troubleshooting. |
Thank you for your response but honestly, I'm so tired of working with it I have taken a couple of days of to work on a different project. It is time for me to go back to it and then I'll do as you say and if all doesn't work I'll send you more info.Thanks again
…-----Original Message-----
From: Barry Gausden <[email protected]>
To: tusharmath/node-config-ts <[email protected]>
Cc: Larry Robinson <[email protected]>; Mention <[email protected]>
Sent: Tue, Nov 19, 2019 7:05 pm
Subject: Re: [tusharmath/node-config-ts] Cannot find name 'Config' (#16)
@larka06 assuming tsconfig is in the same folder as node_modules (if not, what's the reason?), are you sure it's necessary to include a typeRoots entry?I don't know that it's a contributing factor but as typeRoots is generally not needed in a TS project, simplifying your tsconfig by removing typeRoots might help with troubleshooting.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Can you send me a public repo of your problem?
Tushar Mathur
tusharmath.com ( https://tusharmath.com )
…On Fri, Nov 22, 2019 at 05:34:30, Larry Robinson < ***@***.*** > wrote:
Thank you for your response but honestly, I'm so tired of working with it
I have taken a couple of days of to work on a different project. It is
time for me to go back to it and then I'll do as you say and if all
doesn't work I'll send you more info.Thanks again
-----Original Message-----
From: Barry Gausden < notifications@ github. com ( ***@***.***
) >
To: tusharmath/node-config-ts < node-config-ts@ noreply. github. com (
***@***.*** ) >
Cc: Larry Robinson < larka51@ aol. com ( ***@***.*** ) >; Mention < mention@
noreply. github. com ( ***@***.*** ) >
Sent: Tue, Nov 19, 2019 7:05 pm
Subject: Re: [tusharmath/node-config-ts] Cannot find name 'Config' (#16)
@larka06 assuming tsconfig is in the same folder as node_modules (if not,
what's the reason?), are you sure it's necessary to include a typeRoots
entry?I don't know that it's a contributing factor but as typeRoots is
generally not needed in a TS project, simplifying your tsconfig by
removing typeRoots might help with troubleshooting.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub (
#16?email_source=notifications&email_token=AABPPMW35WXGWJS4KTJ4623QU4OY5A5CNFSM4FHJ3NMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE4CKLI#issuecomment-557327661
) , or unsubscribe (
https://github.com/notifications/unsubscribe-auth/AABPPMRDVYMF5C55YGHAAHLQU4OY5ANCNFSM4FHJ3NMA
).
|
@larka06 I guess you could be having the same issue — #51 (comment) |
I am new to Typescript and sorry if this is a stupid question.
"npm install" runs successfully and generates the Config.d.ts file in config directory.
tsconfig.json has the config directory as one of the typeRoots:
And excludes the node_modules directory:
When "tsc" runs it errors out with:
Thanks
The text was updated successfully, but these errors were encountered: