Uncaught TypeError: this.token_qt5re9_k$ is not a function
WTF?!
s
Svyatoslav Kuzmich [JB]
10/11/2021, 10:14 AM
token
is probably called without an object instance:
Copy code
> var tp = new TemplateParser();
undefined
> tp.token("A", "B")
A B
null
> var token = tp.token
undefined
> token("A", "B")
Uncaught TypeError: this.token_qt5re9_k$ is not a function
at TemplateParser.token (REPL9:2:21)
p
Pitel
10/11/2021, 10:24 AM
It's used in a library, so I don't know how they are using it. But I rewrote it from
class
to just simple
jsObject
of that interface with
var token
and lambda, it's working.
s
Svyatoslav Kuzmich [JB]
10/11/2021, 10:52 AM
Another possible workaround is using property with a function type:
Copy code
external interface StreamParser {
val token: (stream: StringStream, state: dynamic) -> String?
}
class TemplateParser : StreamParser {
override val token = fun (stream: StringStream, state: dynamic): String? {
…
}
}