简体   繁体   English

打字稿不再识别自定义类和接口

[英]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.出于某种原因,我的 angularJS 控制器不再识别我的自定义类型,我已授予所有文件完全写入权限。

I dont have a tsconfig.json file, I am using visual studio 2019 which supports TS out of the box.我没有 tsconfig.json 文件,我使用的是 Visual Studio 2019,它支持开箱即用的 TS。 These are the project settings..这些是项目设置..

在此处输入图片说明

This is my project structure in .net core这是我在 .net core 中的项目结构

在此处输入图片说明

This is the class which looks fine.. which is in the Classes folder.这是看起来不错的类......它在 Classes 文件夹中。

在此处输入图片说明

But the controller complains it cant see the type..但是控制器抱怨它看不到类型..

在此处输入图片说明

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.以前这工作正常,所以我想知道签入和签出 TFS 是否会导致问题,但现在所有文件都具有完全写入权限。 :( :(

This is the specific error..这是具体的错误..

在此处输入图片说明

The issue was caused by adding the ts files with the add new file extension https://marketplace.visualstudio.com/items?itemName=MadsKristensen.AddNewFile该问题是由添加具有添加新文件扩展名的 ts 文件引起的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.当你用 shift+F2 添加一个 ts 文件时,你不会得到相应的 *.js 和 *.d.ts 文件,它们是自动生成的。

The content type on the file was not Typescript, it was set to resource.该文件的内容类型不是 Typescript,而是设置为资源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM