-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Changes in JSON files cause stale TS errors in ts/tsx files #60241
Comments
The following code can be used to reproduce the error. Note that requiredKey should be in both the json files to avoid producing any type mismatch. import type { Booleans, Fn, Pipe, Tuples } from 'hotscript';
import type { IsNever } from 'type-fest';
import type { default as DataTypeEN } from './../public/locales/en/translation.json';
import type { default as DataTypeNL } from './../public/locales/nl/translation.json';
type Locales = [typeof DataTypeEN, typeof DataTypeNL];
interface ContainsFn<T> extends Fn {
return: IsNever<Exclude<keyof T, keyof this['arg0']>>;
}
export type TranslationAvailable<T> = Pipe<
Locales,
[
Tuples.Map<ContainsFn<T>>,
Tuples.Some<Booleans.Extends<false>>,
Booleans.Not,
]
>;
let foo: TranslationAvailable<{ requiredKey: string }> = true; In the image below, you can see that the popup, shows the updated type, but the error is not visible in the editor by a squiggle, except for the unrelated warnings which were already present. After changing the JSON file (changing requiredKey to requiredK for example), we can observe that the error does also not propagate when the change is matched in the TS file by updating that file. So it seems that the JSON files themselves cause a stale cache that prevents any TS errors in opened files to become visible automatically. After restarting the TS server the error is shown immediately as seen below: |
Type: Bug
VS Code version: Code 1.94.2 (Universal) (384ff7382de624fb94dbaf6da11977bba1ecd427, 2024-10-09T16:08:44.566Z)
OS version: Darwin arm64 24.0.0
Modes:
Remote OS version: Linux arm64 6.8.0-45-generic
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Extensions (27)
A/B Experiments
The text was updated successfully, but these errors were encountered: