TS 中文文档 TS 中文文档
指南
GitHub (opens new window)
指南
GitHub (opens new window)
  • 入门教程

    • TypeScript 手册
    • 基础知识
    • 日常类型
    • 类型缩小
    • 更多关于函数
    • 对象类型
    • 从类型创建类型
    • 泛型
    • Keyof 类型运算符
    • Typeof 类型运算符
    • 索引访问类型
    • 条件类型
    • 映射类型
    • 模板字面类型
    • 类
    • 模块
  • 参考手册

  • 项目配置


The TypeScript Definition Manager.


Deprecation Notice: Regarding TypeScript@2.0


For users doing typings install dt~<package> --global and receiving errors.

Starting from TypeScript 2.0, users can install typings using npm install @types/<package>. These typings are coming from DefinitelyTyped. In the future, we hope redirects will be enabled to support existing maintainers to contribute effectively to NPM's @types as they did to typings/registry.

Typings on DefinitelyTyped have also moved to the external module format supported by TypeScript. This finally solved the real problem that Typings was trying to solve! It also means it will cause errors such as:

  1. ``` shell
  2. > typings install dt~angular --global

  3. typings ERR! message Attempted to compile "angular" as a global module,
  4. but it looks like an external module. You'll need to remove the global option to continue.
  5. ```

To resolve this, we recommend moving to TypeScript 2.0's official aquisition method (npm install @types/angular ). You can also drop the --global flag from typings, though some definitions on DefinitelyTyped may not work with the Typings approach because of new TypeScript features (namely UMD namespaces).

This project will remain operational for the foreseeable future, but is effectively deprecated. New projects should use @types from NPM.

Quick Start


  1. ``` shell
  2. # Install Typings CLI utility.
  3. npm install typings --global

  4. # Search for definitions.
  5. typings search tape

  6. # Find a definition by name.
  7. typings search --name react

  8. # If you use the package as a module:
  9. # Install non-global typings (defaults to "npm" source, configurable through `defaultSource` in `.typingsrc`).
  10. typings install debug --save

  11. # If you use the package through `<script>`, it is part of the environment, or
  12. # the module typings are not yet available, try searching and installing with `--global`:
  13. typings install dt~mocha --global --save

  14. # If you need a specific commit from github.
  15. typings install d3=github:DefinitelyTyped/DefinitelyTyped/d3/d3.d.ts#1c05872e7811235f43780b8b596bfd26fe8e7760 --global --save

  16. # Search and install by version.
  17. typings info env~node --versions
  18. typings install env~node@0.10 --global --save

  19. # Install typings from a particular source (use `<source>~<name>` or `--source <source>`).
  20. typings install env~atom --global --save
  21. typings install bluebird --source npm --save

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

Usage


Typingsis the simple way to manage and install TypeScript definitions. It uses typings.json, which can resolve to the Typings Registry, GitHub, NPM, Bower, HTTP and local files. Packages can use type definitions from various sources and different versions, knowing they will neverconflict for users.

  1. ``` shell
  2. typings install debug --save
  3. ```

The public registry is maintained by the community, and is used to resolve official type definitions for JavaScript packages.

Read More


Commands
Coming from TSD?
Example typings
Why external modules?
About the registry
FAQ
Known Issues

Sources


npm - dependencies from NPM
github - dependencies directly from GitHub (E.g. Duo, JSPM )
bitbucket - dependencies directly from Bitbucket
jspm : - dependencies from installed JSPM packages with typings distributed. Requires jspm@0.17+.
bower - dependencies from Bower
common - "standard" libraries without a known "source"
shared - shared library functionality
lib - shared environment functionality (mirror of shared ) (--global )
env - environments (E.g. atom, electron ) (--global )
global - global (window.<var> ) libraries (--global )
dt - typings from DefinitelyTyped (usually --global )

Contributing


  1. ``` shell
  2. # Installation
  3. # Fork this repo (https://github.com/typings/typings)
  4. # Clone the fork (E.g. `https://github.com//typings.git`)
  5. cd typings

  6. # Install modules
  7. npm install

  8. # Build
  9. npm run build

  10. # Test
  11. npm run test
  12. ```

Change Log


License


MIT
Last Updated: 2023-09-03 17:10:52