Skip to content

Conversation

@ahrjarrett
Copy link
Owner

@ahrjarrett ahrjarrett commented Nov 16, 2024

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[]

`inline` is basically a type-level identity function. like its runtime counterpart,
it ends up being useful in more places than you might expect.
@changeset-bot
Copy link

changeset-bot bot commented Nov 16, 2024

🦋 Changeset detected

Latest commit: 55769da

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

@ahrjarrett ahrjarrett merged commit 7666a6d into main Nov 16, 2024
1 check passed
@github-actions github-actions bot mentioned this pull request Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants