简体   繁体   English

Angular 2官方教程-打字文件夹

[英]Angular 2 official tutorial- typings folder

The readme file in https://github.com/angular/quickstart/blob/master/README.md suggests that: https://github.com/angular/quickstart/blob/master/README.md中的自述文件建议:

If the typings folder doesn't show up after npm install please install them manually with: npm run typings -- install 如果在npm安装后没有显示Typings文件夹,请使用以下命令手动安装它们:npm运行打字-安装

Running this command also helped me with a different repo I cloned. 运行此命令还有助于我克隆一个不同的存储库。 Can someone explain what this means? 有人可以解释这是什么意思吗? I read about typings lib, but don't understand why it requires a separate step? 我读过有关类型化lib的文章,但不明白为什么它需要一个单独的步骤?

typing is a library to install TypeScript definition of external libraries that are not coded using TypeScript. type是用于安装未使用TypeScript编码的外部库的TypeScript定义的库。 Using typing, you can install TypeScript definition of JavaScript libraries and get the autocomplete\\validation of classes in TypeScript. 使用类型,您可以安装JavaScript库的TypeScript定义,并在TypeScript中获得类的自动完成\\验证。

typings install do the download and installation of all the Typescript definition required and stored into the typings.json. 键入安装执行所需的所有Typescript定义的下载和安装,并存储到types.json中。

On the contrary, npm install usually installs only the npm dependencies. 相反,npm install通常仅安装npm依赖项。 Usually they are two separated stages. 通常它们是两个分离的阶段。

EDIT: To address your question, at the end: in the post install of the package.json there is this configuration: "postinstall": "typings install". 编辑:为解决您的问题,最后:在package.json的后期安装中,有以下配置:“ postinstall”:“ typings install”。 Maybe, for some reason, it does not always work. 也许由于某种原因,它并不总是有效。 So if does not create the typings folder after npm install they say to run the command manually. 因此,如果在npm安装后未创建类型文件夹,则会说手动运行命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM