From 4f1b80df5295c8211c69ad8a2aec8b7118d7fe80 Mon Sep 17 00:00:00 2001 From: Daniel Lebrecht Date: Fri, 25 Aug 2017 18:07:18 +0200 Subject: [PATCH] typescript instructions on README closes: https://github.com/bitcoinjs/bitcoinjs-lib/issues/815 --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index cbdee8a..0f093bc 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,25 @@ uglifyjs ... --mangle --reserved 'Array,BigInteger,Boolean,ECPair,Function,Numbe **NOTE**: If you expect this library to run on an iOS 10 device, ensure that you are using [buffer@5.0.5](https://github.com/feross/buffer/pull/155) or greater. + +### Typescript or VSCode users +Type declarations for Typescript are available for version 3.0 of the library. To install, run: + +``` bash +npm install @types/bitcoinjs-lib +``` + +You should now be able to use bitcoinjs-lib as if it was a typescript library. + +e.g., +``` javascript +import { HDNode, Transaction } from 'bitcoinjs-lib' +``` + +VSCode (and possibly other editors) users writing plain javascript are also advised to install the type declarations, as the intelisense uses that information to help you code (autocompletion, static analysis). + +Report bugs on the type declaration file at [@dlebrecht DefinitelyTyped fork](https://github.com/dlebrecht/DefinitelyTyped) or do a PR straight at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) + ### Flow Definitions for [Flow typechecker](https://flowtype.org/) are available in flow-typed repository.