
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
Typeforge contains useful utility types for typescript!
StringStartsWith<"Hello", "H"> // true
StringEndsWith<"Hello", "baz"> // false
StringRemoveFirstChar<"Hello"> // ello
StringRemoveLastChar<"World"> // Worl
StringSplit<
"Hello_World_Foo_Bar", // The string to split.
"_", // The seperator to split at.
2 // The maximum amount of splits to make.
> // ["Hello", "World", "Foo_Bar"]
StringSplitAll<
"Hello_World_Foo_Bar", // The string to split.
"_", // The seperator to split at.
> // ["Hello", "World", "Foo", "Bar"]
StringSplitOnce<
"Hello_World_Foo_Bar", // The string to split.
"_", // The seperator to split at.
> // ["Hello", "_World_Foo_Bar"]
StringReplace<
"Hello World World", // The string to replace from.
"World", // The target characters to replace.
"There", // The replacement characters.
1 // The maximum amount of times to replace.
> // "Hello There World"
// Slightly more performant than `StringReplace` if you are replacing all occurrences.
StringReplaceAll<
"Hello World World", // The string to replace from.
"World", // The target characters to replace.
"There" // The replacement characters.
> // "Hello There There"
StringLooseAutocomplete<"FooBar">
StringCondenseDuplicates<
"Hello____World__Foo_________Bar", // The string to condense duplicates for.
"_" // The target characters to condense.
> // "Hello_World_Foo_Bar"
StringIsLiteral<"Hello"> // true
StringContains<"Hello", "lo"> // true
UnionPrettify<"Hello" | "World" | "Foo" | "Baz"> // "Hello" | "World" | "Foo" | "Baz"
IsUnion<"Hello" | "World" | "Foo" | "Baz"> // true
UnionToArray<"Hello" | "World" | "Foo" | "Baz"> // ["Hello", "World", "Foo", "Baz"]
ArrayPrettify<[ "Hello", "World" ]> // ["Hello", "World"]
ArrayToUnion<["Hello", "World", "Foo", "Baz"]> // "Hello" | "World" | "Foo" | "Baz"
ArrayConcat<
[ "One", "Two", "Three", "Four" ] // The array to concatenate.
", " // The characters to concatenate with.
> // "One, Two, Three, Four"
ArrayRemoveTypes<
[ true, "carrot", 55, "tomato", "onion", 66 ], // The array to remove from.
string | number // The type of elements to be removed.
> // [true]
// Only keeps elements of specified types in an array.
ArrayKeepTypes<
[ true, "carrot", 55, "tomato", "onion", 66 ], // The array to remove from.
string | number // The type of elements to be kept.
> // ["carrot", 55, "tomato", "onion", 66]
ArrayRemoveLastItem<[ "one", "two", "three" ]> // ["one", "two"]
ArrayLastItem<[ "one", "two", "three" ]> // "three"
// Used to ensure that an array type is not empty (e.g. [] extends ArrayNonEmpty<string>)/
ArrayNonEmpty<string> // [string, ...string[]]
ObjectPrettifyDeep<
{ hello: "world" } & { foo: "bar" }
& { baz: { hello: "world" } & { foo: "bar" } }
> /* {
hello: "world";
foo: "bar";
baz: {
hello: "world";
foo: "bar";
};
} */
ObjectPrettify<
{ hello: "world" } & { foo: "bar" }
& { baz: { hello: "world" } & { foo: "bar" } }
> /* {
hello: "world";
foo: "bar";
baz: {
hello: "world";
} & {
foo: "bar";
};
} */
ObjectDifferentKeys<
{ hello: "world", bar: "foo" },
{ hello: "world", baz: "foo" }
> // { bar: "foo"; baz: "foo"; }
ObjectSameKeys<
{ hello: "world", bar: "foo" },
{ hello: "world", baz: "foo" }
> // { hello: "world"; }
ObjectDeepMerge<
{ Bob: { Age: 41 }, Dave: { Age: 32, EyeColor: "Green" } },
{ Bob: { EyeColor: "Blue" }, Dave: { EyeColor: "Brown" } }
> // { Bob: { Age: 41, EyeColor: "Blue" }, Dave: { Age: 32, EyeColor: "Brown" } }
ObjectRemoveKeys<
{ hello: "world", foo: "bar", baz: "foo" },
"hello" | "baz"
> // { foo: "bar" }
// Only keep specified keys inside of an object.
ObjectKeepKeys<
{ hello: "world", foo: "bar", baz: "foo" },
"hello" | "baz"
> // { hello: "world"; baz: "foo"; }
ObjectOverwrite<
{ foo: { bar: "baz", hello: "world" } },
{ foo: { bar: "fooBar" } }
> // { foo: { bar: "fooBar"; hello: "world"; }; }
ObjectShallowOverwrite<
{ foo: { bar: "baz", hello: "world" } },
{ foo: { bar: "fooBar" } }
> // { foo: { bar: "fooBar"; }; }
// Utility types to ensure a string is an ISO string.
ISOYear
ISOMonth
ISODay
ISOHours
ISOMinutes
ISOSeconds
ISOMilliseconds
ISOTimeZoneOffset
ISODate
ISOTime
ISODateTime
// Automatically prettifies Objects, Unions and Arrays.
Prettify<{ hello: "world" }>
Prettify<"Hello" | "World">
Prettify<[ "Hello", "World" ]>
PrettifyDeep<{ hello: "world" }>
PrettifyDeep<"Hello" | "World">
PrettifyDeep<[ "Hello", "World" ]>
FAQs
Useful utility types for typescript
We found that typeforge demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.