-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Typings for npm packages
TypeScript 1.6 has introduced new way of resolving module names that mimics Node module resolution algorithm. As a consequence of that TypeScript compiler currently can load typings that are bundled with npm package. Compiler will try to discover typings for module m
using the following set of rules:
- try to load file
package.json
located in package folder (node_modules/m/
) and read the path to typings file as a value of"typings"
field. - try to load file
index.d.ts
located in package folder (node_modules/m/
) - this file should contain typings for the package.
Precise algorithm of module resolution can be found here
- be a
.d.ts
file - be an external module
- not have triple-slash references
Rationale: typings should not bring new compilable items to the set of compiled files otherwise actual implementation files in package can be overwritten during compilation. Also loading typings should not pollute global scope by bringing potentially conflicting entries from different version of the same library
News
Debugging TypeScript
- Performance
- Performance-Tracing
- Debugging-Language-Service-in-VS-Code
- Getting-logs-from-TS-Server-in-VS-Code
- JavaScript-Language-Service-in-Visual-Studio
- Providing-Visual-Studio-Repro-Steps
Contributing to TypeScript
- Contributing to TypeScript
- TypeScript Design Goals
- Coding Guidelines
- Useful Links for TypeScript Issue Management
- Writing Good Design Proposals
- Compiler Repo Notes
- Deployment
Building Tools for TypeScript
- Architectural Overview
- Using the Compiler API
- Using the Language Service API
- Standalone Server (tsserver)
- TypeScript MSBuild In Depth
- Debugging Language Service in VS Code
- Writing a Language Service Plugin
- Docker Quickstart
FAQs
The Main Repo