Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional compilation #4671

Closed
dead-claudia opened this issue Sep 6, 2015 · 4 comments
Closed

Conditional compilation #4671

dead-claudia opened this issue Sep 6, 2015 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@dead-claudia
Copy link

Conditional compilation would be fantastic, in my opinion, for things like imports. I would really appreciate something like this:

@if DEBUG
@define HAS_ASSERT
import assert from "assert";
@elif RELEASE
import aRandomModule from "my-cool-module";
@else
@undef FOO
@endif

Not asking for macros (there's not nearly as much of a use case in TypeScript as in e.g. C/C++), but merely having an if-else/define/undef preprocessor would be incredibly helpful.

@weswigham
Copy link
Member

Dupe of #449 ?

@jesseschalken
Copy link
Contributor

Just import all the things you could need and decide what to use at runtime.

At best all you'd be saving with condition compilation is the overhead of an import.

@dead-claudia
Copy link
Author

Size is a reason to prefer conditional importing and compilation,
particularly in the case of the browser.

On Sun, Sep 6, 2015, 09:58 Jesse Schalken notifications@github.com wrote:

Just import all the things you could need and decide what to use at
runtime.

At best all you'd be saving with condition compilation is the overhead of
an import.


Reply to this email directly or view it on GitHub
#4671 (comment)
.

@yortus
Copy link
Contributor

yortus commented Sep 8, 2015

I made a proposal with a working implementation in #4691

@danquirk danquirk closed this as completed Sep 8, 2015
@danquirk danquirk added the Duplicate An existing issue was already created label Sep 8, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

5 participants