Search code examples
javascriptangularjstypescriptasp.net-coreecmascript-5

Typescript no longer recognising custom classes and interfaces


For some reason my angularJS controller no longer recognises my custom types, I have given all the files full write permissions.

I dont have a tsconfig.json file, I am using visual studio 2019 which supports TS out of the box. These are the project settings..

enter image description here

This is my project structure in .net core

enter image description here

This is the class which looks fine.. which is in the Classes folder.

enter image description here

But the controller complains it cant see the type..

enter image description here

This worked fine before, so I wonder if checking in and out of TFS caused an issue, but all files have full write access now. :(

This is the specific error..

enter image description here


Solution

  • The issue was caused by adding the ts files with the add new file extension https://marketplace.visualstudio.com/items?itemName=MadsKristensen.AddNewFile

    When you add a ts file with shift+F2 you dont get the corresponding *.js and *.d.ts files which are auto generated.

    The content type on the file was not Typescript, it was set to resource.