• Prompt user for text input with automatic cleanup.

    Behavior: Create readline interface, display prompt, await input, trim whitespace, cleanup interface. Blocks until user responds.

    Error Handling: Throws TypeError for non-string prompts. Readline errors propagated to caller.

    Parameters

    • question: string

      Prompt text displayed to user

    Returns Promise<string>

    Trimmed user input

    Question parameter must be string

    const name = await ask('Name: ');
    const email = await ask('Email: ');
    if (!email.includes('@')) throw new Error('Invalid email');