Peter Dub
Peter Dub

Reputation: 531

user defined warning in typescript

I want to add code just temporary and remove it before I do commit. How to create user defined warning in typescript so compiler (or build server) will let me know that this code is still there. I don't want to forget about it. In C# there is #warning, is there something similar in TypeScript?

Example:

foo(){
    // #warning: remove next line before commit, it is just for develop purposes
    return true;
    return someLogic(); // just this line should be there
}

Upvotes: 0

Views: 353

Answers (1)

Matt McCutchen
Matt McCutchen

Reputation: 30889

Since type errors don't block code generation, you can write a dummy line of code that produces a type error, for example:

let a: "remove me before commit" = "";

Upvotes: 2

Related Questions