How to create configuration files (tsconfig.json, typings.json, package.json)?

I can copy these files from https://angular.io/guide/quickstart .

But I would like to know more about these files.

How can we create it manually?

How can I find out more about these files?

+5
source share
2 answers

package.json

contains information about the packages and libraries that are used by your project, it may also include npm scripts , which helps to run application tasks such as running tests, creating js, etc ...

npm init to run the new package.json file

docs: npm docs

tsconfig.json

provides information on compiling the typescript process in javascript . In which version should ts be compiled, should js files include source maps and such information usually described in this file.

tsc --init to run the new tsconfig.json file

docs: tsconfig docs

typings.json

contains links to files of type definition for an external library, this helps your application to be more intellisense. If you are writing types for your application, you need to know about the types of other libraries that you use.

typings init to run the new typings.json file (must be installed globally or locally)

Additional Information:

standard package (helps to generate the typings.json file and save its dependencies)

types defenitions (Database of type definitions for libraries)

full tsconfig schema

Hope this helps you!

+9
source

In TypeScript 2.0 , typings.json is not required.

Getting and using declaration files in version 2.0 is much easier. To get declarations for a library like lodash you only need npm:

 npm install --save @types/lodash 

You can set typing as:

 npm i -S @types/core-js @types/jasmine @types/node 

In package.json is added:

 "@types/core-js": "^0.9.43", "@types/jasmine": "^2.8.2", "@types/node": "^8.5.2", 
+1
source

Source: https://habr.com/ru/post/1247679/


All Articles