Skip to content
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. #3619

Closed
ghost opened this issue Dec 11, 2019 · 5 comments
Closed

An accessor cannot be declared in an ambient context. #3619

ghost opened this issue Dec 11, 2019 · 5 comments
Labels
needs triage This issue has not been looked into

Comments

@ghost
Copy link

ghost commented Dec 11, 2019

Bug Report

Environment


Nest version: 6.10.9
Angular version 8.2.14
TypeScript version 3.5.3

## Current behavior

- [x] Create new Project with command **ng new my-app**
- [x] When project is created. change directory to my-app.
- [x] Run ng add @nestjs/ng-universal
- [x] try to run project with command npm run serve.

## Expected behavior
Expectedd no errors in nestjs/ng-universal core libraries when adding nestjs/ng-universal to angular project.

## Error thrown in build
`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>;
           ~~~~~~~~~

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>;
           ~~~~~~~~~~

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>;
           ~~~~~~

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>;
           ~~~~~~~~~~~

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>;
           ~~~~~~~~~~~

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;
           ~~~~~~~

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);
`
@ghost ghost added the needs triage This issue has not been looked into label Dec 11, 2019
@kamilmysliwiec
Copy link
Member

kamilmysliwiec commented Dec 11, 2019

This is a TypeScript issue, see:

To solve this problem, update your TypeScript version to 3.7.4. I'll publish another patch release with a downgraded TS

@ghost
Copy link
Author

ghost commented Dec 11, 2019

Built a new Angular 9 project based on Angular-CLI release 9.0.0-rc.5 and @nestjs/ng-universal.
No errors on build. But after startup I got one exception.

`[Nest] 42078   - 12/11/2019, 9:51:13 AM   [ExceptionsHandler] Cannot read property 'indexOf' of undefined +38797ms
TypeError: Cannot read property 'indexOf' of undefined
    at /Users/kjelldirdal/buddydrive-ssr/node_modules/@nestjs/ng-universal/dist/utils/setup-universal.utils.js:35:43
    at /Users/kjelldirdal/buddydrive-ssr/dist/server/main.js:105767:13
    at View.engine (/Users/kjelldirdal/buddydrive-ssr/node_modules/@nestjs/ng-universal/dist/utils/setup-universal.utils.js:30:11)
    at View.render (/Users/kjelldirdal/buddydrive-ssr/node_modules/express/lib/view.js:135:8)
    at tryRender (/Users/kjelldirdal/buddydrive-ssr/node_modules/express/lib/application.js:640:10)
    at Function.render (/Users/kjelldirdal/buddydrive-ssr/node_modules/express/lib/application.js:592:3)
    at ServerResponse.render (/Users/kjelldirdal/buddydrive-ssr/node_modules/express/lib/response.js:1012:7)
    at /Users/kjelldirdal/buddydrive-ssr/node_modules/@nestjs/ng-universal/dist/angular-universal.module.js:60:66
    at Layer.handle [as handle_request] (/Users/kjelldirdal/buddydrive-ssr/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/kjelldirdal/buddydrive-ssr/node_modules/express/lib/router/route.js:137:13)``

@kamilmysliwiec
Copy link
Member

@nestjs/ng-universal is not compatible with Angular 9. There is no official Angular 9 release yet.

@ghiscoding
Copy link

duplicate of #3513 that I've opened more than 2 weeks ago, there's more info there

@lock
Copy link

lock bot commented Mar 17, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Mar 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

2 participants