ahrjarrett / any-ts

Sensible, performant primitives for writing semantic TypeScript code
https://npmjs.com/package/any-ts
8 stars 0 forks source link

@ahrjarrett/v0.48.1 #171

Closed ahrjarrett closed 4 hours ago

ahrjarrett commented 4 hours ago

Closes:

changelog

new features

inline is basically a type-level identity function.

like its runtime counterpart, it can be pretty useful.

the name inline refers to the particular use case that I usually use it for, which is for wrapping a type literal so that an interface can extend it.

import type { inline } from "any-ts"

//////////////
/// example

/** 
 * did you know you can make an interface out of an array?
 * this can be useful when you want to preserve the
 * identifier:             vvvv   */
interface Numbers extends inline<number[]> {}

declare const numbers: Numbers
//            ^? const numbers: Numbers

// normal array behavior is preserved:
const copy = [...ex_01.numbers]
//    ^? const copy: number[]
changeset-bot[bot] commented 4 hours ago

🦋 Changeset detected

Latest commit: 55769da9f2309e062da31aaaa225657ebbbb525d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------ | ----- | | any-ts | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR