-
Notifications
You must be signed in to change notification settings - Fork 12.8k
TS Server fatal error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isUnaryExpression'. #53637
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
Comments
For me this was because of the React Native's new Hermes Engine. It produces binary .js files which tsc tries and fails to compile (because they aren't actually js). The solution is to exclude the dist folder by adding the following to your tsconfig.json: For example if using |
Worked for me too! thanks |
Can anyone provide the file which causes TS to crash? The stack trace is long enough that I don't think we can come up with a test case out of thin air. |
Metapoint: it's really not great that Hermes is writing |
We could really use a Hermes binary JS file for each Hermes bytecode version so we can detect and avoid them. Anyone able to upload those artifacts? |
That's a good point, according to this draft RFC the files are supposed to have the
Unfortunately I cannot provide the binary because it's part of an internal project, however any project compiled with the latest React Native/Expo version should produce the bytecode you're looking for. Also from the above draft RFC it seems like Hermes bytecode should always start with the magic number |
Or as an alternative idea tsc could ignore any file with unrecognized characters and issue a warning instead of erroring out, but that might be a bit too drastic of a change. |
Hi all, Providing context from the React Native Android + Hermes build pipeline. To the best of my knowledge, we don't emit Hermes produces
Users can override the final bundle location, so if they specify a filename that ends with So I believe here the root cause could be some sort of misconfiguration on the user side. Codepointers to the Android logic for futher context: https://github.com/facebook/react-native/blob/bece6500f7d6374eab09917c9afd3bf6142f0b61/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt#L92-L113 |
Please, someone, please please post a concrete repro (zip file, repo, etc)We really do need one! Please! |
Related is #50675; is everyone here using But again, please... a repro... |
|
It sounds like there are two issues at hand, namely that build artifacts are being analyzed by the language server and that Hermes bytecode files with the .js file extension are being parsed as JavaScript. To help with the second issue, the next major release of Expo CLI will export Hermes bytecode files using the .hbc file extension (see expo/expo#21990). |
Type: Bug
❗️❗️❗️ Please fill in the sections below to help us diagnose the issue ❗️❗️❗️
TypeScript Version: 5.0.2
Steps to reproduce crash
TS Server Log
❗️ Server logging disabled. To help us fix crashes like this, please enable logging by setting:
After enabling this setting, future crash reports will include the server log.
TS Server Error Stack
Server:
semantic
VS Code version: Code 1.77.0 (Universal) (7f329fe6c66b0f86ae1574c2911b681ad5a45d63, 2023-03-29T09:57:11.797Z)
OS version: Darwin arm64 22.4.0
Modes:
Sandboxed: Yes
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Extensions (23)
(1 theme extensions excluded)
A/B Experiments
The text was updated successfully, but these errors were encountered: