Support conditional compilation
See original GitHub issueOn codeplex this was a popular feature request:
https://typescript.codeplex.com/workitem/111 https://typescript.codeplex.com/workitem/1926
Personally I think preprocessor directives like #if, #elif, #else #endif with possibility to specify symbol to compiler would be very useful.
And a way to mark function (or ambient function declaration) as Conditional (something like ConditionalAattribute in C#) would be great improvement too.
I have lot’s of console.log
like function calls that decrease performance of my application and ability to easily remove all calls to this function would be great.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:89
- Comments:82 (25 by maintainers)
Top Results From Across the Web
Understanding conditional compilation (VBA) - Microsoft Learn
Use conditional compilation to run blocks of code selectively, for example, debugging statements comparing the speed of different approaches ...
Read more >Conditional compilation - Wikipedia
In computer programming, conditional compilation is a compilation technique which results in ... Many programming languages support conditional compilation.
Read more >3.3.4 Conditional Compilation
The third useful facility provided by the preprocessor is conditional compilation; i.e. the selection of lines of source code to be compiled and...
Read more >Conditional inclusion - cppreference.com
The preprocessor supports conditional compilation of parts of source file. This behavior is controlled by #if , #else , #elif , #ifdef ...
Read more >Conditional compilation (Delphi) - RAD Studio
Category Symbol DCC32 DCC64 Since XE2 DCCOSX Since XE2 DCCOSX64 Sin...
Compiler DCC DEFINED DEFINED DEFINED DEFINED
Platform CONSOLE DEFINED DEFINED DEFINED DEFINED
Platform IOS not...
Read more >Top Related Medium Post
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Some use-cases:
Here’s our use case. This feature would greatly simplify our lives.
We have a common code-base targeting the browsers and Cordova hybrid apps. Parts of our code base only deal with one or the other.
We would love if we could leave certain parts out for different builds. They also pull in different dependencies. So when building for the web we have to pull in Cordova dependencies otherwise TS complains about missing types.