Webpack Build Errors: An accessor cannot be declared in an ambient context
See original GitHub issueExpected Behavior
Project builds with webpack through Vue UI.
Current Behavior
It does not, it throws errors.
Steps to Reproduce
- Start a webpack/Vue Project
- Add this library
- 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:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Upgrading TypeScript resolved this issue.
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.