tsd

Angular 2 - import of external leaflet typescript library

馋奶兔 提交于 2020-01-31 18:06:46
问题 Im trying to import the a typescript leaflet library into my angular 2 application. This is my map component. Ive installed leaflet.d.ts with tsd install and my application does not complain about /// <reference path="../../typings/leaflet/leaflet.d.ts"/> but when i try to use a L.map which is a exported module in leaflet.d.ts i get the error "ReferenceError: L is not defined". This is the first time i try to import a external typescript library in angular 2 and clearly im doing something

TypeScript bindings for google web signin

人盡茶涼 提交于 2020-01-03 17:51:32
问题 I'm building an angular2/typescript app. I see that google put out platform.js which gives access to the gapi var as shown here on the google signin for websites. That works great, but I am having a lot of trouble getting that into typescript. TS relies on .d.ts files to import javascript. Are there any typescript bindings for the new gapi that google put out? There is this version of gapi from DefinitelyTyped/gapi, but it is outdated. I've considered writing my own typings definition for the

how do i install a listed typings?

♀尐吖头ヾ 提交于 2020-01-02 02:56:08
问题 I'm using a library with Typescript, and getting a compiler error. public/components/chatlogs.ts(25,19): error TS2304: Cannot find name 'Handsontable'. it seems there is a typings for it: $ typings search handsontable Viewing 2 of 2 NAME SOURCE HOMEPAGE DESCRIPTION UPDATED handsontable dt https://handsontable.com/ 2016-04-12T15:30:16.000Z jquery-handsontable dt http://handsontable.com 2016-03-29T17:54:46.000Z but then i cant install that? $ typings install handsontable typings ERR! message

TypeScript definitions for various libraries and different versions - Typings, DefinitelyTyped

冷暖自知 提交于 2019-12-24 06:47:56
问题 Both DefinitelyTyped and typings allow us to use existing JS libraries along with their TypeScript bindings (definitions, .d.ts) provided by the community. My question is - does any of these platform provide a possibility to use a binding for a certain version of a certain library ? For example, I can see in DefinitelyTyped/jQuery, that it supports only this: // Type definitions for jQuery 1.10.x / 2.0.x and this is the only file. And jQuery seems to be pretty popular library. So I expect

“Duplicate identifier” errors with Angular2 and TSD

和自甴很熟 提交于 2019-12-23 12:32:23
问题 I'm trying to convert a project from Angular 1 to Angular 2. This is a client & server project with some common code (so I keep it together). I want to use Angular 2 on the client side so I followed the ng2 QuickStart. I am currently trying to build it inside my project. I am using TSD to manage my dependencies typings. Some of these dependencies like socket.io rely on node.d.ts . My problem is that angular2 already expose node.d.ts and create an ambient definition so when I want to use TSD

Why is TSD deprecated?

强颜欢笑 提交于 2019-12-23 06:58:27
问题 Official tsd annouced that tsd is deprecated and recommend using typings instead. Why is TSD deprecated? What is the difference between tsd and typings. What is the advantage of typings? 回答1: From the first link you provided: TSD link is flawed and not really a solid long-term solution - as it relies on ambient modules, causes duplicate identifiers and generally forces users to re-install sub-dependencies From the second link: why And so on: Typings, the Registy and Versions 来源: https:/

TypeScript: How can I make an existing namespace global?

强颜欢笑 提交于 2019-12-22 08:06:03
问题 I'm trying to stop using TSD for obtaining type definitions in a project that uses many libaries via global variables (the outFile option is used in tsconfig.json if this matters). In particular, it uses the Moment library in this way. Moment provides its own type definitions as part of the NPM package. However, these definitions don't declare anything in the global scope. Note that moment is both a global variable of type moment.MomentStatic and a type namespace at that. Using the NPM

TypeScript: How can I make an existing namespace global?

那年仲夏 提交于 2019-12-22 08:05:19
问题 I'm trying to stop using TSD for obtaining type definitions in a project that uses many libaries via global variables (the outFile option is used in tsconfig.json if this matters). In particular, it uses the Moment library in this way. Moment provides its own type definitions as part of the NPM package. However, these definitions don't declare anything in the global scope. Note that moment is both a global variable of type moment.MomentStatic and a type namespace at that. Using the NPM

Unable to import toastr module with Angular 2

时光怂恿深爱的人放手 提交于 2019-12-19 09:48:05
问题 I am creating an Angular 2 application with version 2.0.0-alpha.46 and I trying to import the toastr module. I have downloaded the library and also downloaded the definitely typed file as well. In my html page, I add a <script> tag for the .js file: <script src="./src/libs/toastr/toastr.min.js"></script> In Visual Studio Code, I try to import the module like so: import * as toastr from 'toastr'; I am then able to call toastr.info('message') in my component - I even get intellisense; However,

How should I use @types with TypeScript 2

荒凉一梦 提交于 2019-12-17 07:10:34
问题 So far we are used to tsd or (The better version of it) typings But now that TypeScript 2 offers the new @types feature, how should I convert my current project to work with @types? I have tsd.json (typings.json is some cases) with all the dependencies, what are the steps to do the move to TypeScript 2? What are the new best practices? Does @types support specific versions? 回答1: It's very simple. Just install the definitions that you need via npm. For example if you need lodash you can do: