Gathering detailed insights and metrics for tsutils
Gathering detailed insights and metrics for tsutils
Gathering detailed insights and metrics for tsutils
Gathering detailed insights and metrics for tsutils
utility functions for working with typescript's AST
npm install tsutils
Typescript
Module System
Min. Node Version
Node Version
NPM Version
98.2
Supply Chain
88.9
Quality
76.1
Maintenance
100
Vulnerability
99.6
License
TypeScript (99.62%)
JavaScript (0.38%)
Total Downloads
5,179,633,524
Last Day
1,197,690
Last Week
20,846,983
Last Month
92,001,873
Last Year
1,044,823,977
MIT License
325 Stars
432 Commits
28 Forks
3 Watchers
138 Branches
6 Contributors
Updated on Jun 08, 2025
Minified
Minified + Gzipped
Latest Version
3.21.0
Package Id
tsutils@3.21.0
Size
69.75 kB
NPM Version
6.14.8
Node Version
14.15.1
Published on
Mar 07, 2021
Cumulative downloads
Total Downloads
Last Day
-17.4%
1,197,690
Compared to previous day
Last Week
-11.2%
20,846,983
Compared to previous week
Last Month
4.6%
92,001,873
Compared to previous month
Last Year
-9.2%
1,044,823,977
Compared to previous year
This package consists of two major parts: utilities and typeguard functions. By importing the project you will get both of them.
1import * as utils from "tsutils";
2utils.isIdentifier(node); // typeguard
3utils.getLineRanges(sourceFile); // utilities
If you don't need everything offered by this package, you can select what should be imported. The parts that are not imported are never read from disk and may save some startup time and reduce memory consumtion.
If you only need typeguards you can explicitly import them:
1import { isIdentifier } from "tsutils/typeguard"; 2// You can even distiguish between typeguards for nodes and types 3import { isUnionTypeNode } from "tsutils/typeguard/node"; 4import { isUnionType } from "tsutils/typeguard/type";
If you only need the utilities you can also explicitly import them:
1import { forEachComment, forEachToken } from "tsutils/util";
This package is backwards compatible with typescript 2.8.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.
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:
1// all typeguards compatible with typescript@2.8 2import { isIdentifier } from "tsutils/typeguard/2.8"; 3// you can even use nested submodules 4import { isIdentifier } from "tsutils/typeguard/2.8/node"; 5 6// all typeguards compatible with typescript@2.9 (includes those of 2.8) 7import { isIdentifier } from "tsutils/typeguard/2.9"; 8 9// always points to the latest stable version (2.9 as of writing this) 10import { isIdentifier } from "tsutils/typeguard"; 11import { isIdentifier } from "tsutils"; 12 13// always points to the typeguards for the next TypeScript version (3.0 as of writing this) 14import { isIdentifier } from "tsutils/typeguard/next";
Note that if you are also using utility functions, you should prefer the relevant submodule:
1// importing directly from 'tsutils' would pull in the latest typeguards 2import { forEachToken } from 'tsutils/util'; 3import { isIdentifier } from 'tsutils/typeguard/2.8';
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
50 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More