Skip to content

Suggestion : Add a compiler flag to treat errors as warnings #14501

Closed

Description

@ifle

Add a compiler flag to treat errors as warnings.
That will be very helpful in case of migration from legacy javascript project to typescript

Activity

  1. RyanCavanaugh commented on Mar 7, 2017

    @RyanCavanaugh
    Member

    Other than printing

    a.ts(12,12): warning TS2345

    instead of

    a.ts(12,12): error TS2345

    what would you expect this flag to do, behaviorally?

  2. ifle commented on Mar 8, 2017

    @ifle
    Author

    That will allows to compile asp.net web project in VS without compile errors.
    For now the build is fail. We have the legacy asp.net project . We started migration from js to ts. In the first stage we renamed all js files to ts. There are a lot typescript errors, but generated js is still valid.

  3. mribichich commented on May 30, 2017

    @mribichich

    Same for me, I have a couple of errors that I know there ok, but since typescript treats them as errors the build fails.

  4. mhegazy commented on May 30, 2017

    @mhegazy
    Contributor

    what are the errors if i may ask?

  5. onzag commented on Sep 18, 2017

    @onzag

    How is this going, I have thousand of errors because I am running a migration, but the build fails because of the errors, giving a lot of log messages in webpack, I simply can't fix them all.

  6. mhegazy commented on Sep 18, 2017

    @mhegazy
    Contributor

    How is this going, I have thousand of errors because I am running a migration, but the build fails because of the errors, giving a lot of log messages in webpack, I simply can't fix them all.

    what is your build driver? MSBuild?

  7. aminpaks commented on Oct 21, 2017

    @aminpaks
    Contributor

    I think the new compiler @ts-ignore flag will cover this no?

  8. ifle commented on Oct 21, 2017

    @ifle
    Author

    That is right direction :). In my case the best solution is adding the flag to the tsconfig with optional list of ignored errors

  9. aminpaks commented on Oct 21, 2017

    @aminpaks
    Contributor

    ifle (@ifle) apparently the topic is more complicated that I thought. Read what Alex Eagle (@alexeagle) has to say about this

  10. alexeagle commented on Oct 22, 2017

    @alexeagle
    Contributor

    I agree, for violations of the type system or language spec, // @ts-ignore gives you an extra freedom to disable errors during a migration.

  11. KodaPOwER commented on Jan 10, 2018

    @KodaPOwER

    Any news on this?
    How can i just compile even on error? We are migrating from js to ts.
    I have a lot of file just renamed to .ts waiting to be converted.
    If i compile on save, i have the error in the error list but the js file is emitted.
    Instead msbuild stop on the error and that broke my CI in teamcity.
    Why i can't replicate this behavior in msbuild? I can't flag 2000+ lines with // ts-ignore

  12. bodinsamuel commented on Jul 17, 2019

    @bodinsamuel

    Hello, It's a been long time and the issue is not closed.
    Is it something you are planning? thanks :)

  13. RyanCavanaugh commented on Jul 17, 2019

    @RyanCavanaugh
    Member

    I think the only thing left to address here is the msbuild scenario, which is effectively tracked at #13280

  14. QingLeiLi commented on Oct 20, 2019

    @QingLeiLi

    Maybe we should add a ts config option to prevent the error to throw.

  15. nbkhope commented on Apr 29, 2022

    @nbkhope

    Was this feature ever implemented? I too would love to have errors be just warnings as it helps migrating a codebase from JS to TS.

  16. TomasHubelbauer commented on Feb 3, 2023

    @TomasHubelbauer

    Would be cool to be able to treat unused imports as errors.

  17. locked as resolved and limited conversation to collaborators on Oct 21, 2025
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions