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.

Tsserver throws error when class member names ends with $

See original GitHub issue

Not really an Excalibur bug so I hope it’s alright that I post this here.

The problem occurs when trying to extend the Actor class. The Actor extends the Entity class which have a couple of observables with names suffixed with the $ sign. When trying to add new members in my extended class, tsserver is throwing an error. Pics below.

I tracked down the problem to the version of TypeScript (4.6.3) that Excalibur uses. After I downloaded this project and updated TypeScript to the latest version, 4.7.3, the problem went away. Unfortunately I couldn’t find a related ticket in TypeScript’s Github repo and I’ve only seen this occur in Neovim. The problem also goes away if I remove all dollar signs in the Entity class.

Steps to Reproduce

Open the Actor class in this project or extend the Actor class with (Neo)Vim and a configured tsserver plugin, eg. coc-tsserver.

Expected Result

With TypeScript 4.7.3 image

Actual Result

With TypeScript 4.6.3 image

Environment

  • operating system: osx
  • Excalibur versions: 0.26.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
eonarheimcommented, Jun 25, 2022

Sure @ewal let me know if you run into new information and we’ll look into it again 👍

1reaction
ewalcommented, Jun 18, 2022

Sorry for the delay, @eonarheim!

I decided to do some more testing. I still haven’t figured out the source of the problem but at least I now know how to bypass it 😃 I have my suspects though, see further down.

TLDR; The problem goes away if the consuming project is using TypeScript version <= 4.5.5

Using Excalibur in a new minimal project

  • Between tests all dependencies was removed and freshly reinstalled
  • The error message is show as soon as the IDE asks to show completions for a class that extends the eg. Actor class
  • It is NOT shown when asking for completions inside a class method or getter etc.
  • Not all classes throws this error, for example extending a Scene class works fine.
  • Only the consuming project needs to specify a lower TypeScript version
  • Excalibur was added as a local dependency and built with npm run clean && npm run build

Error message: [coc.nvim] Error: Error processing request. Debug Failure. Did not expect GetAccessor t o have an Identifier in its trivia … More

IDE: Neovim 0.7.0 coc-tsserver

(Tested two different computers with nvim and coc, Linux and Mac)

Minimal test project: TypeScript:

  • 4.6.3
  • 4.5.5
  • 4.7.3
  • 4.7.4

Excalibur:

  • 0.26.0

Node:

  • 16.14.2
  • 16.15.1

Yarn:

  • 1.22.19

Excalibur source project: TypeScript:

  • 4.6.3
  • 4.5.5
  • 4.7.3
  • 4.7.4

Node:

  • 16.14.2
  • 16.15.1

Npm:

  • 8.11.0

Test class

import * as ex from "excalibur";

export class Test extends ex.Actor {
// error is thrown as soon as you start typing here
}

I have no idea what the underlying problem is but I suspect that it is related to js-doc comments. Example issue https://github.com/microsoft/TypeScript/issues/48238 My idea is that TypeScript misinterpret some comment content where code examples are used… 🤷

I upgraded all dependencies in Excalibur and fiddled with the configurations for eslint, typescript, js-doc etc. which resultet in js-doc started to throw a lot of errors. Not of them saved but they all related to how the comments where formatted.

That’s what I have so far 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

TS gives JSDoc error on ...rest parameter, even when ... - GitHub
@ts-check // Error: `Qualified name '...rest' is not allowed without a leading ... Tsserver throws error when class member names ends with ......
Read more >
Typescript error: TS7053 Element implicitly has an 'any' type
Solution 6: Define a list of valid (string) property names: ... In case you have an interface / class defined and it still...
Read more >
Typescript does not resolve modules through tsconfig.json's ...
I get an error: TS2307: Cannot find module 'services/authentication/index'. Even though simply compiling the Typescript through the CLI ...
Read more >
A Complete Guide to Using TypeScript in Node.js - Better Stack
Fixing errors caused by missing types. Setting up linting and formatting for TypeScript files. Debugging TypeScript in Chrome or VS Code. Deploying your ......
Read more >
TypeScript Programming with Visual Studio Code
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It offers classes, modules, and interfaces to help you build robust...
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