unfunction()

    Unfunction lets you see through layers of abstraction by showing function calls as if they were written inline. Simply click an underlined function or type. Works with TypeScript.

    Notation

    TypeScript NotationOur Notation
    { name: string,
    age: number,
    [otherField: string]: boolean }
    namestring
    agenumber
    otherFieldboolean
    string[]indexstring
    function doubleNum(x) {
    return x * 2
    }
    let y = doubleNum(5)
    function doubleNum(x) {
    return x * 2
    }
    let y = doubleNum(5)

    Examples

    Basic

    Click to expand the function calls.

    function threeTimesNum(x: number) {
    return x * 3
    }
    function sixTimesNum(x: number) {
    return threeTimesNum(x) * 2
    }
    let y = sixTimesNum(5)
    Substitution

    Inputs are paramaterized when needed.

    function twoTimesNum(x: number) {
    return x * 2
    }
    function squareNum(x: number) {
    return x * x
    }
    let z = squareNum(twoTimesNum(5))
    Limitations

    There are some limitations when capturing types. I started working on an interpreter, but you really need ownership tracking to do this correctly ( struggles to deal with async/await).

    It's still very useful for getting a sense of the shape of your code; you simply can't do this very well in VS Code. See Example 2 for a real world example.

    type User =
    namestring
    agenumber
    function doThingsToUser(user: User, ...fns:
    index(User)undefined
    ) {
    for (const f of fns) {f(user)}
    }
    function setUserName(user: User) {
    user.name = 'Bob'
    }
    let user = { name: 'Max', age: 99 }
    doThingsToUser(user, setUserName)
    TypeScript to make expandable below:
    function threeTimesNum(x: number) {
    return x * 3
    }
    function sixTimesNum(x: number) {
    return threeTimesNum(x) * 2
    }
    let y = sixTimesNum(5)

    All Types

    No types loaded