Skip to content
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

VSCode "Format Code" causes tslint failure with (old-school) type assertions #10362

Closed
LOZORD opened this issue Aug 16, 2016 · 2 comments
Closed
Labels
Fixed A PR has been merged for this issue Help Wanted You can do this Suggestion An idea for TypeScript

Comments

@LOZORD
Copy link

LOZORD commented Aug 16, 2016

Preceded by https://github.com/Microsoft/vscode-tslint/issues/69 and microsoft/vscode#10296

TypeScript Version: 1.8.0

Code

If I have code like this:

const bar = <Bar> Thing.getFoo();

and then "Format Code" in VSCode (alt-shift-F on Mac), I get this:

const bar = <Bar>Thing.getFoo();

Expected behavior:

The spacing should not have been changed. (Note: without a specific setting, this causes a failure with tslint.)

Actual behavior:

The space after the old-school/bracket-style type assertion is removed, causing a tslint error.

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Help Wanted You can do this labels Aug 16, 2016
@RyanCavanaugh
Copy link
Member

Looks like this isn't currently configurable, but is controlled by the noSpaceAfterTypeAssertion rule

@RyanCavanaugh RyanCavanaugh added this to the Community milestone Aug 16, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Aug 18, 2016

The current behavior is the intended design. this is similar to C# cast expression formatting in VS for instance. the request here is to add a new formatter option to add a space after type assertion.

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Sep 14, 2016
@mhegazy mhegazy modified the milestones: TypeScript 2.1, Community Sep 14, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants