-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
An accessor cannot be declared in an ambient context. #3513
Comments
Also if it helps, here is my {
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "esnext",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true
},
"exclude": [
"node_modules",
"dist"
]
} |
Please, provide a minimal repository which reproduces your issue. |
I tried replicating the issue on my other desktop and it was all working, however I had to install NestJS CLI because it was never installed on that computer. That made me think to update the CLI on the computer I had issue with... and after updating to latest NestJS CLI, the error is gone. Since I can't replicate after updating NestJS CLI, I'll close the issue |
I am having the same problem... Fresh install and updating cli does not solve it. Operating system is Mac OS |
@kotuadam |
I'm also facing the same problem. Its working in my local but failed when i deploy to server (openshift) |
Same issue here. |
This issue is relevant, please reopen. I just encountered the same error while trying to update from 6.7.2 to 6.10.4. Managed to resolve it somehow after wiping node_modules and doing |
It sounds like a breaking change introduced in TypeScript microsoft/TypeScript#33939 |
Switching entirely to Yarn seems to have fixed the issue for me, though the reason why NPM seemed to be the cause of my specific issues is beyond me. |
I've been able to resolve this, by manually upgrading typescript.
finally, cleared out, and re-installed everything:
|
I've published v6.10.5 release with a downgraded TypeScript to |
latest push fixed everything for me |
Facing this issue when adding @nestjs/ng-universal to Angular 8 project. Application starts up normal but errors persists. `10% building 3/3 modules 0 activenode_modules/@nestjs/common/http/http.service.d.ts:13:9 - error TS1086: An accessor cannot be declared in an ambient context. 13 get axiosRef(): AxiosInstance; node_modules/@nestjs/core/helpers/http-adapter-host.d.ts:21:9 - error TS1086: An accessor cannot be declared in an ambient context. 21 set httpAdapter(httpAdapter: T); node_modules/@nestjs/core/helpers/http-adapter-host.d.ts:28:9 - error TS1086: An accessor cannot be declared in an ambient context. 28 get httpAdapter(): T; node_modules/@nestjs/core/injector/container.d.ts:18:9 - error TS1086: An accessor cannot be declared in an ambient context. 18 get applicationConfig(): ApplicationConfig | undefined; node_modules/@nestjs/core/injector/instance-wrapper.d.ts:32:9 - error TS1086: An accessor cannot be declared in an ambient context. 32 get id(): string; node_modules/@nestjs/core/injector/instance-wrapper.d.ts:33:9 - error TS1086: An accessor cannot be declared in an ambient context. 33 set instance(value: T); node_modules/@nestjs/core/injector/instance-wrapper.d.ts:34:9 - error TS1086: An accessor cannot be declared in an ambient context. 34 get instance(): T; node_modules/@nestjs/core/injector/instance-wrapper.d.ts:35:9 - error TS1086: An accessor cannot be declared in an ambient context. 35 get isNotMetatype(): boolean; node_modules/@nestjs/core/injector/instance-wrapper.d.ts:36:9 - error TS1086: An accessor cannot be declared in an ambient context. 36 get isTransient(): boolean; node_modules/@nestjs/core/injector/module.d.ts:20:9 - error TS1086: An accessor cannot be declared in an ambient context. 20 get id(): string; node_modules/@nestjs/core/injector/module.d.ts:21:9 - error TS1086: An accessor cannot be declared in an ambient context. 21 get scope(): Type[]; node_modules/@nestjs/core/injector/module.d.ts:22:9 - error TS1086: An accessor cannot be declared in an ambient context. 22 get providers(): Map<any, InstanceWrapper>; node_modules/@nestjs/core/injector/module.d.ts:23:9 - error TS1086: An accessor cannot be declared in an ambient context. 23 get imports(): Set; node_modules/@nestjs/core/injector/module.d.ts:27:9 - error TS1086: An accessor cannot be declared in an ambient context. 27 get relatedModules(): Set; node_modules/@nestjs/core/injector/module.d.ts:31:9 - error TS1086: An accessor cannot be declared in an ambient context. 31 get components(): Map<string, InstanceWrapper>; node_modules/@nestjs/core/injector/module.d.ts:35:9 - error TS1086: An accessor cannot be declared in an ambient context. 35 get routes(): Map<string, InstanceWrapper>; node_modules/@nestjs/core/injector/module.d.ts:36:9 - error TS1086: An accessor cannot be declared in an ambient context. 36 get injectables(): Map<string, InstanceWrapper>; node_modules/@nestjs/core/injector/module.d.ts:37:9 - error TS1086: An accessor cannot be declared in an ambient context. 37 get controllers(): Map<string, InstanceWrapper>; node_modules/@nestjs/core/injector/module.d.ts:38:9 - error TS1086: An accessor cannot be declared in an ambient context. 38 get exports(): Set<string | symbol>; node_modules/@nestjs/core/injector/module.d.ts:39:9 - error TS1086: An accessor cannot be declared in an ambient context. 39 get instance(): NestModule; node_modules/@nestjs/core/injector/module.d.ts:40:9 - error TS1086: An accessor cannot be declared in an ambient context. 40 get metatype(): Type; node_modules/@nestjs/core/injector/module.d.ts:41:9 - error TS1086: An accessor cannot be declared in an ambient context. 41 get distance(): number; node_modules/@nestjs/core/injector/module.d.ts:42:9 - error TS1086: An accessor cannot be declared in an ambient context. 42 set distance(value: number); [21:58:20] Found 23 errors. Watching for file changes.` |
Lets track this here microsoft/TypeScript#33939 |
Regression
Potential Commit/PR that introduced the regression**
I don't know what introduced this issue, the only thing I found is this Stack Overflow question which says this
But I'm already using TypeScript version
3.7.2
, so I'm not sure where this error comes from and how to fix it.Describe the regression
I get a bunch of TypeScript lint errors after updating to latest NestJS
6.10.4
(from6.10.1
). I tried going back to~6.10.1
but I still get the error. I tried upgrading my NodeJS version 10 to 12 but still have the same issue. I also tried using TypeScript version3.6.3
instead of3.7.2
but still the issue persist.I found this bugfix in another library, which removes the
get
prefix in*.d.ts
files, the change is that lib is the followingIf I click and follow the link on the first
@nestjs/common/http/http.service.d.ts:13:9
error, I do see theget
in thatd.ts
fileSo it seems that the
d.ts
Type files are not compiled properly? If I manually remove theget
fromaxiosRef(): AxiosInstance;
, I get 1 less error. So that seems to be the issue.After manually editing every
d.ts
file causing errors and removing their get/set I'm back to working again, so that seems to be the issue.Input Code
Expected behavior/code
Environment
The errors I get are the following
The text was updated successfully, but these errors were encountered: