diff options
Diffstat (limited to 'node_modules/tsutils/README.md')
-rw-r--r-- | node_modules/tsutils/README.md | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/node_modules/tsutils/README.md b/node_modules/tsutils/README.md index 785e98609..9dfef9530 100644 --- a/node_modules/tsutils/README.md +++ b/node_modules/tsutils/README.md @@ -1,5 +1,7 @@ # Utility functions for working with typescript's AST +[](https://greenkeeper.io/) + ## Usage This package consists of two major parts: utilities and typeguard functions. @@ -29,4 +31,31 @@ import { forEachComment, forEachToken } from "tsutils/util"; This package is backwards compatible with typescript 2.1.0 at runtime although compiling might need a newer version of typescript installed. -Using `typescript@next` might work, but it's not officially supported. If you encounter any bugs, please open an issue.
\ No newline at end of file +Using `typescript@next` might work, but it's not officially supported. If you encounter any bugs, please open an issue. + +For compatibility with older versions of TypeScript typeguard functions are separated by TypeScript version. If you are stuck on `typescript@2.8`, you should import directly from the submodule for that version: + +```js +// all typeguards compatible with typescript@2.8 +import { isIdentifier } from "tsutils/typeguard/2.8"; +// you can even use nested submodules +import { isIdentifier } from "tsutils/typeguard/2.8/node"; + +// all typeguards compatible with typescript@2.9 (includes those of 2.8) +import { isIdentifier } from "tsutils/typeguard/2.9"; + +// always points to the latest stable version (2.9 as of writing this) +import { isIdentifier } from "tsutils/typeguard"; +import { isIdentifier } from "tsutils"; + +// always points to the typeguards for the next TypeScript version (3.0 as of writing this) +import { isIdentifier } from "tsutils/typeguard/next"; +``` + +Note that if you are also using utility functions, you should prefer the relevant submodule: + +```js +// importing directly from 'tsutils' would pull in the latest typeguards +import { forEachToken } from 'tsutils/util'; +import { isIdentifier } from 'tsutils/typeguard/2.8'; +``` |