Skip to content

[Suggestion] Allow @ts-ignore at the end of the same line #20111

Open

Description

I added a comment in #18457 (comment) but I think that nobody saw it.

It would be nice if I could put the @ts-ignore at the same line, to leave the code more readable

let v1: string = 1; // @ts-ignore
let v2: string = 2; // @ts-ignore
let v3: string = 3; // @ts-ignore
let v4: string = 4; // @ts-ignore
let v5: string = 5; // @ts-ignore
let v6: string = 6; // @ts-ignore

instead of:

// @ts-ignore
let v1: string = 1;
// @ts-ignore
let v2: string = 2;
// @ts-ignore
let v3: string = 3;
// @ts-ignore
let v4: string = 4;
// @ts-ignore
let v5: string = 5;
// @ts-ignore
let v6: string = 6;

Activity

  1. mgcrea commented on Jul 17, 2019

    @mgcrea

    Would be great, but I think having a separate syntax, eg. @ts-ignore-line would be safer as there would not be any doubt about swallowing errors for the next line.

  2. xamgore commented on Nov 10, 2019

    @xamgore

    Daniel Rosenwasser (@DanielRosenwasser) is it possible to include the feature into the upcoming 3.8 iteration?

  3. bdrazen commented on Dec 23, 2019

    @bdrazen

    Still nothing on this...?

  4. satelllte commented on Jun 15, 2021

    @satelllte

    Still nothing on this? 😢

  5. mckravchyk commented on Sep 18, 2021

    @mckravchyk

    +1 for @ts-ignore-line

  6. olafkotur commented on Feb 11, 2022

    @olafkotur

    +1 for @ts-ignore-line too :)

  7. user72356 commented on Apr 10, 2022

    @user72356

    +1 for this. The ever responsive MS...

  8. nikhil-varma commented on Jun 7, 2022

    @nikhil-varma

    +1 For this

  9. Auxtal commented on Mar 27, 2023

    @Auxtal

    Please, how is this still open 😩

  10. sansantosh commented on May 6, 2023

    @sansantosh

    work around:
    You can do this instead :
    image

  11. user72356 commented on May 6, 2023

    @user72356

    work around: You can do this instead : image

    That's even harder to read than having the ignore above the line.

  12. sansantosh commented on May 6, 2023

    @sansantosh

    work around: You can do this instead : image

    That's even harder to read than having the ignore above the line.

    but it does save extra new lines

  13. machineghost commented on Jun 15, 2023

    @machineghost

    It'd be nice if the Typescript team would either accept or reject this issue, instead of leaving it in limbo.

    It seems to me like this would improve TypeScript for everyone ... but if the maintainers don't agree, even a one-sentence explanation of why they feel it would be detrimental would be greatly appreciated.

  14. Jropp commented on Aug 2, 2023

    @Jropp

    +1

  15. pinkboid commented on Sep 15, 2023

    @pinkboid

    +1

  16. mafuuu-dev commented on Oct 1, 2023

    @mafuuu-dev

    +1.

    Such a necessary and important functionality, code cleanliness suffers because of this, it's terribly annoying when everything looks beautiful and elegant, but then this annotation appears, it stands out so much. Team, please pay attention to this issue! It's been almost 6 years already! It's really very painful.

    Olivier Louvignes (@mgcrea) Jeremy Walker (@machineghost) Daniel Rosenwasser (@DanielRosenwasser) Wesley Wigham (@weswigham) santosh shrestha (@sansantosh)

  17. dandv commented on Jan 30, 2024

    @dandv
    Contributor

    ESLint has this feature in the form of // eslint-disable-line. Would be nice for TypeScript to allow a similar syntax.

  18. lborgman commented on Aug 8, 2024

    @lborgman

    Any news?

  19. snarbies commented on Aug 8, 2024

    @snarbies

    Any news?

    If there was, this is where it would be. Set your expectations accordingly.

  20. kenlane33 commented on Sep 11, 2024

    @kenlane33

    +1 for @ts-ignore-line
    Lack of it blocks team migration to TS.
    "Require massive code junk!? Forget it!"
    Choose: (A) TS adoption or (B) legibility-crime?

  21. lborgman commented on Jul 16, 2026

    @lborgman

    work around: You can do this instead : image

    I just tried in vscode. It did not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions