天道酬勤,学无止境

definitelytyped

如何在 ASP.NET 5 中添加 TypeScript 绝对类型定义?(How do I add a TypeScript definitely typed definition in ASP.NET 5?)

问题 我正在尝试在 Visual Studio 2015 RC 的 ASP.NET v5 Web 项目中安装来自绝对类型的 TypeScript 定义文件? NuGet 包似乎不再工作了,TSD 也有一段时间没有更新了,我在 VS 中使用它时没有看到很多好的文档。 VS 2015 RC 仍然使用哪些方法? 回答1 TSD 已弃用。 通常首选的替代方法是 Typings。 从文档: # 安装 Typings CLI 实用程序。 npm 安装类型 --global # 搜索定义。 打字搜索磁带 # 找到一个可用的定义(按名称)。 打字搜索 --name 反应 # 如果你使用包作为模块: # 安装非环境类型(默认来自“npm”注册表,通过.typingsrc defaultSource配置) 打字安装调试--save # 如果你通过脚本标签使用包,或者 # 它是环境的一部分,或者 # 非环境类型尚不可用: 打字安装 dt~mocha --global --save # 从特定注册表安装类型打字安装 env~atom --global --save 打字安装 npm~bluebird --save # 使用typings/index.d.ts (在tsconfig.json或作为///参考)。 猫打字/index.d.ts 回答2 我一直在使用 NPM 的 TSD。 它在我的 MVC 6

2021-09-20 15:21:35    分类:技术分享    typescript   asp.net-core   visual-studio-2015   definitelytyped   tsd

尝试在 TypeScript 中导入 i18next 时无法加载外部模块(Cannot load external module when trying to import i18next in TypeScript)

问题 我无法导入 i18next 的原因之一是 i18next.d.ts 文件没有 declare module "i18next" { export = i18next; } 最后,就像jquery.d.ts 和knockout.d.ts 一样。 它只有 declare var i18next: I18nextStatic; 所以当我尝试使用我的 TypeScript 文件导入时 import i18next = require('i18next'); 它会barf:无法加载外部模块模块不能被别名为非模块类型 我不知道为什么绝对类型的项目以这种方式组成 d.ts 文件。 而且我不知道声明模块是否是一个很好的解决方案。 有人请帮忙。 回答1 您可能需要填充 i18next 库,以便 RequireJS 将其定义为模块。 RequireJS 站点上有更多信息:http://requirejs.org/docs/api.html#config-shim shim : { 'i18next' : { exports : 'i18next' } }

2021-09-01 09:33:00    分类:技术分享    knockout.js   requirejs   typescript   i18next   definitelytyped

Cannot find name 'Promise' despite using es6-promise.d.ts

I added the systemjs.d.ts file to my project in WebStorm IDE. This file includes two uses of the class Promise, which are marked as errors by TSC. This is extremely weird because I've already added the es6-promise.d.ts file to my project, and it does solve the same problem for the mongodb.d.ts file. So why in one file it's recognized and in the other it's not? All the .d.ts files are located in the same foler (root-folder\DefinitelyTyped). The errors I get: TS2304: Cannot find name 'Promise' systemjs.d.ts: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/systemjs

2021-08-11 09:03:58    分类:问答    typescript   webstorm   systemjs   es6-promise   definitelytyped

DefinitelyTyped Lodash

I want to import single function from lodash while preserving typings. Such as this: import invokeMap from 'lodash/invokeMap'; But it seems that I cannot do so. Compiler says that there is no module lodash/invokeMap. It's correct — DefinitelyTyped declares only top-level module for lodash, so I can import only the whole package. But I want to import only one function. Is there a way to import only typings information about lodash without importing lodash itself? Below is my workaround plan. I want to use standard CommonJS require function to import the necessary function without types

2021-07-31 16:00:45    分类:问答    typescript   lodash   definitelytyped

How to include definitely typed files in an Angular2 angular-cli based project

What is the best practice for this scenario: I have created an Angular2 project using angular-cli (i.e. using ng new) I want to include TypeScript types from definitely typed For example, should I use typings to install the types? How do I make sure the types are included in the ng build? If you answer is that I should hack the webpack settings somehow, please include how I would do that, since I only have the angular-cli.json file

2021-07-13 01:12:46    分类:问答    angular   typescript   angular-cli   definitelytyped

Why is TSD deprecated?

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?

2021-07-11 01:20:34    分类:问答    typescript   definitelytyped   tsd

TypeScript definition file for SPServices

I am wondering if anyone knows if there is a TypeScript definition file for the SPServices JS library? I have found a .d.ts file in the GitHub repo but it does not appear to be complete. I have also search (with no luck except this definition request) through what is available on Definitely Typed. If none exists, does anyone know of a good reference for information about how to create definitions from the JS code?

2021-06-29 00:34:47    分类:问答    javascript   sharepoint   typescript   spservices   definitelytyped

How do I use types defined by @types/redux-form in React component with Field and FieldArray?

I'm developing app with React, Redux, Redux-Form and TypeScript. I am struggling to use types defined by package @types/redux-form (DefinitelyTyped), especially with FieldArray. There is an attribute "component" where I pass reference to component, but I have no clue what type should I use when describing its props. I downloaded example of using FieldArray from Redux-Form repository and slightly modified it to work with TypeScript. I want to compile it with compilerOption "noImplicitAny": true. So here is the FieldArraysForm.tsx (similar to official example): import * as React from 'react'

2021-06-27 08:06:13    分类:问答    reactjs   typescript   redux   redux-form   definitelytyped

Cannot load external module when trying to import i18next in TypeScript

One reason why I can't import i18next is because the i18next.d.ts file does not have declare module "i18next" { export = i18next; } at the end, like jquery.d.ts and knockout.d.ts have. It only has declare var i18next: I18nextStatic; So when I tried to import in my TypeScript file using import i18next = require('i18next'); it will barf: Cannot load external module Module cannot be aliased to a non-module type I don't know why Definitely Typed project compose the d.ts file in that way. And I don't know if declare module will be a good solution or not. Someone please help.

2021-06-26 22:00:34    分类:问答    knockout.js   requirejs   typescript   i18next   definitelytyped

How can I install @types compatible with an older version of TypeScript?

My project uses package like @types/express and @types/body-parser. Recently these .d.ts files were updated to use generic defaults, but that means these declaration files now require TypeScript 2.3 or above. However, my project still uses an older version of TypeScript - TypeScript 2.2. How do I use npm to make sure my project can still understand these definition files without upgrading?

2021-06-26 08:48:05    分类:问答    typescript   npm   types   definitelytyped   declaration-files