Socket
Book a DemoInstallSign in
Socket

claritype

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

claritype

Typescript named type aliases to clarify the meaning of the variable

1.0.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

It's not always clear what does number or string type mean.

Let's imagine you are describing setTimeout

declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;

In't not clear what number to pass in timeout. Let's refactor it

type Milliseconds = number;
declare function setTimeout(handler: TimerHandler, timeout?: Milliseconds, ...arguments: any[]): number;

Now it's much more clear, and user will see hints when typing this function in IDE.

So this library is just a set of such aliases. For now it contains

export type Milliseconds = number;
export type Seconds = number;
export type Minutes = number;
export type Hours = number;
export type Days = number;
export type Months = number;
export type Years = number;
export type Centuries = number;

So use it to clarify your inputs!

Keywords

typeset

FAQs

Package last updated on 17 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.