You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes there is a need to know what a value's type of something is, this package exists to satisfy those needs by
implementing a parser that can retrieve the type of the value recursively and process a string similar to TypeScript's
types.
Features
Written in TypeScript
Bundled with Rollup so it can be used in NodeJS and browsers
Note: While this section uses require, the imports match 1:1 with ESM imports. For example
const { Type } = require('@sapphire/type') equals import { Type } from '@sapphire/type'.
Note: When using ESM syntax you can also default-import Type class: import Type from '@sapphire/type'.
Note: The internal functions of getPromiseDetails and getProxyDetails are also exported. If you don't know what
these are, then you need not be concerned about this.
Basic Usage
// Import the Type classconst{ Type }=require('@sapphire/type');// Define a Type with an array of two numbersconsttype=newType([1,2]);console.log(type.toString());// Logs: Array<number>
Buy us some doughnuts
Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are
amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!
We accept donations through Open Collective, Ko-fi, PayPal, Patreon and GitHub Sponsorships. You can use the buttons
below to donate through your method of choice.