New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tsserver throws error when class member names ends with $ #2338
Comments
Hi @ewal thanks for the issue! Oh wow, this is very interesting! It's wild that I have a colleague with a similar environment to yours that will be digging into the issue. I found the related coc-tsserver issue you posted on (including here for posterity) neoclide/coc-tsserver#365 |
I'm wondering if it's an odd interaction with that specific version of typescript's tsserver and the tsserver extension? At least in vscode pointing to that same version of typescript it seems to work okay. There might not be anything we can directly do here other than upgrade typescript on main. |
Hi, thanks for the reply! I've been fighting this issue for quite a while now and have had many different theories but it feels like I'm going in circles. Tbh, I'm not even sure that TypeScript is the cause anymore. It might as well be something with my environment. But, I do work in several other ts projects and I've only seen this particular problem once before after migrating a js-file to ts; code worked well in a brand new file with a different name but threw this error in the renamed file. |
Edited: Deleted – too quick to comment... |
The quest continues... So, updating TypeScript only solved part of my problem and I'm now pretty convinced that the issue lies elsewhere. I downloaded this repo and began commenting out everything in the Actor class and then re-added its members, piece by piece. I added a new test class in sandbox/src and found that when adding a setter to the Actor class, the error is thrown as shown in the gif. One step further but still no idea why this is happening :) Edit: This test was made with node 16.15.0 :/ |
Side note and definitely not related but, found a getter that can modify it's own return value in TransformComponen.ts, line 244. Not so dangerous here since the called method will set dirty to false, but bit of a risky pattern :)
|
@ewal Thanks for digging into this issue so deep, this is truly mysterious!
True true! This code will in theory go away soon :) I have some performance optimizations that hopefully makes the old transform implementation obsolete (in addition to being a lot simpler) https://github.com/excaliburjs/Excalibur/blob/perf/transform-matrix-refactor/src/engine/Math/transform.ts |
I found the cause to the problem, ... 13+ days later 😬 I'll write a short summary soon. Was nearly going crazy there for a while. |
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; Using Excalibur in a new minimal project
Error message: IDE: Neovim 0.7.0 (Tested two different computers with nvim and coc, Linux and Mac) Minimal test project:
Excalibur:
Node:
Yarn:
Excalibur source project:
Node:
Npm:
Test class
I have no idea what the underlying problem is but I suspect that it is related to js-doc comments. 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 :) |
Btw, I have problems running the specs. The failing specs all relate to headless chrome and I can't find a solution. For example |
@ewal Interesting, it might mean that the WebGL context is failing to initialize in linux for some reason. Are you able to create a The WebGL accessor gets registered right after the context creation, if it failed it would explain the failing test |
Replaced ChromeHeadless with ChromiumHeadless and got a bit further. Test still fails but for different reasons. On Linux now but gonna test in os x too. |
Another thing – I can't install the packages in the main branch without either upgrading typedoc to the latest version or downgrading typescript to 4.5.5. That might be a hint that the problem comes from typedoc.
|
Thanks for the note! Looks like I had my user .npmrc misconfigured locally to I'll push and npm override for typedoc to the main repo, unfortunately upgrading typedoc is usually a bigger task. Typedoc seems to work for our purposes with it's TypeScript peer overriden temporarily. |
Also it's possible some of the text/font related tests may fail if the OS doesn't exactly render the fonts the same as our GH CI environment (ubuntu-latest) with Chrome. Text rendering is very operating system dependent unfortunately. |
Should we close this issue? I'm using typescript 4.5.5 in my project which works fine and I seem to be alone experiencing this problem. |
Sure @ewal let me know if you run into new information and we'll look into it again 👍 |
@eonarheim, I really wanted a new feature in ts 4.7.4, still using 4.5.5, so I did a health check inside the ./src/engine folder by generating a new tsconfig template with |
Very nice 👍 The new feature is called |
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
Actual Result
With TypeScript 4.6.3
Environment
The text was updated successfully, but these errors were encountered: