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.

"anonymous abstract function" with symbol-identified methods

See original GitHub issue

The following code:

export interface AccessorBase<T> {
    readonly $accessPath: AccessPath<any, T>;
    readonly $parent: ObjectAccessor<{}> | ListAccessor<object> | undefined;

    [accessPathSymbol](): AccessPath<any, T>;
}

generates the error anonymous abstract function. This is most likely the case because propertyName only considers identifiers and string literals, and not symbols. I have not checked, but I would gess ['methodName'](): string causes the same error.

The problem has been introduced in version 0.33.0 - 0.32.1 works.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ayazhafizcommented, Jul 12, 2019
2reactions
ribrdbcommented, Jun 18, 2019

Is this really inexpressible in closure? How is it different from the Symbol methods in https://github.com/google/closure-compiler/blob/50713dceb16b369f8f317e5b49e8a9dec2b47496/externs/es6_collections.js

Couldn’t you just do

/** @returns {AccessPath<*,T>}*/
AccessorBase.prototype[accessPathSymbol] = function();

I tried manually generating this code and the closure compiler seems to accept it. So I think you could fix this in tsickle/src/jsdoc_transformer.ts: If fnDecl.name.kind == ts.SyntaxKind.ComputedPropertyName, use ts.createElementAccess(instancePropAccess, fnDecl.name.expression) instead of ts.createPropertyAccess(instancePropAccess, name)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding abstract method using anonymous class
I'm trying to override a abstract method using anonymous class but it shows error like Class A is not abstract and abstract method...
Read more >
Abstract Methods and Classes (The Java™ Tutorials ...
An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon), like this:.
Read more >
Anonymous Classes and Single Abstract Method Types
Scala suppports, similar to Java, a way to define anonymous classes. Let's assume we have an interface.
Read more >
Java Abstract Class and Method (With Example) - Programiz
A method that doesn't have its body is known as an abstract method. We use the same abstract keyword to create abstract methods....
Read more >
Anonymous class that extends abstract class but does not ...
EPHP Fatal error: Class class@anonymous contains 1 abstract method and must therefore be declared abstract or implement the remaining ...
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