From other languages I know __FILE__ or similar expressions (for example: in PHP - a constant, in C - a preprocessor macro), which are replaced by the current path to the source file. Is there anything similar in TypeScript?
__FILE__
If you are creating a node application
__dirname
Gives you the current module directory path
https://nodejs.org/docs/latest/api/globals.html#globals_dirname
There is currently a function request for this, see https://github.com/Microsoft/TypeScript/issues/4892
From what I see, it has not yet been implemented.
You can create one workflow by adding your custom comments (e.g. / ** @ compile-if * /) and then using the Gulp / Grunt task to convert the code after the actual Typescript compilation.
Source: https://habr.com/ru/post/1247192/More articles:Converting json array to json object in android using gson? - javaWhat is the difference between `pushManager.subscribe` and` pushManager.getSubscription` Service Worker's - google-chromeStarting a new line after connecting to the command: is there any standard? - unixHow to remove the last CR char with `cut` - linuxRxJS: an interval that starts immediately - angularHow to add list names in df as a column in a data frame - reclipse with moonrise color theme: change button color - eclipseSASS equivalent to LESS Space syntax ("+ _") - sassHow to display information inside a module from url? - javascriptExcel VBA - returning selected item to slicer - vbaAll Articles