Patch Changes
-
#171
47039da
Thanks @ahrjarrett! - feat: addsinline
type utilitynew features
- new inline utility
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[]