Skip to content

Instantly share code, notes, and snippets.

View unitario's full-sized avatar

Stefan Åstrand unitario

View GitHub Profile
@unitario
unitario / is.ts
Created September 9, 2025 17:04
A tiny curried TypeScript type guard
/**
* Maps a reference type to its runtime value type.
*/
type ValueTypeOf<T> = T extends
| StringConstructor
| NumberConstructor
| BooleanConstructor
| SymbolConstructor
| BigIntConstructor
? ReturnType<T>
<?xml version="1.0" encoding="UTF-8"?>
<ONIXMessage
xmlns="http://ns.editeur.org/onix/3.0/reference"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:onix="http://ns.editeur.org/onix/3.0/reference" release="3.0">
<Header>
<Sender>
<SenderIdentifier>
<SenderIDType>23</SenderIDType>
<IDValue>SE556921913101</IDValue>