Skip to content

v0.48.1

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 16 Nov 03:03
ee440e6

Patch Changes

  • #171 47039da Thanks @ahrjarrett! - feat: adds inline type utility

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