0

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
}
1
  • 2
    In general, this is a bad idea. You should use external configuration (e.g. looking for a DEVELOPMENT environment variable) to toggle the behaviour, otherwise you have to keep editing the file just to run unit tests. Commented Nov 9, 2018 at 14:04

1 Answer 1

2

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" = "";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.