typings 中文文档教程

发布于 6年前 浏览 22 项目主页 更新于 3年前

Typings

< img src="https://img.shields.io/npm/v/typings.svg?style=flat" alt="NPM 版本"> NPM 下载构建状态Gitter

TypeScript 定义管理器。

快速入门

# Install Typings CLI utility.
npm install typings --global

# Search for definitions.
typings search tape

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

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

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

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

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

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

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

使用

Typings 是管理和安装 TypeScript 定义的简单方法。 它使用typings.json,它可以解析为Typings注册表、GitHub、NPM、Bower、HTTP 和本地文件。 包可以使用来自各种来源和不同版本的类型定义,因为它们知道它们永远不会与用户发生冲突。

typings install debug --save

公共注册表由社区维护,用于解析 JavaScript 包的官方类型定义。

了解更多

来源

  • npm - 来自 NPM
  • github - 直接来自 GitHub 的依赖项 (例如 DuoJSPM)
  • bitbucket - 直接来自 Bitbucket
  • jspm 的依赖项: - 来自已安装的 JSPM 包。 需要 jspm@0.17+
  • bower - 来自 Bower 的依赖
  • common - 没有已知“源”的“标准”库
  • shared - 共享库功能
  • lib - 共享环境功能(shared 的镜像) (--global)
  • env - 环境(例如 atom电子) (--global)
  • global - 全局(window.) 库 (--global)
  • dt - 来自 DefinitelyTyped(通常为 --global

贡献

# Installation
# Fork this repo (https://github.com/typings/typings)
# Clone the fork (E.g. `https://github.com/<your_username>/typings.git`)
cd typings

# Install modules
npm install

# Build
npm run build

# Test
npm run test

更改日志

许可

MIT

Typings

NPM versionNPM downloadsBuild statusGitter

The TypeScript Definition Manager.

Quick Start

# Install Typings CLI utility.
npm install typings --global

# Search for definitions.
typings search tape

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

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

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

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

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

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

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

Usage

Typings is 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 never conflict for users.

typings install debug --save

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

Read More

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

# Installation
# Fork this repo (https://github.com/typings/typings)
# Clone the fork (E.g. `https://github.com/<your_username>/typings.git`)
cd typings

# Install modules
npm install

# Build
npm run build

# Test
npm run test

Change Log

License

MIT

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文