UNPKG

type-to-string

Version:

Get a string representation of a TypeScript type.

46 lines (31 loc) 1.87 kB
<div align="center"> # Type to String Get a string representation of a TypeScript type. [![npm version](https://img.shields.io/npm/v/type-to-string.svg)](https://www.npmjs.com/package/type-to-string) [![CI](https://github.com/RebeccaStevens/type-to-string/actions/workflows/release.yml/badge.svg)](https://github.com/RebeccaStevens/type-to-string/actions/workflows/release.yml) [![Coverage Status](https://codecov.io/gh/RebeccaStevens/type-to-string/branch/main/graph/badge.svg?token=MVpR1oAbIT)](https://codecov.io/gh/RebeccaStevens/type-to-string)\ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) [![GitHub Discussions](https://img.shields.io/github/discussions/RebeccaStevens/type-to-string?style=flat-square)](https://github.com/RebeccaStevens/type-to-string/discussions) [![BSD 3 Clause license](https://img.shields.io/github/license/RebeccaStevens/type-to-string.svg?style=flat-square)](https://opensource.org/licenses/BSD-3-Clause) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](https://commitizen.github.io/cz-cli/) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release) </div> This project is really just me playing with different ways to get string representions of TypeScript types. For most users, you can probably just use TypeScript built in functions: ```ts checker.typeToString(type); ``` ```ts typeNode.getText(); ``` ## Donate [Any donations would be much appreciated](./DONATIONS.md). 😄 ## Installation ```sh # Install with npm npm install type-to-string # Install with pnpm pnpm add type-to-string # Install with yarn yarn add type-to-string ```