How do I add a TypeScript definitely typed definition in ASP.NET 5?
Asked Answered
B

2

11

I'm trying to install TypeScript definition files from DefinitelyTyped within a ASP.NET v5 web project in Visual Studio 2015 RC? 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.

What ways are still working for the VS 2015 RC?

Butterfly answered 1/5, 2015 at 20:14 Comment(0)
A
4

TSD is deprecated. The generally preferred alternative is Typings.

From docs:

# Install Typings CLI utility.
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)
typings install 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

# Install typings from particular registry
typings install env~atom --global --save
typings install npm~bluebird --save

# Use typings/index.d.ts (in tsconfig.json or as a /// reference).
cat typings/index.d.ts

Agreement answered 26/4, 2016 at 16:39 Comment(3)
Since tsc 2 typings are deprecated too if i'm right, just pull in the "@type/modulname" package with npmInfantry
@Infantry Is it? Who says so?Agreement
Here: blogs.msdn.microsoft.com/typescript/2016/06/15/…Infantry
S
6

I have been using TSD from NPM. It is working fine with my MVC 6 project and should definitely be the most up to date source of definitions.

This should be all you need to get going:

npm install tsd --save-dev
tsd install jquery --save
Samsun answered 3/5, 2015 at 16:48 Comment(1)
Thanks. It look me awhile to figure out how to get npm properly installed as you can't just use it. Also git has to be locally installed as well with command-line mode. I was hoping of finding a way to do it code-first instead of command-line first, but the commit codes for tsd.json don't seem that easy to use compared to using tsd install.Butterfly
A
4

TSD is deprecated. The generally preferred alternative is Typings.

From docs:

# Install Typings CLI utility.
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)
typings install 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

# Install typings from particular registry
typings install env~atom --global --save
typings install npm~bluebird --save

# Use typings/index.d.ts (in tsconfig.json or as a /// reference).
cat typings/index.d.ts

Agreement answered 26/4, 2016 at 16:39 Comment(3)
Since tsc 2 typings are deprecated too if i'm right, just pull in the "@type/modulname" package with npmInfantry
@Infantry Is it? Who says so?Agreement
Here: blogs.msdn.microsoft.com/typescript/2016/06/15/…Infantry

© 2022 - 2024 — McMap. All rights reserved.