VoiceGem

How to dictate a typed TypeScript function signature

A TypeScript signature adds one phrase to the JavaScript version: “colon” before every type. VoiceGem turns “function camel case parse token open paren raw colon string close paren colon pascal case token open brace” into function parseToken(raw: string): Token { with every annotation placed correctly.

A sixteen-word annotated signature costs about 18 seconds typed against about 5.9 seconds spoken. (sources: Dhakal, Feit, Kristensson & Oulasvirta, “Observations on Typing from 136 Million Keystrokes”, CHI 2018, 168,000 participants, 136 million keystrokes; Yuan, Liberman & Cieri, “Towards an Integrated Understanding of Speaking Rate in Conversation”, Interspeech 2006, 2,438 American English telephone conversations (Switchboard corpus). The speech figure is conversational rate, not a measured dictation rate — no such measurement exists.)

What lands in your editor
function parseToken(raw: string): Token {

This tool runs entirely in your browser. Nothing you type is sent anywhere, stored, or logged.

Step by step

  1. 1

    Say the name with a casing command

    Speak “camel case” and the words. The run ends at the open paren, so the parameter list starts cleanly.

  2. 2

    Annotate each parameter with “colon”

    Say the parameter name, “colon”, then the type. The colon attaches left, producing raw: string with the annotation spaced the way TypeScript formats it.

  3. 3

    Annotate the return type after the closing bracket

    Say “close paren colon” then the type. The same colon phrase serves both positions, because VoiceGem converts characters rather than grammatical roles.

  4. 4

    Expect to fix generics by hand

    Close the spaces around angle brackets after dictating. A generic parameter list comes back as < T > and no formatter setting in VoiceGem changes that.

TypeScript annotations dictate cleanly and TypeScript generics do not

The split is sharp and worth knowing before you start. Parameter and return annotations use the colon, which attaches left and produces exactly the spacing TypeScript formatters use — so an annotated signature needs no cleanup at all.

Generics use angle brackets, which attach on neither side because the same characters are comparison operators. A generic function signature dictated through VoiceGem comes back with spaces inside every type parameter list, and closing them is a formatter pass rather than a phrasing choice.

Where doing it by hand breaks down

Typing a one-parameter annotated signature is fast, and TypeScript's tooling autocompletes most type names as you go. Nothing here beats a good editor for a short function.

Long signatures with several annotated parameters are the case that pays. Six colons, five commas, two brackets and four identifiers is a line that spans the keyboard, and dictating it in VoiceGem places every annotation in one pass. Autocomplete still helps afterwards; dictation and autocomplete are not in competition.

Doing this somewhere else? a longer run through the speech-to-code converter, dictating Bash functions, the same thing for dictating Go functions, or what changes for dictating Java methods.

Common questions

No. VoiceGem's colon attaches left, which produces raw: string with exactly the spacing TypeScript formatters use.

Angle brackets attach on neither side because the same characters are comparison operators. Run your formatter after dictating a generic.

Say the name, “question mark colon”, then the type. Both marks attach left, so they land flush against the identifier.

Dictate a four-parameter annotated signature and check every colon.

Open the tool