Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 19, 2024 via pnpm

tsutils 3.21.0

utilities for working with typescript's AST
Package summary
Share
0
issues
3
licenses
1
0BSD
1
MIT
1
Apache-2.0
Package created
17 Feb 2017
Version published
7 Mar 2021
Maintainers
1
Total deps
3
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

BSD Zero Clause License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
include-copyright
include-license
include-original
Cannot
hold-liable
Must
1 Packages, Including:
tslib@1.14.1

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
tsutils@3.21.0

Apache License 2.0

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
use-patent-claims
place-warranty
Cannot
hold-liable
use-trademark
Must
include-copyright
include-license
state-changes
include-notice
1 Packages, Including:
typescript@5.4.5
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of tsutils 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
tslib1.14.17.43 kB0BSD
prod
typescript5.4.530.87 MBApache-2.0
prod peer

Visualizations

Frequently Asked Questions

What does tsutils do?

Tsutils is a utility JavaScript library designed for working with TypeScript's Abstract Syntax Tree (AST). It significantly simplifies the process of interacting and handling TypeScript's AST by offering easy-to-use utility functions and typeguard operations.

How do you use tsutils?

Using tsutils is quite straightforward as it efficiently organizes its functionalities into two major parts: utilities and typeguard functions. Once tsutils has been imported into your JavaScript project, you have access to both functionalities. Here's an example:

import * as utils from "tsutils";
utils.isIdentifier(node); // typeguard
utils.getLineRanges(sourceFile); // utilities

If your project doesn't require the entire tsutils package, you can select and import only the specific parts you need. This approach can save some startup time and reduce memory consumption. For example, to import only typeguards, you would do the following:

import { isIdentifier } from "tsutils/typeguard";
import { isUnionTypeNode } from "tsutils/typeguard/node";
import { isUnionType } from "tsutils/typeguard/type";

And to specifically import utilities:

import { forEachComment, forEachToken } from "tsutils/util";

Tsutils maintains backwards compatibility with TypeScript 2.8.0 at runtime, and it has separate typeguard functions for compatibility with different TypeScript versions. For instance, if you're using typescript@2.8.0, you would import directly from the dedicated submodule like so:

import { isIdentifier } from "tsutils/typeguard/2.8";

Where are the tsutils docs?

The tsutils package does not come with bundled documentation. However, in-depth understanding can be achieved by combing through the provided readme file on the GitHub repository as well as analysis of the codebase itself. The GitHub repository for the package can be found at https://github.com/ajafff/tsutils.