简体   繁体   English

如何在ASP.NET 5中添加TypeScript明确类型的定义?

[英]How do I add a TypeScript definitely typed definition in ASP.NET 5?

I'm trying to install TypeScript definition files from DefinitelyTyped within a ASP.NET v5 web project in Visual Studio 2015 RC? 我正在尝试在Visual Studio 2015 RC中的ASP.NET v5 Web项目中安装DefinitelyTyped的TypeScript定义文件? NuGet packages don't seem to work anymore and TSD hasn't been updated in awhile and I haven't seen a lot of good documentation for it when using it within VS. NuGet包似乎不再起作用了,TSD还没有更新一段时间,在VS中使用它时我还没有看到很多很好的文档。

What ways are still working for the VS 2015 RC? VS 2015 RC还有哪些方法?

I have been using TSD from NPM. 我一直在使用NPM的TSD。 It is working fine with my MVC 6 project and should definitely be the most up to date source of definitions. 它适用于我的MVC 6项目,绝对应该是最新的定义来源。

This should be all you need to get going: 这应该是你需要的所有东西:

npm install tsd --save-dev
tsd install jquery --save

TSD is deprecated . TSD已弃用 The generally preferred alternative is Typings . 通常优选的替代品是Typings

From docs: 来自docs:

# Install Typings CLI utility. #安装Typings CLI实用程序。
npm install typings --global npm install typings --global

# Search for definitions. #搜索定义。
typings search tape 打字搜索磁带

# Find an available definition (by name). #查找可用的定义(按名称)。
typings search --name react 打字搜索 - 名字反应

# If you use the package as a module: #如果您将包用作模块:
# Install non-ambient typings (default from "npm" registry, configurable through defaultSource in .typingsrc ) #安装非环境类型(默认来自“npm”注册表,可通过.typingsrc defaultSource配置)
typings install debug --save typings安装debug --save

# If you use the package through script tag, or #如果您通过脚本标记使用包,或
# it is part of the environment, or #它是环境的一部分,或者
# the non-ambient typings is not yet available: #非环境类型尚未提供:
typings install dt~mocha --global --save typings安装dt~mocha --global --save

# Install typings from particular registry #从特定注册表安装打字
typings install env~atom --global --save typings安装env~ atom --global --save
typings install npm~bluebird --save typings安装npm~bluebird --save

# Use typings/index.d.ts (in tsconfig.json or as a /// reference). #使用typings/index.d.ts (在tsconfig.json或作为///引用)。
cat typings/index.d.ts 猫打字/ index.d.ts

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

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