Resolving ‘Error TS1219’ in Angular Build: Handling Experimental Decorators in Visual Studio 2022

A few weeks back, I encountered a build issue accompanied by the following error:

Severity	Code	Description	Project	File	Line	Suppression State
Error	TS1219	Build:Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. My Project	D:\myAngularProject\myservice.service.ts	6

As you can see it happened due to the @Injectable() decorator:


Error TS1219 Handling Experimental Decorators in Visual Studio 2022

It took half a day to resolve the issue 🤪. And you need just to configure your csproj file by adding the next section:

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
  <TypeScriptModuleKind>commonjs</TypeScriptModuleKind>
 <TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators>
</PropertyGroup>

Hope it was helpful to you.

My Artifacts are:

  • Visual Studio 2022
  • Angular Project based on Console Application(template)
  • Angular version 13.1.1
  • tsconfig.json, the experimentalDecorators set true

Leave a Comment