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

Expose new compiler flags in the .targets file #3034

Closed
14 tasks done
mhegazy opened this issue May 5, 2015 · 19 comments
Closed
14 tasks done

Expose new compiler flags in the .targets file #3034

mhegazy opened this issue May 5, 2015 · 19 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@mhegazy
Copy link
Contributor

mhegazy commented May 5, 2015

We have added a set of new flags over the course of this release, we need to add MSBuild properties for them in VS 2013 and VS 2015 in .target files as well as in the project properties.

VS 2013

VS 2015

Note: separateCompilation flag name could change based on the design meeting discussion for #2499

@mhegazy mhegazy added this to the TypeScript 1.5.2 milestone May 5, 2015
@mhegazy mhegazy added the Bug A bug in TypeScript label May 5, 2015
@mhegazy
Copy link
Contributor Author

mhegazy commented May 5, 2015

@paulvanbrenk, i do not know if any of these need to be in the UI as well.

@mhegazy
Copy link
Contributor Author

mhegazy commented May 5, 2015

Updates to the new module targets tracked by #3033

@danquirk
Copy link
Member

danquirk commented May 7, 2015

Include emitDecoratorMetadata too (see #3061)?

@mhegazy
Copy link
Contributor Author

mhegazy commented May 7, 2015

updated to include emitDecoratorMetaData.

@cmichaelgraham
Copy link

is there a way to know when this becomes available in the beta install for vs 2013? i'm working on some aurelia samples for the typescript samples repo 👍

@mhegazy
Copy link
Contributor Author

mhegazy commented May 7, 2015

it is going to be in the next public VS release. for now you can set these in TypeScriptAdditionalFlags:

<TypeScriptAdditionalFlags> $(TypeScriptAdditionalFlags) --emitDecoratorMetaData </TypeScriptAdditionalFlags>

@cmichaelgraham
Copy link

@mhegazy oh that is soooooo cool !!!

@cmichaelgraham
Copy link

@mhegazy it works as you say, but there is a very small typo in the compiler flag:

this: emitDecoratorMetaData should be this: emitDecoratorMetadata

so the entire tag looks like this:

  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TypeScriptRemoveComments>false</TypeScriptRemoveComments>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
    <TypeScriptModuleKind>amd</TypeScriptModuleKind>
    <TypeScriptAdditionalFlags> $(TypeScriptAdditionalFlags) --emitDecoratorMetadata </TypeScriptAdditionalFlags>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <TypeScriptRemoveComments>true</TypeScriptRemoveComments>
    <TypeScriptSourceMap>false</TypeScriptSourceMap>
    <TypeScriptAdditionalFlags> $(TypeScriptAdditionalFlags) --emitDecoratorMetadata </TypeScriptAdditionalFlags>
  </PropertyGroup>

cmichaelgraham added a commit to cmichaelgraham/aurelia-typescript that referenced this issue May 7, 2015
@mhegazy
Copy link
Contributor Author

mhegazy commented May 7, 2015

thanks @cmichaelgraham for the correction.

@paulvanbrenk
Copy link
Contributor

edit: made 2 lists

@paulvanbrenk paulvanbrenk added Fixed A PR has been merged for this issue and removed Fixed A PR has been merged for this issue labels May 12, 2015
@mhegazy
Copy link
Contributor Author

mhegazy commented May 19, 2015

PR #3208 updates the remaining flag (--isolatedModules)

@paulvanbrenk paulvanbrenk added the Fixed A PR has been merged for this issue label May 19, 2015
@paulvanbrenk
Copy link
Contributor

This should be in 1.5 RTM for both VS 2013 and VS 2015

@atsu85
Copy link

atsu85 commented Jun 6, 2015

Hi,
Everything works as expected when i do "Build" or "Rebuild" on the project,
but when i just save typescript file, then during compilation decorator metadata is not added to the js file as if "--emitDecoratorMetadata" compiler flag isn't taken into account.

Expected:
SomeClassWithAutoinject = decorate([
aurelia_framework_1.autoinject, metadata('design:paramtypes', [aurelia_router_1.Router, app_state_1.AppState])
], SomeClassWithAutoinject );

Actual:
SomeClassWithAutoinject = __decorate([
aurelia_framework_1.autoinject
], SomeClassWithAutoinject );

I can reproduce this issue with @cmichaelgraham sample project without any modifications:

  1. open https://github.com/cmichaelgraham/aurelia-typescript/blob/typescript-1-5-port/skel-nav-esri-vs-ts/skel-nav-esri-vs-ts.sln
    with Visual Studio (same problem with 2015 and 2013) with TS 1.5 plugin
  2. change (i.e. adding a space) https://github.com/cmichaelgraham/aurelia-typescript/blob/typescript-1-5-port/skel-nav-esri-vs-ts/skel-nav-esri-vs-ts/views/flickr.js
  3. save

Any ideas what do I have to configure to make it work on save just as it is working on manual build/rebuild?

I haven't found a way through VS settings dialogs to tell VS2015 compiler to use "--emitDecoratorMetadata", but this flag is added to the Debug and Release configurations:
https://github.com/cmichaelgraham/aurelia-typescript/blob/typescript-1-5-port/skel-nav-esri-vs-ts/skel-nav-esri-vs-ts/skel-nav-esri-vs-ts.csproj#L129
as described above.

@rsnider19
Copy link

I am seeing the same problem as @atsu85 where the metadata won't get created with a simple save. Any updates on that?

@atsu85
Copy link

atsu85 commented Nov 16, 2015

Hint: Atom editor works really well, much better than i expected ;)

@billti
Copy link
Member

billti commented Nov 16, 2015

Reopening this for investigation. @paulvanbrenk , can you verify if the compiler options in question are being honored when using compile-on-save? Thanks.

@billti billti reopened this Nov 16, 2015
@paulvanbrenk
Copy link
Contributor

This happens because, in the project @atsu85 refers to, the compiler flags for the metadata are specified as part of the <TypeScriptAdditionalFlags> element in the project file. If you replace that element with the following:

    <TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators>
    <TypeScriptEmitDecoratorMetadata>true</TypeScriptEmitDecoratorMetadata>

Compile on save will work as expected.

@rsnider19 The same should apply to your project, if it doesn't can you share your project file?

@rsnider19
Copy link

Thanks @paulvanbrenk that works perfectly. Now I don't have to rebuild every time I make a change which means that I can just leave the project debugging and open in my browser.

@mhegazy
Copy link
Contributor Author

mhegazy commented Nov 19, 2015

for future searches, MSBuild properties mapping to compiler flags are documented in https://github.com/Microsoft/TypeScript/wiki/Setting-Compiler-Options-in-MSBuild-projects

@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

7 participants