TypeScript: How to define custom typings for installed npm package?

Beware, this is old question (2016) regarding managing definitions using typings which is deprecated in favor of installing them straight via npm


You can add custom definitions to typings.json. For example having following folder structure:

/typings
    /custom
        rx-node.d.ts
    /global
        ...

where rx-node.d.ts is your custom typings file. For example:

declare module RxNode {
    export interface ...
}

Then install with a command

typings install file:typings/custom/rx-node.d.ts --save --global

Or manually: in typings.json add reference to this typings file:

{
    "name": "TestName",
    "version": false,
    "globalDependencies": {
        "rx-node": "file:typings/custom/rx-node.d.ts"
    }
}

And run typings install

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)