question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack Build Errors: An accessor cannot be declared in an ambient context

See original GitHub issue

Expected Behavior

Project builds with webpack through Vue UI.

Current Behavior

It does not, it throws errors.

Steps to Reproduce

  1. Start a webpack/Vue Project
  2. Add this library
  3. Try to build

(Not sure if this is reproducible that way?)

Enviornment

TypeScript 3.5.3

 error  in [RedactedPath]/ClientApp/node_modules/ste-core/dist/dispatching.d.ts

ERROR in [RedactedPath]/ClientApp/node_modules/ste-core/dist/dispatching.d.ts
19:9 An accessor cannot be declared in an ambient context.
    17 |      * @memberOf DispatcherBase
    18 |      */
  > 19 |     get count(): number;
       |         ^
    20 |     /**
    21 |      * Subscribe to the event dispatcher.
    22 |      * @param fn The event handler that is called when the event is dispatched.

 error  in [RedactedPath]/ClientApp/node_modules/ste-core/dist/dispatching.d.ts

ERROR in [RedactedPath]/ClientApp/node_modules/ste-core/dist/dispatching.d.ts
119:9 An accessor cannot be declared in an ambient context.
    117 |      * @memberOf DispatcherWrapper
    118 |      */
  > 119 |     get count(): number;
        |         ^
    120 |     /**
    121 |      * Subscribe to the event dispatcher.
    122 |      * @param fn The event handler that is called when the event is dispatched.

 error  in [RedactedPath]/ClientApp/node_modules/ste-events/dist/events.d.ts

ERROR in [RedactedPath]/ClientApp/node_modules/ste-events/dist/events.d.ts
74:19 An accessor cannot be declared in an ambient context.
    72 |      * Gets the list with all the event dispatchers.
    73 |      */
  > 74 |     protected get events(): EventList<TSender, TArgs>;
       |                   ^
    75 |     /**
    76 |      * Subscribes to the event with the specified name.
    77 |      * @param name The name of the event.

 error  in [RedactedPath]/ClientApp/node_modules/ste-signals/dist/signals.d.ts

ERROR in [RedactedPath]/ClientApp/node_modules/ste-signals/dist/signals.d.ts
45:19 An accessor cannot be declared in an ambient context.
    43 | export declare abstract class SignalHandlingBase implements ISignalHandling {
    44 |     private _events;
  > 45 |     protected get events(): SignalList;
       |                   ^
    46 |     /**
    47 |      * Subscribes once to the event with the specified name.
    48 |      * @param name The name of the event.

 error  in [RedactedPath]/ClientApp/node_modules/ste-simple-events/dist/simple-events.d.ts

ERROR in [RedactedPath]/ClientApp/node_modules/ste-simple-events/dist/simple-events.d.ts
69:19 An accessor cannot be declared in an ambient context.
    67 | export declare abstract class SimpleEventHandlingBase<TArgs> implements ISimpleEventHandling<TArgs> {
    68 |     private _events;
  > 69 |     protected get events(): SimpleEventList<TArgs>;
       |                   ^
    70 |     /**
    71 |      * Subscribes to the event with the specified name.
    72 |      * @param name The name of the event.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
douglasg14bcommented, Jan 30, 2020

Upgrading TypeScript resolved this issue.

1reaction
douglasg14bcommented, Jan 30, 2020

Potentially related: https://stackoverflow.com/questions/59502139/ts1086-an-accessor-cannot-be-declared-in-an-ambient-context

Updating TypeScript to see if that resolves this. If it does, this library should make it clear that TS 3.6+ is a requirement.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TS1086: An accessor cannot be declared in ambient context
2. this Works for me. but i have to downgrade my typescript version to 3.6.x. above 3.8.0 not working and throws error. ·...
Read more >
Angular 7 (An accessor cannot be declared in an ambient ...
I try to build --prod my angular apps, I get this errors: ERROR in node_modules/@builder.io/sdk/dist/src/classes/observable.class.d.ts(7, ...
Read more >
Angular – “An accessor cannot be declared in an ambient context ...
I have a webpack, typescript project (A) which emits a small library. The library is used in an angular 8 project (B). In...
Read more >
Fixing accessor cannot be declared in an ambient context error
Fixing accessor cannot be declared in an ambient context error in Angular Animations project with Ionic 4 and Angular 8.
Read more >
primeng error TS1086: An accessor cannot be declared in an ...
An accessor cannot be declared in an ambient context. ... ERROR in node_modules/codelyzer/angular/styles/cssAst.d.ts:38:9 - error TS1086: An accessor cannot be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found