atomisthq / docs

End-user documentation sources and generator
https://docs.atomist.com
GNU General Public License v3.0
7 stars 28 forks source link

Invalid Code snippet "Create Command" #279

Closed timothysparg closed 5 years ago

timothysparg commented 5 years ago

On the https://docs.atomist.com/developer/commands/ page there is the following code snippet:

import { HandlerResult, NoParameters } from "@atomist/automation-client";
import { CommandListenerInvocation } from "@atomist/sdm";
export async function helloWorldListener(ci: CommandListenerInvocation<NoParameters>): Promise<HandlerResult> {
    return ci.addressChannels("Hello, world");
}

however when you execute atomist start --local you are presnted with the following error

lib/machine/machine.ts:53:5 - error TS2322: Type 'void' is not assignable to type 'HandlerResult'.

changing the method signature to return Promise<void> resolves the issue