Skip to main content

Type alias: ProviderResult<T>

ProviderResult<T>: T | undefined | Promise< T | undefined >

A provider result represents the values a provider, like the ImageCheckerProvider, may return. For once this is the actual result type T, like ImageChecks, or a Promise that resolves to that type T. In addition, null and undefined can be returned - either directly or from a Promise.

The snippets below are all valid implementations of the ImageCheckerProvider:

let a: ImageCheckerProvider = {
check(image: ImageInfo, token?: CancellationToken): ProviderResult<ImageChecks> {
return new ImageChecks();
}

let b: ImageCheckerProvider = {
async check(image: ImageInfo, token?: CancellationToken): ProviderResult<ImageChecks> {
return new ImageChecks();
}
}

let c: ImageCheckerProvider = {
check(image: ImageInfo, token?: CancellationToken): ProviderResult<ImageChecks> {
return; // undefined
}
}

Type parameters

T

Source

packages/extension-api/src/extension-api.d.ts:176