Skip to content

Commit

Permalink
chore: release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Torathion committed Jan 11, 2025
1 parent b052f3c commit 3e104fc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## [1.1.0] 2025-1-11

### Added

- Added `PromiseCallback` to have a general type for a callback function of a Promise

### Changed

- Changed the `Rejector` reason to `Error` as this is the most recommended type.
- Renamed `OnFulFilled` to `OnFulfilled`

### Removed

- Removed type `undefined` from `Resolver` to actually mimic a Promise resolver function
- Removed `RejectedValue` as it didn't serve any purpose
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# typestar

[![NPM license](https://img.shields.io/npm/l/typestar.svg)](https://www.npmjs.com/package/typestar)
[![NPM version](https://img.shields.io/npm/v/typestar.svg)](https://www.npmjs.com/package/typestar)
[![NPM downloads](https://img.shields.io/npm/dm/typestar.svg)](http://www.npmtrends.com/typestar)

Become the star of TypeScript with TypeStar! TypeStar is a vast collection of helpful and essential extra TypeScript types to leverage your TypeScript coding experience.

---
Expand Down
20 changes: 12 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,17 +403,17 @@ declare module 'typestar' {
*
* @template T - The type of the value being resolved.
*/
export type Resolver<T> = (value?: T | PromiseLike<T>) => void
export type Resolver<T> = (value: T | PromiseLike<T>) => void
/**
* A function that rejects a promise with a given reason.
*/
export type Rejector = (reason?: any) => void
export type Rejector = (reason?: Error) => void
/**
* Extracts the type of the rejected value from a promise.
* General type of an ECMAScript Promise.
*
* @template T - The promise type.
* @template T - The resolved value
*/
export type RejectedValue<T> = T extends PromiseLike<any> ? any : never
export type PromiseCallback<T> = (resolve: Resolver<T>, reject: Rejector) => void
/**
* Extracts the resolved value type of a promise, including chained promises.
*
Expand All @@ -426,13 +426,13 @@ declare module 'typestar' {
* @template TValue - The type of the resolved value.
* @template TResult - The type of the return value or the next promise in the chain.
*/
export type OnFulFilled<TValue, TResult = TValue> = ((value: TValue) => TResult | PromiseLike<TResult>) | null | undefined
export type OnFulfilled<TValue, TResult = TValue> = ((value: TValue) => TResult | PromiseLike<TResult>) | null | undefined
/**
* Represents a handler function for a rejected promise, returning a value or another promise.
*
* @template T - The type of the return value or the next promise in the chain.
*/
export type OnRejected<T = never> = ((reason: any) => T | PromiseLike<T>) | null | undefined
export type OnRejected<T = never> = ((reason: Error) => T | PromiseLike<T>) | null | undefined
/*
* CLASS
*/
Expand Down Expand Up @@ -723,6 +723,10 @@ declare module 'typestar' {
* Represents any valid JSON value.
*/
export type JsonValue = JsonPrimitive | JsonObject | JsonArray
/**
* Type describing the source type of a JavaScript project.
*/
export type SourceType = 'commonjs' | 'module' | 'script'
/**
* Specifies subdirectories within the package.
* Useful for organizational purposes or for tooling.
Expand Down Expand Up @@ -807,7 +811,7 @@ declare module 'typestar' {
/** The entry point for TypeScript type declarations. */
types?: string
/** Specifies whether the package uses ES modules or CommonJS. */
type: 'module' | 'commonjs'
type: SourceType
/**
* Indicates whether the package has side effects during tree-shaking.
*
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typestar",
"version": "1.0.0",
"version": "1.1.0",
"description": "Become the star of typescript with these essential types to boost your typescript coding!",
"types": "index.d.ts",
"keywords": [
Expand Down

0 comments on commit 3e104fc

Please sign in to comment.