Tsserver throws error when class member names ends with $
See original GitHub issueNot 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
Actual Result
With TypeScript 4.6.3
Environment
- operating system: osx
- Excalibur versions: 0.26.0
Issue Analytics
- State:
- Created a year ago
- Comments:20 (8 by maintainers)
Top GitHub Comments
Sure @ewal let me know if you run into new information and we’ll look into it again 👍
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
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:
Excalibur:
Node:
Yarn:
Excalibur source project: TypeScript:
Node:
Npm:
Test class
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 😃