Skip to content

Wrong space in type assertions when using array #52177

@ouqilbo

Description

@ouqilbo

TS Template added by @mjbvz

TypeScript Version: 4.9.4

Search Terms

  • format

Type: Bug

When formatting a ts file with "typescript.format.insertSpaceAfterTypeAssertion": true
the file should be like this:

let a = <string> "";
let b = <number> 1;
let c = <any[]> [];
let d = <string[]> [];
let e = <string[]> ["e"];

but, after formatting, the array ones get removed the space, and it becomes like this:

let a = <string> "";
let b = <number> 1;
let c = <any[]>[];
let d = <string[]>[];
let e = <string[]>["e"];

VS Code version: Code 1.74.2 (e8a3071ea4344d9d48ef8a4df2c097372b0c5161, 2022-12-20T10:27:19.253Z)
OS version: Linux x64 5.19.0-28-generic
Modes:
Sandboxed: No

System Info
Item Value
CPUs Intel(R) Core(TM) i5-4670K CPU @ 3.40GHz (4 x 3666)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
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_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 1, 1, 1
Memory (System) 11.56GB (5.19GB free)
Process Argv --disable-extensions --crash-reporter-id 7fc8d030-ec7d-42f0-9204-5c18918eb561
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE x11
Extensions disabled
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vscaat:30438848
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
pyindex848cf:30577861
nodejswelcome1:30587005
3biah626:30602489
3d0df643:30613357
89544117:30613380
fim-prod:30623723

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatterHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions