Recently started with TypeScript with Visual Studio for the AngularJs and landed into a deep problem. The problem was that i was on a blank solution/project with no changes, and still there was a build error. The transition was assumed to be ok, but it didn’t turned out. So here are the steps I did:
- Create a new MVC project in Visual Studio 2015. Added references for Angular using the PM Console.
Command: install-package angularjsPM> install-package angularjs Attempting to gather dependencies information for package 'angularjs.1.5.0' with respect to project 'AngularTestTypeScript', targeting '.NETFramework,Version=v4.5.2' Attempting to resolve dependencies for package 'angularjs.1.5.0' with DependencyBehavior 'Lowest' Resolving actions to install package 'angularjs.1.5.0' Resolved actions to install package 'angularjs.1.5.0' Adding package 'angularjs.1.5.0' to folder 'c:\users\vineetyadav\documents\visual studio 2015\Projects\AngularTestTypeScript\packages' Added package 'angularjs.1.5.0' to folder 'c:\users\vineetyadav\documents\visual studio 2015\Projects\AngularTestTypeScript\packages' Added package 'angularjs.1.5.0' to 'packages.config' Successfully installed 'angularjs 1.5.0' to AngularTestTypeScript
- At this point solution should compile well.
- Install the DefinitrlyTyped typings for TypeScript for angularjs from PM Console.
Command: install-package angularjs.typescript.definitelytypedPM> install-package angularjs.typescript.definitelytyped Attempting to gather dependencies information for package 'angularjs.typescript.definitelytyped.5.4.0' with respect to project 'AngularTestTypeScript', targeting '.NETFramework,Version=v4.5.2' Attempting to resolve dependencies for package 'angularjs.typescript.definitelytyped.5.4.0' with DependencyBehavior 'Lowest' Resolving actions to install package 'angularjs.typescript.definitelytyped.5.4.0' Resolved actions to install package 'angularjs.typescript.definitelytyped.5.4.0' Adding package 'jquery.TypeScript.DefinitelyTyped.0.0.1' to folder 'c:\users\vineetyadav\documents\visual studio 2015\Projects\AngularTestTypeScript\packages' Added package 'jquery.TypeScript.DefinitelyTyped.0.0.1' to folder 'c:\users\vineetyadav\documents\visual studio 2015\Projects\AngularTestTypeScript\packages' Added package 'jquery.TypeScript.DefinitelyTyped.0.0.1' to 'packages.config' Successfully installed 'jquery.TypeScript.DefinitelyTyped 0.0.1' to AngularTestTypeScript Adding package 'angularjs.TypeScript.DefinitelyTyped.5.4.0' to folder 'c:\users\vineetyadav\documents\visual studio 2015\Projects\AngularTestTypeScript\packages' Added package 'angularjs.TypeScript.DefinitelyTyped.5.4.0' to folder 'c:\users\vineetyadav\documents\visual studio 2015\Projects\AngularTestTypeScript\packages' Added package 'angularjs.TypeScript.DefinitelyTyped.5.4.0' to 'packages.config' Successfully installed 'angularjs.TypeScript.DefinitelyTyped 5.4.0' to AngularTestTypeScript
- Once installed, the solution should still compile ok, because as of now there is no TS file in the solution that should be compiled.
- Add a .ts file to the project and add a simple function. This would initiate the TSC to come in picture and compile ts bindings.
function doSum(a, b) { return a + b; }
- Now building the solution gives a whole lot of compiler errors and compiler fails. The main errors are TS2304, TS2411, TS2320, . I get around 482 of such errors. The error loig from visual studio is attached below:Continue reading