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

typescript decorators giving error in vs2015 #6476

Closed
pranaydutta89 opened this issue Jan 14, 2016 · 11 comments
Closed

typescript decorators giving error in vs2015 #6476

pranaydutta89 opened this issue Jan 14, 2016 · 11 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Visual Studio Integration with Visual Studio

Comments

@pranaydutta89
Copy link

I am using typescript as my nodejs(ntvs) project and using decorators but its giving compile time error as ' Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.'

now since there is no tsconfig.json so i could not add the above paramtere which the compiler is asking ,and after searching for the issue on net , i changed the node.js project file and added the same parameter, then also still the issue persist, please help me with the issue.
untitled

@mhegazy
Copy link
Contributor

mhegazy commented Jan 14, 2016

You will need to manually add TypeScriptExperimentalDecorators to your project file, by unload project, edit the project file, you should see something like:

  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TypeScriptRemoveComments>false</TypeScriptRemoveComments>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
  </PropertyGroup>

add the new property tot he PropertyGroup:

<TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators>

for more infromation abotu MSBuild properties, please check: https://github.com/Microsoft/TypeScript/wiki/Setting-Compiler-Options-in-MSBuild-projects

@mhegazy mhegazy closed this as completed Jan 14, 2016
@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Jan 14, 2016
@pranaydutta89
Copy link
Author

i had already done that and this is not helping me out still the compiler is unhappy

@mhegazy
Copy link
Contributor

mhegazy commented Jan 15, 2016

Can you share the project file?

@pranaydutta89
Copy link
Author

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
    <Name>edt_arch</Name>
    <RootNamespace>edt_arch</RootNamespace>
  </PropertyGroup>
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>3f62780c-8ace-47a8-82c7-53d1385e0ace</ProjectGuid>
    <ProjectHome>.</ProjectHome>
    <StartupFile>app.ts</StartupFile>
    <StartWebBrowser>False</StartWebBrowser>
    <SearchPath>
    </SearchPath>
    <WorkingDirectory>.</WorkingDirectory>
    <OutputPath>.</OutputPath>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
    <ProjectView>ProjectFiles</ProjectView>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
    <TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
    <EnableTypeScript>true</EnableTypeScript>
    <StartWebBrowser>false</StartWebBrowser>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>
  <ItemGroup>
    <Content Include="sqlScripts.sql" />
    <Content Include="views\index.html" />
    <Content Include="views\templates\master.html" />
    <Content Include="views\templates\private\master.html" />
    <Content Include="views\templates\private\privateHome.html" />
    <Content Include="views\templates\private\refreshMicroService.html" />
    <Content Include="views\templates\private\registerMicroService.html" />
    <TypeScriptCompile Include="app.ts" />
    <Content Include="package.json" />
    <Content Include="README.md" />
    <TypeScriptCompile Include="config.ts" />
    <TypeScriptCompile Include="constants.ts" />
    <TypeScriptCompile Include="controllers\microServicesRoutesController.ts" />
    <TypeScriptCompile Include="controllers\portalControllers.ts" />
    <TypeScriptCompile Include="controllers\registerControllers.ts" />
    <TypeScriptCompile Include="Scripts\typings\express\express.d.ts" />
    <TypeScriptCompile Include="Scripts\typings\interfaces\domain.d.ts" />
    <TypeScriptCompile Include="Scripts\typings\node\node.d.ts" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="controllers\" />
    <Folder Include="Scripts\typings\interfaces\" />
    <Folder Include="views\" />
    <Folder Include="Scripts\" />
    <Folder Include="Scripts\typings\" />
    <Folder Include="Scripts\typings\express\" />
    <Folder Include="Scripts\typings\node\" />
    <Folder Include="views\contents\scripts\" />
    <Folder Include="views\contents\" />
    <Folder Include="views\templates\" />
    <Folder Include="views\src\" />
    <Folder Include="views\templates\private\" />
    <Folder Include="views\templates\public\" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="views\contents\scripts\angular-ui-router.min.js" />
    <Compile Include="views\contents\scripts\angular.min.js" />
    <Compile Include="views\src\controllers.js" />
    <Compile Include="views\src\init.js" />
    <Compile Include="views\src\services.js" />
  </ItemGroup>
  <!-- Do not delete the following Import Project.  While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them. -->
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
    <TypeScriptToolsVersion>1.7</TypeScriptToolsVersion>
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
    <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
    <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
    <TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
    <TypeScriptRemoveComments>False</TypeScriptRemoveComments>
    <TypeScriptOutFile />
    <TypeScriptOutDir />
    <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
    <TypeScriptNoEmitOnError>False</TypeScriptNoEmitOnError>
    <TypeScriptMapRoot />
    <TypeScriptSourceRoot />
    <TypeScriptEmitDecoratorMetadata>True</TypeScriptEmitDecoratorMetadata>
   <TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators>
  </PropertyGroup>
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
  <Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
        <WebProjectProperties>
          <UseIIS>False</UseIIS>
          <AutoAssignPort>True</AutoAssignPort>
          <DevelopmentServerPort>0</DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          <IISUrl>http://localhost:48022/</IISUrl>
          <NTLMAuthentication>False</NTLMAuthentication>
          <UseCustomServer>True</UseCustomServer>
          <CustomServerUrl>http://localhost:1337</CustomServerUrl>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
        </WebProjectProperties>
      </FlavorProperties>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}" User="">
        <WebProjectProperties>
          <StartPageUrl>
          </StartPageUrl>
          <StartAction>CurrentPage</StartAction>
          <AspNetDebugging>True</AspNetDebugging>
          <SilverlightDebugging>False</SilverlightDebugging>
          <NativeDebugging>False</NativeDebugging>
          <SQLDebugging>False</SQLDebugging>
          <ExternalProgram>
          </ExternalProgram>
          <StartExternalURL>
          </StartExternalURL>
          <StartCmdLineArguments>
          </StartCmdLineArguments>
          <StartWorkingDirectory>
          </StartWorkingDirectory>
          <EnableENC>False</EnableENC>
          <AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

@pranaydutta89
Copy link
Author

@mhegazy please provide me with a solution .

@mhegazy
Copy link
Contributor

mhegazy commented Jan 19, 2016

sorry for that. looks like a bug.

@mhegazy mhegazy reopened this Jan 19, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Jan 19, 2016

@pranaydutta89, to work around the issue for now, please edit your project file and replace:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">

with

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">

@mhegazy mhegazy added Bug A bug in TypeScript and removed Question An issue which isn't directly actionable in code labels Jan 19, 2016
@mhegazy mhegazy added this to the TypeScript 1.8 milestone Jan 19, 2016
@mhegazy mhegazy added the Visual Studio Integration with Visual Studio label Jan 19, 2016
@pranaydutta89
Copy link
Author

@mhegazy ur snippet did the trick thanks for help

@paulvanbrenk
Copy link
Contributor

Checked in a fix, so we write the TypeScript properties in a more logical location.

@paulvanbrenk paulvanbrenk added the Fixed A PR has been merged for this issue label Feb 11, 2016
@Dzivo
Copy link

Dzivo commented May 10, 2016

This is still a problem none of the solution works i still get errors that i didnt set experimental decorators to true

@mhegazy
Copy link
Contributor

mhegazy commented May 10, 2016

@Dzivo this is a fairly old issue. do you mind filing a new issue and provide information about what version of TS/VS are you using, also a sample project would be helpful.

@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
Bug A bug in TypeScript Fixed A PR has been merged for this issue Visual Studio Integration with Visual Studio
Projects
None yet
Development

No branches or pull requests

4 participants