diff --git a/notNeededPackages.json b/notNeededPackages.json index be57d76a49..8fb160053d 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -726,6 +726,12 @@ "sourceRepoURL": "https://github.com/prettymuchbryce/node-http-status", "asOfVersion": "1.2.0" }, + { + "libraryName": "i18next-browser-languagedetector", + "typingsPackageName": "i18next-browser-languagedetector", + "sourceRepoURL": "https://github.com/i18next/i18next-browser-languagedetector", + "asOfVersion": "3.0.0" + }, { "libraryName": "i18next-xhr-backend", "typingsPackageName": "i18next-xhr-backend", @@ -1116,6 +1122,12 @@ "sourceRepoURL": "http://onsen.io", "asOfVersion": "2.0.0" }, + { + "libraryName": "p-throttle", + "typingsPackageName": "p-throttle", + "sourceRepoURL": "https://github.com/sindresorhus/p-throttle", + "asOfVersion": "2.0.0" + }, { "libraryName": "param-case", "typingsPackageName": "param-case", diff --git a/package.json b/package.json index 7fc0358f27..1a5124c035 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "lint": "dtslint types" }, "devDependencies": { - "dtslint": "github:Microsoft/dtslint#production", + "dtslint": "latest", "types-publisher": "github:Microsoft/types-publisher#production" }, "dependencies": {} diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 92c090d179..fdd0f395fe 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -97,6 +97,7 @@ let _algoliaIndexSettings: IndexSettings = { minProximity: 0, placeholders: { '': [''] }, camelCaseAttributes: [''], + sortFacetValuesBy: 'count', }; let _algoliaQueryParameters: QueryParameters = { @@ -150,6 +151,7 @@ let _algoliaQueryParameters: QueryParameters = { synonyms: true, replaceSynonymsInHighlight: false, minProximity: 0, + sortFacetValuesBy: 'alpha', }; let client: Client = algoliasearch('', ''); diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 5478fedbac..8e3ba4c5ab 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -5,6 +5,7 @@ // Aurélien Hervé // Samuel Vaillant // Kai Eichinger +// Nery Ortez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -24,25 +25,25 @@ declare namespace algoliasearch { * Query on multiple index * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries */ - search( + search( queries: { indexName: string; query: string; params: QueryParameters; }[], - cb: (err: Error, res: MultiResponse) => void + cb: (err: Error, res: MultiResponse) => void ): void; /** * Query on multiple index * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries */ - search( + search( queries: { indexName: string; query: string; params: QueryParameters; }[] - ): Promise; + ): Promise>; /** * Query for facet values of a specific facet */ @@ -590,14 +591,14 @@ declare namespace algoliasearch { * Search in an index * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search */ - search(params: QueryParameters): Promise; + search(params: QueryParameters): Promise>; /** * Search in an index * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search */ - search( + search( params: QueryParameters, - cb: (err: Error, res: Response) => void + cb: (err: Error, res: Response) => void ): void; /** * Search in an index @@ -1451,6 +1452,11 @@ declare namespace algoliasearch { nbShards?: number; userData?: string | object; + + /** + * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ + */ + sortFacetValuesBy?: 'count' | 'alpha'; } namespace SearchForFacetValues { @@ -1776,14 +1782,16 @@ declare namespace algoliasearch { https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/ */ camelCaseAttributes?: string[]; + + sortFacetValuesBy?: 'count' | 'alpha'; } - interface Response { + interface Response { /** * Contains all the hits matching the query * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ - hits: any[]; + hits: T[]; /** * Current page * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response @@ -1842,8 +1850,8 @@ declare namespace algoliasearch { cursor?: string; } - interface MultiResponse { - results: Response[]; + interface MultiResponse { + results: Response[]; } } diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index ce58d6a428..11e22f5ccf 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -6,6 +6,7 @@ // Samuel Vaillant // Claas Brüggemann // Kai Eichinger +// Nery Ortez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -25,25 +26,25 @@ declare namespace algoliasearch { * Query on multiple index * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries */ - search( + search( queries: { indexName: string; query: string; params: QueryParameters; }[], - cb: (err: Error, res: MultiResponse) => void + cb: (err: Error, res: MultiResponse) => void ): void; /** * Query on multiple index * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries */ - search( + search( queries: { indexName: string; query: string; params: QueryParameters; }[] - ): Promise; + ): Promise>; /** * Query for facet values of a specific facet */ @@ -109,15 +110,15 @@ declare namespace algoliasearch { * Search in an index * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search */ - search( + search( params: QueryParameters, - cb: (err: Error, res: Response) => void + cb: (err: Error, res: Response) => void ): void; /** * Search in an index * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search */ - search(params: QueryParameters): Promise; + search(params: QueryParameters): Promise>; /** * Search in an index * https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/ @@ -531,6 +532,11 @@ declare namespace algoliasearch { nbShards?: number; userData?: string | object; + + /** + * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ + */ + sortFacetValuesBy?: 'count' | 'alpha'; } namespace SearchForFacetValues { @@ -552,12 +558,12 @@ declare namespace algoliasearch { } } - interface Response { + interface Response { /** * Contains all the hits matching the query * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ - hits: any[]; + hits: T[]; /** * Current page * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response @@ -616,8 +622,8 @@ declare namespace algoliasearch { cursor?: string; } - interface MultiResponse { - results: Response[]; + interface MultiResponse { + results: Response[]; } } diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index acc7341a84..6b012d5677 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -346,7 +346,7 @@ declare module 'angular' { interface IMenuService { close(): void; hide(response?: any, options?: any): IPromise; - open(event?: MouseEvent): void; + open(event?: MouseEvent | JQueryEventObject): void; } interface IColorPalette { diff --git a/types/argparse/argparse-tests.ts b/types/argparse/argparse-tests.ts index ed714ada95..942e2bb4f2 100644 --- a/types/argparse/argparse-tests.ts +++ b/types/argparse/argparse-tests.ts @@ -1,6 +1,12 @@ // near copy of each of the tests from https://github.com/nodeca/argparse/tree/master/examples -import { ArgumentParser, RawDescriptionHelpFormatter } from 'argparse'; +import { + ArgumentParser, + RawDescriptionHelpFormatter, + Action, + ActionConstructorOptions, + Namespace, +} from 'argparse'; let args: any; const simpleExample = new ArgumentParser({ @@ -276,3 +282,26 @@ group.addArgument(['--bar'], { help: 'bar help' }); formatterExample.printHelp(); + +class CustomAction1 extends Action { + constructor(options: ActionConstructorOptions) { + super(options); + } + call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null) { + console.log('custom action 1'); + } +} + +class CustomAction2 extends Action { + call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null) { + console.log('custom action 2'); + } +} + +const customActionExample = new ArgumentParser({ addHelp: false }); +customActionExample.addArgument('--abc', { + action: CustomAction1, +}); +customActionExample.addArgument('--def', { + action: CustomAction2, +}); diff --git a/types/argparse/index.d.ts b/types/argparse/index.d.ts index 3330055b1f..a229b6bc49 100644 --- a/types/argparse/index.d.ts +++ b/types/argparse/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Andrew Schurman // Tomasz Łaziuk // Sebastian Silbermann +// Kannan Goundan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -79,13 +80,24 @@ export interface ArgumentGroupOptions { description?: string; } +export abstract class Action { + protected dest: string; + constructor(options: ActionConstructorOptions); + abstract call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null): void; +} + +// Passed to the Action constructor. Subclasses are just expected to relay this to +// the super() constructor, so using an "opaque type" pattern is probably fine. +// Someone may want to fill this out in the future. +export type ActionConstructorOptions = number & {_: 'ActionConstructorOptions'}; + export class HelpFormatter { } export class ArgumentDefaultsHelpFormatter { } export class RawDescriptionHelpFormatter { } export class RawTextHelpFormatter { } export interface ArgumentOptions { - action?: string; + action?: string | { new(options: ActionConstructorOptions): Action }; optionStrings?: string[]; dest?: string; nargs?: string | number; diff --git a/types/argparse/tsconfig.json b/types/argparse/tsconfig.json index 49e7b03ca8..9248f1d078 100644 --- a/types/argparse/tsconfig.json +++ b/types/argparse/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "argparse-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/babel__core/babel__core-tests.ts b/types/babel__core/babel__core-tests.ts index ba51ac21be..b44e45c605 100644 --- a/types/babel__core/babel__core-tests.ts +++ b/types/babel__core/babel__core-tests.ts @@ -39,3 +39,59 @@ babel.transformFromAstAsync(parsedAst!, sourceCode, options).then(transformFromA const { code, map, ast } = transformFromAstAsyncResult!; const { body } = ast!.program; }); + +function checkOptions(_options: babel.TransformOptions) {} +function checkConfigFunction(_config: babel.ConfigFunction) {} + +checkOptions({ envName: 'banana' }); +// babel uses object destructuring default to provide the envName fallback so null is not allowed +// $ExpectError +checkOptions({ envName: null }); +checkOptions({ caller: { name: '@babel/register' } }); +checkOptions({ caller: { name: 'babel-jest', supportsStaticESM: false } }); +// don't add an index signature; users should augment the interface instead if they need to +// $ExpectError +checkOptions({ caller: { name: '', tomato: true } }); +checkOptions({ rootMode: 'upward-optional' }); +// $ExpectError +checkOptions({ rootMode: 'potato' }); + +// $ExpectError +checkConfigFunction(() => {}); +// you technically can do that though you probably shouldn't +checkConfigFunction(() => ({})); +checkConfigFunction(api => { + api.assertVersion(7); + api.assertVersion("^7.2"); + + api.cache.forever(); + api.cache.never(); + api.cache.using(() => true); + api.cache.using(() => 1); + api.cache.using(() => '1'); + api.cache.using(() => null); + api.cache.using(() => undefined); + // $ExpectError + api.cache.using(() => ({})); + api.cache.invalidate(() => 2); + + // $ExpectType string + api.env(); + + api.env('development'); + api.env(['production', 'test']); + // $ExpectType 42 + api.env(name => 42); + + // $ExpectType string + api.version; + + return { + shouldPrintComment(comment) { + // $ExpectType string + comment; + + return true; + } + }; +}); diff --git a/types/babel__core/index.d.ts b/types/babel__core/index.d.ts index 66501d24db..3875d40d71 100644 --- a/types/babel__core/index.d.ts +++ b/types/babel__core/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for @babel/core 7.0 +// Type definitions for @babel/core 7.1 // Project: https://github.com/babel/babel/tree/master/packages/babel-core, https://babeljs.io // Definitions by: Troy Gerwien // Marvin Hagemeister // Melvin Groenhoff +// Jessica Franco // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 @@ -54,6 +55,15 @@ export interface TransformOptions { */ root?: string | null; + /** + * This option, combined with the "root" value, defines how Babel chooses its project root. + * The different modes define different ways that Babel can process the "root" value to get + * the final project root. + * + * @see https://babeljs.io/docs/en/next/options#rootmode + */ + rootMode?: 'root' | 'upward' | 'upward-optional'; + /** * The config file to load Babel's config from. Defaults to searching for "babel.config.js" inside the "root" folder. `false` will disable searching for config files. * @@ -82,7 +92,7 @@ export interface TransformOptions { * * Default: env vars */ - envName?: string | null; + envName?: string; /** * Enable code generation @@ -112,6 +122,14 @@ export interface TransformOptions { */ cwd?: string | null; + /** + * Utilities may pass a caller object to identify themselves to Babel and + * pass capability-related flags for use by configs, presets and plugins. + * + * @see https://babeljs.io/docs/en/next/options#caller + */ + caller?: TransformCaller; + /** * This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { \/* specific options *\/ } } }` * which will use those options when the `envName` is `production` @@ -284,6 +302,14 @@ export interface TransformOptions { wrapPluginVisitorMethod?: ((pluginAlias: string, visitorType: "enter" | "exit", callback: (path: NodePath, state: any) => void) => (path: NodePath, state: any) => void) | null; } +export interface TransformCaller { + // the only required property + name: string; + // e.g. set to true by `babel-loader` and false by `babel-jest` + supportsStaticESM?: boolean; + // augment this with a "declare module '@babel/core' { ... }" if you need more keys +} + export type FileResultCallback = (err: Error | null, result: BabelFileResult | null) => any; /** @@ -528,4 +554,129 @@ export interface CreateConfigItemOptions { */ export function createConfigItem(value: PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined], options?: CreateConfigItemOptions): ConfigItem; +// NOTE: the documentation says the ConfigAPI also exposes @babel/core's exports, but it actually doesn't +/** + * @see https://babeljs.io/docs/en/next/config-files#config-function-api + */ +export interface ConfigAPI { + /** + * The version string for the Babel version that is loading the config file. + * + * @see https://babeljs.io/docs/en/next/config-files#apiversion + */ + version: string; + /** + * @see https://babeljs.io/docs/en/next/config-files#apicache + */ + cache: SimpleCacheConfigurator; + /** + * @see https://babeljs.io/docs/en/next/config-files#apienv + */ + env: EnvFunction; + // undocumented; currently hardcoded to return 'false' + // async(): boolean + /** + * This API is used as a way to access the `caller` data that has been passed to Babel. + * Since many instances of Babel may be running in the same process with different `caller` values, + * this API is designed to automatically configure `api.cache`, the same way `api.env()` does. + * + * The `caller` value is available as the first parameter of the callback function. + * It is best used with something like this to toggle configuration behavior + * based on a specific environment: + * + * @example + * function isBabelRegister(caller?: { name: string }) { + * return !!(caller && caller.name === "@babel/register") + * } + * api.caller(isBabelRegister) + * + * @see https://babeljs.io/docs/en/next/config-files#apicallercb + */ + caller(callerCallback: (caller: TransformOptions['caller']) => T): T; + /** + * While `api.version` can be useful in general, it's sometimes nice to just declare your version. + * This API exposes a simple way to do that with: + * + * @example + * api.assertVersion(7) // major version only + * api.assertVersion("^7.2") + * + * @see https://babeljs.io/docs/en/next/config-files#apiassertversionrange + */ + assertVersion(versionRange: number | string): boolean; + // NOTE: this is an undocumented reexport from "@babel/parser" but it's missing from its types + // tokTypes: typeof tokTypes +} + +/** + * JS configs are great because they can compute a config on the fly, + * but the downside there is that it makes caching harder. + * Babel wants to avoid re-executing the config function every time a file is compiled, + * because then it would also need to re-execute any plugin and preset functions + * referenced in that config. + * + * To avoid this, Babel expects users of config functions to tell it how to manage caching + * within a config file. + * + * @see https://babeljs.io/docs/en/next/config-files#apicache + */ +export interface SimpleCacheConfigurator { + // there is an undocumented call signature that is a shorthand for forever()/never()/using(). + // (ever: boolean): void + // (callback: CacheCallback): T + /** + * Permacache the computed config and never call the function again. + */ + forever(): void; + /** + * Do not cache this config, and re-execute the function every time. + */ + never(): void; + /** + * Any time the using callback returns a value other than the one that was expected, + * the overall config function will be called again and a new entry will be added to the cache. + * + * @example + * api.cache.using(() => process.env.NODE_ENV) + */ + using(callback: SimpleCacheCallback): T; + /** + * Any time the using callback returns a value other than the one that was expected, + * the overall config function will be called again and all entries in the cache will + * be replaced with the result. + * + * @example + * api.cache.invalidate(() => process.env.NODE_ENV) + */ + invalidate(callback: SimpleCacheCallback): T; +} + +// https://github.com/babel/babel/blob/v7.3.3/packages/babel-core/src/config/caching.js#L231 +export type SimpleCacheKey = string | boolean | number | null | undefined; +export type SimpleCacheCallback = () => T; + +/** + * Since `NODE_ENV` is a fairly common way to toggle behavior, Babel also includes an API function + * meant specifically for that. This API is used as a quick way to check the `"envName"` that Babel + * was loaded with, which takes `NODE_ENV` into account if no other overriding environment is set. + * + * @see https://babeljs.io/docs/en/next/config-files#apienv + */ +export interface EnvFunction { + /** + * @returns the current `envName` string + */ + (): string; + /** + * @returns `true` if the `envName` is `===` any of the given strings + */ + (envName: string | ReadonlyArray): boolean; + // the official documentation is misleading for this one... + // this just passes the callback to `cache.using` but with an additional argument. + // it returns its result instead of necessarily returning a boolean. + (envCallback: (envName: NonNullable) => T): T; +} + +export type ConfigFunction = (api: ConfigAPI) => TransformOptions; + export as namespace babel; diff --git a/types/baidu-app/index.d.ts b/types/baidu-app/index.d.ts index ff71f9c012..ea9454d471 100644 --- a/types/baidu-app/index.d.ts +++ b/types/baidu-app/index.d.ts @@ -4287,7 +4287,7 @@ declare namespace swan { Methods, Props > = object & - ComponentOptions Data), Methods, Props> & + ComponentOptions & ThisType>>; interface ComponentRelation { diff --git a/types/bit-twiddle/bit-twiddle-tests.ts b/types/bit-twiddle/bit-twiddle-tests.ts new file mode 100644 index 0000000000..6f2f155c3b --- /dev/null +++ b/types/bit-twiddle/bit-twiddle-tests.ts @@ -0,0 +1,23 @@ +import * as bitTwiddle from "bit-twiddle"; + +bitTwiddle.INT_BITS; +bitTwiddle.INT_MAX; +bitTwiddle.INT_MIN; + +bitTwiddle.sign(5); +bitTwiddle.abs(-5); +bitTwiddle.min(1, 6); +bitTwiddle.max(6, 1); +bitTwiddle.isPow2(3); +bitTwiddle.log2(3); +bitTwiddle.log10(3); +bitTwiddle.popCount(4); +bitTwiddle.countTrailingZeros(3.0000003); +bitTwiddle.nextPow2(31.315); +bitTwiddle.prevPow2(31.315); +bitTwiddle.parity(123); +bitTwiddle.interleave2(12, 24); +bitTwiddle.deinterleave2(24, 12); +bitTwiddle.interleave3(24, 12, 6); +bitTwiddle.deinterleave3(24, 12); +bitTwiddle.nextCombination(41.935); diff --git a/types/bit-twiddle/index.d.ts b/types/bit-twiddle/index.d.ts new file mode 100644 index 0000000000..e89e9500b0 --- /dev/null +++ b/types/bit-twiddle/index.d.ts @@ -0,0 +1,101 @@ +// Type definitions for bit-twiddle 1.0 +// Project: https://github.com/mikolalysenko/bit-twiddle +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +export const INT_BITS: number; +export const INT_MAX: number; +export const INT_MIN: number; + +/** + * Computes the sign of the integer. + */ +export function sign(value: number): number; + +/** + * Returns the absolute value of the integer. + */ +export function abs(value: number): number; + +/** + * Computes the minimum of integers x and y. + */ +export function min(x: number, y: number): number; + +/** + * Computes the maximum of integers x and y. + */ +export function max(x: number, y: number): number; + +/** + * Returns true if value is a power of 2, otherwise false. + */ +export function isPow2(value: number): boolean; + +/** + * Returns an integer approximation of the log-base 2 of value. + */ +export function log2(value: number): number; + +/** + * Returns an integer approximation of the log-base 10 of value. + */ +export function log10(value: number): number; + +/** + * Counts the number of bits set in value. + */ +export function popCount(value: number): number; + +/** + * Counts the number of trailing zeros. + */ +export function countTrailingZeros(value: number): number; + +/** + * Rounds value up to the next power of 2. + */ +export function nextPow2(value: number): number; + +/** + * Rounds value down to the previous power of 2. + */ +export function prevPow2(value: number): number; + +/** + * Computes the parity of the bits in value. + */ +export function parity(value: number): number; + +/** + * Reverses the bits of value. + */ +export function reverse(value: number): number; + +/** + * Interleaves a pair of 16 bit integers. Useful for fast quadtree style indexing. + * @see http://en.wikipedia.org/wiki/Z-order_curve + */ +export function interleave2(x: number, y: number): number; + +/** + * Deinterleaves the bits of value, returns the nth part. + * If both x and y are 16 bit. + */ +export function deinterleave2(x: number, y: number): number; + +/** + * Interleaves a triple of 10 bit integers. Useful for fast octree indexing. + */ +export function interleave3(x: number, y: number, z: number): number; + +/** + * Same deal as deinterleave2, only for triples instead of pairs. + */ +export function deinterleave3(x: number, y: number): number; + +/** + * Returns next combination ordered colexicographically. + */ +export function nextCombination(x: number): number; diff --git a/types/bit-twiddle/tsconfig.json b/types/bit-twiddle/tsconfig.json new file mode 100644 index 0000000000..f1b094fd42 --- /dev/null +++ b/types/bit-twiddle/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bit-twiddle-tests.ts" + ] +} diff --git a/types/bit-twiddle/tslint.json b/types/bit-twiddle/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/bit-twiddle/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/bull/bull-tests.tsx b/types/bull/bull-tests.tsx index 46c146272e..13ae21f5a4 100644 --- a/types/bull/bull-tests.tsx +++ b/types/bull/bull-tests.tsx @@ -143,6 +143,8 @@ pdfQueue .on('drained', () => undefined) .on('removed', (job: Queue.Job) => undefined); +pdfQueue.setMaxListeners(42); + // test different process methods const profileQueue = new Queue('profile'); diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index aab2385ea4..cd2d1a9047 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -17,6 +17,7 @@ // TypeScript Version: 2.8 import * as Redis from "ioredis"; +import { EventEmitter } from "events"; /** * This is the Queue constructor. @@ -384,7 +385,7 @@ declare namespace Bull { next: number; } - interface Queue { + interface Queue extends EventEmitter { /** * The name of the queue */ diff --git a/types/camljs/camljs-tests.ts b/types/camljs/camljs-tests.ts index 12afd10fbb..034949175c 100644 --- a/types/camljs/camljs-tests.ts +++ b/types/camljs/camljs-tests.ts @@ -1,4 +1,4 @@ - +import CamlBuilder from 'camljs' var caml = new CamlBuilder().Where() .Any( @@ -53,3 +53,37 @@ caml = CamlBuilder.Expression() .ToString(); caml = new CamlBuilder().Where().DateTimeField("Created").GreaterThan(new Date(Date.UTC(2013,0,1))).ToString(); + +// Aggregations and extended syntax of GroupBy +var query = new CamlBuilder() + .View(["Category", { count: "ID" }, { sum: "Amount" }]) + .Query() + .GroupBy("Category", true, 100) + .ToString(); + +// ContentTypeId field +var query = new CamlBuilder() + .Where() + .TextField("Title").EqualTo("Document") + .And() + .ContentTypeIdField().BeginsWith("0x101") + .ToString(); + +// joins +var query = new CamlBuilder() + .View(["Title", "Country", "Population"]) + .LeftJoin("Country", "Country").Select("y4r6", "Population") + .Query() + .Where() + .NumberField("Population").LessThan(10) + .ToString(); + +// RowLimit & Scope +var camlBuilder1 = new CamlBuilder() + .View(["ID", "Created"]) + .RowLimit(20, true) + .Scope(CamlBuilder.ViewScope.RecursiveAll) + .Query() + .Where() + .TextField("Title").BeginsWith("A") + .ToString(); diff --git a/types/camljs/index.d.ts b/types/camljs/index.d.ts index 73bbe03767..b8f4021ded 100644 --- a/types/camljs/index.d.ts +++ b/types/camljs/index.d.ts @@ -1,8 +1,8 @@ // Type definitions for camljs -// Project: http://camljs.codeplex.com -// Definitions by: Andrey Markeev +// Project: https://github.com/andrei-markeev/camljs +// Definitions by: Andrey Markeev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +// TypeScript Version: 2.7 declare class CamlBuilder { constructor(); @@ -10,25 +10,43 @@ declare class CamlBuilder { Where(): CamlBuilder.IFieldExpression; /** Generate tag for SP.CamlQuery @param viewFields If omitted, default view fields are requested; otherwise, only values for the fields with the specified internal names are returned. - Specifying view fields is a good practice, as it decreases traffic between server and client. */ - View(viewFields?: string[]): CamlBuilder.IView; + Specifying view fields is a good practice, as it decreases traffic between server and client. + Additionally you can specify aggregated fields, e.g. { count: "" }, { sum: "" }, etc.. */ + View(viewFields?: CamlBuilder.ViewField[]): CamlBuilder.IView; /** Generate tag for SPServices */ ViewFields(viewFields: string[]): CamlBuilder.IFinalizableToString; /** Use for: 1. SPServices CAMLQuery attribute 2. Creating partial expressions 3. In conjunction with Any & All clauses - */ + */ static Expression(): CamlBuilder.IFieldExpression; static FromXml(xml: string): CamlBuilder.IRawQuery; } -declare namespace CamlBuilder { - interface IView extends IJoinable, IFinalizable { +declare module CamlBuilder { + type Aggregation = { + count: string; + } | { + sum: string; + } | { + avg: string; + } | { + max: string; + } | { + min: string; + } | { + stdev: string; + } | { + var: string; + }; + type ViewField = string | Aggregation; + interface IView extends IFinalizable { + /** Define query */ Query(): IQuery; + /** Define maximum amount of returned records */ RowLimit(limit: number, paged?: boolean): IView; + /** Define view scope */ Scope(scope: ViewScope): IView; - } - interface IJoinable { /** Join the list you're querying with another list. Joins are only allowed through a lookup field relation. @param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in. @@ -40,22 +58,39 @@ declare namespace CamlBuilder { @alias alias for the joined list */ LeftJoin(lookupFieldInternalName: string, alias: string): IJoin; } + interface IJoinable { + /** Join the list you're querying with another list. + Joins are only allowed through a lookup field relation. + @param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in. + @param alias Alias for the joined list + @param fromList (optional) List where the lookup column resides - use it only for nested joins */ + InnerJoin(lookupFieldInternalName: string, alias: string, fromList?: string): IJoin; + /** Join the list you're querying with another list. + Joins are only allowed through a lookup field relation. + @param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in. + @param alias Alias for the joined list + @param fromList (optional) List where the lookup column resides - use it only for nested joins */ + LeftJoin(lookupFieldInternalName: string, alias: string, fromList?: string): IJoin; + } interface IJoin extends IJoinable { /** Select projected field for using in the main Query body @param remoteFieldAlias By this alias, the field can be used in the main Query body. */ Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView; } - interface IProjectableView extends IView { + interface IProjectableView extends IJoinable { + /** Define query */ + Query(): IQuery; + /** Define maximum amount of returned records */ + RowLimit(limit: number, paged?: boolean): IView; + /** Define view scope */ + Scope(scope: ViewScope): IView; /** Select projected field for using in the main Query body @param remoteFieldAlias By this alias, the field can be used in the main Query body. */ Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView; } enum ViewScope { - /** */ Recursive = 0, - /** */ RecursiveAll = 1, - /** */ FilesOnly = 2, } interface IQuery extends IGroupable { @@ -85,8 +120,9 @@ declare namespace CamlBuilder { } interface IGroupable extends ISortable { /** Adds GroupBy clause to the query. - @param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. */ - GroupBy(fieldInternalName: any): IGroupedQuery; + @param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. + @param groupLimit Return only first N groups */ + GroupBy(fieldInternalName: any, collapse?: boolean, groupLimit?: number): IGroupedQuery; } interface IExpression extends IGroupable { /** Adds And clause to the query. */ @@ -113,6 +149,12 @@ declare namespace CamlBuilder { Any(conditions: IExpression[]): IExpression; /** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Text */ TextField(internalName: string): ITextFieldExpression; + /** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is ContentTypeId */ + ContentTypeIdField(internalName?: string): ITextFieldExpression; + /** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Choice */ + ChoiceField(internalName: string): ITextFieldExpression; + /** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Computed */ + ComputedField(internalName: string): ITextFieldExpression; /** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Boolean */ BooleanField(internalName: string): IBooleanFieldExpression; /** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is URL */ @@ -360,7 +402,7 @@ declare namespace CamlBuilder { Year = 4, } class Internal { - static createView(viewFields?: string[]): IView; + static createView(viewFields?: ViewField[]): IView; static createViewFields(viewFields: string[]): IFinalizableToString; static createWhere(): IFieldExpression; static createExpression(): IFieldExpression; @@ -401,3 +443,4 @@ declare namespace CamlBuilder { }; } } +export = CamlBuilder; diff --git a/types/camljs/tsconfig.json b/types/camljs/tsconfig.json index 5fbe5605e9..ed88508fc3 100644 --- a/types/camljs/tsconfig.json +++ b/types/camljs/tsconfig.json @@ -14,7 +14,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true }, "files": [ "index.d.ts", diff --git a/types/catbox/catbox-tests.ts b/types/catbox/catbox-tests.ts index e86d2a94af..af85cde068 100644 --- a/types/catbox/catbox-tests.ts +++ b/types/catbox/catbox-tests.ts @@ -18,6 +18,9 @@ const Memory: EnginePrototypeOrObject = { const client = new Client(Memory, { partition: 'cache' }); +client.start().then(() => {}); +client.stop().then(() => {}); + const cache = new Policy({ expiresIn: 5000, }, client, 'cache'); diff --git a/types/catbox/index.d.ts b/types/catbox/index.d.ts index bd41889e07..e90768be20 100644 --- a/types/catbox/index.d.ts +++ b/types/catbox/index.d.ts @@ -23,7 +23,7 @@ export class Client implements ClientApi { /** start() - creates a connection to the cache server. Must be called before any other method is available. */ start(): Promise; /** stop() - terminates the connection to the cache server. */ - stop(): void; + stop(): Promise; /** * get(key, callback) - retrieve an item from the cache engine if found where: * * key - a cache key object (see [ICacheKey]). diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 058bfd78ea..211b6a59d8 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -5246,7 +5246,7 @@ declare namespace chrome.runtime { export interface PortMessageEvent extends chrome.events.Event<(message: any, port: Port) => void> { } - export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response: any) => void) => void> { } + export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void> { } export interface ExtensionConnectEvent extends chrome.events.Event<(port: Port) => void> { } diff --git a/types/cordova-sqlite-storage/index.d.ts b/types/cordova-sqlite-storage/index.d.ts index 6ba48b08d2..02d63be0c3 100644 --- a/types/cordova-sqlite-storage/index.d.ts +++ b/types/cordova-sqlite-storage/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for cordova-sqlite-storage 1.5 -// Project: https://github.com/litehelpers/Cordova-sqlite-storage +// Project: https://github.com/xpbrew/cordova-sqlite-storage // Definitions by: rafw87 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index df6870c70a..b4ca7de92f 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Cytoscape.js 3.2 +// Type definitions for Cytoscape.js 3.3 // Project: http://js.cytoscape.org/ // Definitions by: Fabian Schmidt and Fred Eisele // Shenghan Gao @@ -464,6 +464,27 @@ declare namespace cytoscape { */ endBatch(): void; + /** + * Attaches the instance to the specified container for visualisation. + * http://js.cytoscape.org/#cy.mount + * + * If the core instance is headless prior to calling cy.mount(), then + * the instance will no longer be headless and the visualisation will + * be shown in the specified container. If the core instance is + * non-headless prior to calling cy.mount(), then the visualisation + * is swapped from the prior container to the specified container. + */ + mount(element: Element): void; + + /** + * Remove the instance from its current container. + * http://js.cytoscape.org/#cy.unmount + * + * This function sets the instance to be headless after unmounting from + * the current container. + */ + unmount(): void; + /** * A convenience function to explicitly destroy the Core. * http://js.cytoscape.org/#cy.destroy diff --git a/types/d3-array/d3-array-tests.ts b/types/d3-array/d3-array-tests.ts index 11f208f869..b0d00d5d20 100644 --- a/types/d3-array/d3-array-tests.ts +++ b/types/d3-array/d3-array-tests.ts @@ -608,7 +608,8 @@ const testObject = { }; const p1: Array = d3Array.permute(testObject, ['name', 'val', 'when', 'more']); -const p2: Array = d3Array.permute(testObject, ['when', 'more']); +// $ExpectType: Array +const p2 = d3Array.permute(testObject, ['when', 'more']); // $ExpectError const p3 = d3Array.permute(testObject, ['when', 'unknown']); diff --git a/types/debug/index.d.ts b/types/debug/index.d.ts index 954ca3a35a..715e7c145e 100644 --- a/types/debug/index.d.ts +++ b/types/debug/index.d.ts @@ -38,7 +38,7 @@ declare namespace debug { (formatter: any, ...args: any[]): void; enabled: boolean; - log: (v: any) => string; + log: (...args: any[]) => any; namespace: string; extend: (namespace: string, delimiter?: string) => Debugger; } diff --git a/types/ej.web.all/index.d.ts b/types/ej.web.all/index.d.ts index 020b3d363a..778e160f66 100644 --- a/types/ej.web.all/index.d.ts +++ b/types/ej.web.all/index.d.ts @@ -8,8 +8,8 @@ /*! * filename: ej.web.all.d.ts -* version : 16.4.0.42 -* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved. +* version : 16.4.0.52 +* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under diff --git a/types/elliptic/index.d.ts b/types/elliptic/index.d.ts index 722568a6f6..7b1e885d6f 100644 --- a/types/elliptic/index.d.ts +++ b/types/elliptic/index.d.ts @@ -187,7 +187,7 @@ export class ec { export namespace ec { interface GenKeyPairOptions { - pers: any; + pers?: any; entropy: any; persEnc?: string; entropyEnc?: string; diff --git a/types/emojione/index.d.ts b/types/emojione/index.d.ts index 92399fdf9a..21d4726c2f 100644 --- a/types/emojione/index.d.ts +++ b/types/emojione/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for emojione 2.2 -// Project: https://github.com/Ranks/emojione, http://www.emojione.com +// Project: https://github.com/Ranks/emojione, https://www.emojione.com // Definitions by: Danilo Bargen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index 10045e57e6..f2ce8d8197 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -412,6 +412,7 @@ async () => { { resize: { width: 300 } }, { resize: { height: 300 } }, { resize: { height: 300, width: 300 } }, + { crop: { originX: 0, originY: 0, height: 300, width: 300 } } ], { compress: 0.75 }); diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 8b488f9b59..7e75c1b7d6 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -1952,14 +1952,16 @@ export namespace ImageManipulator { } interface Flip { - flip?: { vertical?: boolean; horizontal?: boolean }; + flip: { vertical?: boolean; horizontal?: boolean }; } interface Crop { - originX: number; - originY: number; - width: number; - height: number; + crop: { + originX: number; + originY: number; + width: number; + height: number; + }; } interface ImageResult { diff --git a/types/express-urlrewrite/express-urlrewrite-tests.ts b/types/express-urlrewrite/express-urlrewrite-tests.ts new file mode 100644 index 0000000000..e1c4c780be --- /dev/null +++ b/types/express-urlrewrite/express-urlrewrite-tests.ts @@ -0,0 +1,22 @@ +import * as express from "express"; + +import rewrite = require("express-urlrewrite"); + +declare const app: express.Application; + +app.use(rewrite(/^\/i(\w+)/, "/items/$1")); + +app.use(rewrite("/:src..:dst", "/commits/$1/to/$2")); +app.use(rewrite("/:src..:dst", "/commits/:src/to/:dst")); + +app.use(rewrite("/js/*", "/public/assets/js/$1")); + +app.use(rewrite("/file\\?param=:param", "/file/:param")); + +app.use(rewrite("/path", "/anotherpath?param=some")); + +app.get("/route/:var", rewrite("/rewritten/:var")); + +declare const someMw: express.Handler; + +app.get("/rewritten/:var", someMw); diff --git a/types/express-urlrewrite/index.d.ts b/types/express-urlrewrite/index.d.ts new file mode 100644 index 0000000000..12e74c6ed5 --- /dev/null +++ b/types/express-urlrewrite/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for express-urlrewrite 1.2 +// Project: https://github.com/kapouer/express-urlrewrite +// Definitions by: Melvin Groenhoff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import * as express from "express"; + +declare function rewrite(s: string): express.Handler; +declare function rewrite(s: string | RegExp, t: string): express.Handler; + +export = rewrite; diff --git a/types/i18next-browser-languagedetector/v0/tsconfig.json b/types/express-urlrewrite/tsconfig.json similarity index 62% rename from types/i18next-browser-languagedetector/v0/tsconfig.json rename to types/express-urlrewrite/tsconfig.json index 9873c74134..0e5659e0eb 100644 --- a/types/i18next-browser-languagedetector/v0/tsconfig.json +++ b/types/express-urlrewrite/tsconfig.json @@ -6,23 +6,18 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, "strictFunctionTypes": true, - "baseUrl": "../../", + "strictNullChecks": true, + "baseUrl": "../", "typeRoots": [ - "../../" + "../" ], - "paths": { - "i18next-browser-languagedetector": [ - "i18next-browser-languagedetector/v0" - ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "i18next-browser-languagedetector-tests.ts" + "express-urlrewrite-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/i18next-browser-languagedetector/tslint.json b/types/express-urlrewrite/tslint.json similarity index 100% rename from types/i18next-browser-languagedetector/tslint.json rename to types/express-urlrewrite/tslint.json diff --git a/types/favicons/index.d.ts b/types/favicons/index.d.ts index 782ad0cb7c..730841dff9 100644 --- a/types/favicons/index.d.ts +++ b/types/favicons/index.d.ts @@ -9,7 +9,7 @@ import { Duplex } from "stream"; declare namespace favicons { - interface Configuration { + interface Configuration { /** Path for overriding default icons path @default "/" */ path: string; /** Your application's name @default null */ @@ -38,6 +38,8 @@ declare namespace favicons { version: string; /** Print logs to console? @default false */ logging: boolean; + /** Use nearest neighbor resampling to preserve hard edges on pixel art @default false */ + pixel_art: boolean; /** * Platform Options: * - offset - offset in percentage @@ -66,18 +68,18 @@ declare namespace favicons { }>; } - interface FavIconResponse { + interface FavIconResponse { images: Array<{ name: string; contents: Buffer }>; files: Array<{ name: string; contents: Buffer }>; html: string[]; } - type Callback = (error: Error | null, response: FavIconResponse) => void; + type Callback = (error: Error | null, response: FavIconResponse) => void; /** You can programmatically access Favicons configuration (icon filenames, HTML, manifest files, etc) with this export */ - const config: Configuration; + const config: Configuration; - function stream(configuration?: Configuration): Duplex; + function stream(configuration?: Configuration): Duplex; } /** * Generate favicons diff --git a/types/firefox-webext-browser/index.d.ts b/types/firefox-webext-browser/index.d.ts index 1dfe1eb809..c0a8896e56 100644 --- a/types/firefox-webext-browser/index.d.ts +++ b/types/firefox-webext-browser/index.d.ts @@ -3188,7 +3188,7 @@ declare namespace browser.storage { * @param changes Object mapping each key that changed to its corresponding `storage.StorageChange` for that item. * @param areaName The name of the storage area (`"sync"`, `"local"` or `"managed"`) the changes are for. */ - const onChanged: WebExtEvent<(changes: StorageChange, areaName: string) => void>; + const onChanged: WebExtEvent<(changes: {[key: string]: StorageChange}, areaName: string) => void>; } /** diff --git a/types/hexo/package.json b/types/hexo/package.json new file mode 100644 index 0000000000..f06689a6b9 --- /dev/null +++ b/types/hexo/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "moment": "^2.19.4" + } +} diff --git a/types/i18next-browser-languagedetector/i18next-browser-languagedetector-tests.ts b/types/i18next-browser-languagedetector/i18next-browser-languagedetector-tests.ts deleted file mode 100644 index eadfcea369..0000000000 --- a/types/i18next-browser-languagedetector/i18next-browser-languagedetector-tests.ts +++ /dev/null @@ -1,61 +0,0 @@ -import * as i18next from "i18next"; -import * as LngDetector from "i18next-browser-languagedetector"; - -const options: LngDetector.DetectorOptions = { - // order and from where user language should be detected - order: ["querystring", "cookie", "localStorage", "navigator", "htmlTag"], - - // keys or params to lookup language from - lookupQuerystring: "lng", - lookupCookie: "i18next", - lookupLocalStorage: "i18nextLng", - - // cache user language on - caches: ["localStorage", "cookie"], - excludeCacheFor: ["cimode"], // languages to not persist (cookie, localStorage) - - // optional expire and domain for set cookie - cookieMinutes: 10, - cookieDomain: "myDomain", - - // optional htmlTag with lang attribute, the default is: - htmlTag: document.documentElement -}; - -i18next.use(LngDetector).init({ - detection: options -}); - -const customDetector: LngDetector.CustomDetector = { - name: "myDetectorsName", - - lookup(options: LngDetector.DetectorOptions) { - // options -> are passed in options - return "en"; - }, - - cacheUserLanguage(lng: string, options: LngDetector.DetectorOptions) { - // options -> are passed in options - // lng -> current language, will be called after init and on changeLanguage - - // store it - } -}; - -const customDetector2: LngDetector.CustomDetector = { - name: "myDetectorsName", - lookup(options: LngDetector.DetectorOptions) { - return undefined; - } -}; - -const lngDetector = new LngDetector(null, options); - -lngDetector.init(options); -lngDetector.addDetector(customDetector); - -i18next - .use(lngDetector) - .init({ - detection: options - }); diff --git a/types/i18next-browser-languagedetector/index.d.ts b/types/i18next-browser-languagedetector/index.d.ts deleted file mode 100644 index 88dbe79d8d..0000000000 --- a/types/i18next-browser-languagedetector/index.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Type definitions for i18next-browser-languagedetector 2.0 -// Project: http://i18next.com/, https://github.com/i18next/i18next-browser-languagedetector -// Definitions by: Cyril Schumacher , Giedrius Grabauskas -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -declare namespace i18nextBrowserLanguageDetector { - interface DetectorOptions { - /** - * order and from where user language should be detected - */ - order?: Array<"querystring" | "cookie" | "localStorage" | "navigator" | "htmlTag" | string>; - - /** - * keys or params to lookup language from - */ - lookupQuerystring?: string; - lookupCookie?: string; - lookupLocalStorage?: string; - - /** - * cache user language on - */ - caches?: string[]; - - /** - * languages to not persist (cookie, localStorage) - */ - excludeCacheFor?: string[]; - - /** - * optional expire and domain for set cookie - * @default 10 - */ - cookieMinutes?: number; - cookieDomain?: string; - - /** - * optional htmlTag with lang attribute - * @default document.documentElement - */ - htmlTag?: HTMLElement; - } - - interface CustomDetector { - name: string; - cacheUserLanguage?(lng: string, options: DetectorOptions): void; - lookup(options: DetectorOptions): string | undefined; - } -} - -declare class i18nextBrowserLanguageDetector { - constructor(services?: any, options?: i18nextBrowserLanguageDetector.DetectorOptions); - /** - * Adds detector. - */ - addDetector(detector: i18nextBrowserLanguageDetector.CustomDetector): i18nextBrowserLanguageDetector; - - /** - * Initializes detector. - */ - init(options?: i18nextBrowserLanguageDetector.DetectorOptions): void; -} - -export = i18nextBrowserLanguageDetector; diff --git a/types/i18next-browser-languagedetector/v0/i18next-browser-languagedetector-tests.ts b/types/i18next-browser-languagedetector/v0/i18next-browser-languagedetector-tests.ts deleted file mode 100644 index 0217ca74ce..0000000000 --- a/types/i18next-browser-languagedetector/v0/i18next-browser-languagedetector-tests.ts +++ /dev/null @@ -1,42 +0,0 @@ -import * as i18next from 'i18next'; -import LngDetector from 'i18next-browser-languagedetector'; - -const options = { - // order and from where user language should be detected - order: ['querystring', 'cookie', 'localStorage', 'navigator'], - - // keys or params to lookup language from - lookupQuerystring: 'lng', - lookupCookie: 'i18next', - lookupLocalStorage: 'i18nextLng', - - // cache user language on - caches: ['localStorage', 'cookie'], - - // optional expire and domain for set cookie - cookieMinutes: 10, - cookieDomain: 'myDomain' -}; -const myDetector = { - name: 'myDetectorsName', - - lookup(options: {}) { - // options -> are passed in options - return 'en'; - }, - - cacheUserLanguage(lng: string, options: {}) { - // options -> are passed in options - // lng -> current language, will be called after init and on changeLanguage - - // store it - } -}; - -i18next.use(LngDetector).init({ - detection: options -}); - -const lngDetector = new LngDetector(null, options); -lngDetector.init(options); -lngDetector.addDetector(myDetector); diff --git a/types/i18next-browser-languagedetector/v0/index.d.ts b/types/i18next-browser-languagedetector/v0/index.d.ts deleted file mode 100644 index 8b0f6b6317..0000000000 --- a/types/i18next-browser-languagedetector/v0/index.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -// Type definitions for i18next-browser-languagedetector 0.0 -// Project: http://i18next.com/ -// Definitions by: Cyril Schumacher , Giedrius Grabauskas -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import * as i18next from "i18next"; - -declare namespace I18next { - interface I18nextStatic extends i18nextBrowserLanguageDetector.I18nextStatic { } - interface I18nextOptions extends i18nextBrowserLanguageDetector.I18nextOptions { } -} - -declare namespace i18nextBrowserLanguageDetector { - /** Interface for Language detector options. */ - interface LanguageDetectorOptions { - caches?: string[] | boolean; - cookieDomain?: string; - cookieExpirationDate?: Date; - lookupCookie?: string; - lookupFromPathIndex?: number; - lookupQuerystring?: string; - lookupSession?: string; - order?: string[]; - } - - /** Interface for custom detector. */ - interface CustomDetector { - name: string; - - // todo: Checks parameters type. - cacheUserLanguage(lng: string, options: {}): void; - lookup(options: {}): string; - } - - /** i18next options. */ - interface I18nextOptions { - detection?: LanguageDetectorOptions; - } - - /** i18next interface. */ - interface I18nextStatic { - use(module: LngDetector): I18nextStatic; - } - - /** i18next language detection. */ - class LngDetector { - constructor(services?: any, options?: LanguageDetectorOptions); - - /** Adds detector. */ - addDetector(detector: CustomDetector): LngDetector; - - /** Initializes detector. */ - init(options?: LanguageDetectorOptions): void; - } -} - -export default i18nextBrowserLanguageDetector.LngDetector; diff --git a/types/i18next-browser-languagedetector/v0/tslint.json b/types/i18next-browser-languagedetector/v0/tslint.json deleted file mode 100644 index af6baaddc0..0000000000 --- a/types/i18next-browser-languagedetector/v0/tslint.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "interface-name": [ - false - ], - "no-empty-interface": [ - false - ] - } -} diff --git a/types/indefinite/indefinite-tests.ts b/types/indefinite/indefinite-tests.ts new file mode 100644 index 0000000000..881a09f666 --- /dev/null +++ b/types/indefinite/indefinite-tests.ts @@ -0,0 +1,9 @@ +import { indefinite } from "indefinite"; + +const anApple = indefinite("apple"); // "an apple" +const aBanana = indefinite('banana'); // "a banana" +const AnApple = indefinite('apple', { capitalize: true }); // "An apple" +const anEight = indefinite("8"); // "an 8" +const anEightAsNumber = indefinite(8); // "an 8" +const a1892 = indefinite("1892"); // "a 1892" -> read "a one thousand eight hundred ninety-two" +const a1892AsColloquial = indefinite("1892", { numbers: "colloquial" }); // "an 1892" -> read "an eighteen ninety-two" diff --git a/types/indefinite/index.d.ts b/types/indefinite/index.d.ts new file mode 100644 index 0000000000..50f5fdbbf4 --- /dev/null +++ b/types/indefinite/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for indefinite 2.2 +// Project: https://github.com/tandrewnichols/indefinite +// Definitions by: omaishar +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface Options { + capitalize?: boolean; + caseInsensitive?: boolean; + numbers?: "colloquial"; +} +export function indefinite(word: string | number, opts?: Options): string; diff --git a/types/indefinite/tsconfig.json b/types/indefinite/tsconfig.json new file mode 100644 index 0000000000..94477767e2 --- /dev/null +++ b/types/indefinite/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "indefinite-tests.ts" + ] +} diff --git a/types/p-throttle/tslint.json b/types/indefinite/tslint.json similarity index 100% rename from types/p-throttle/tslint.json rename to types/indefinite/tslint.json diff --git a/types/ink-spinner/index.d.ts b/types/ink-spinner/index.d.ts new file mode 100644 index 0000000000..db68c31c04 --- /dev/null +++ b/types/ink-spinner/index.d.ts @@ -0,0 +1,39 @@ +// Type definitions for ink-spinner 2.0 +// Project: https://github.com/vadimdemedes/ink-spinner#readme +// Definitions by: Łukasz Ostrowski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { Chalk } from 'chalk'; +import * as cliSpinners from 'cli-spinners'; +import { Component } from 'ink'; + +type StringifyPartial = { + [P in keyof T]?: string; +}; + +type BooleansPartial = { + [P in keyof T]?: boolean; +}; + +type TupleOfNumbersPartial = { + [P in keyof T]?: [number, number, number]; +}; +// Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html +type Omit = Pick>; + +type ChalkColorModels = Pick; +type ChalkKeywordsAndHexes = Pick; +type ChalkCommons = Omit; + +interface SpinnerProps { + type?: cliSpinners.SpinnerName; +} + +type ChalkProps = BooleansPartial + & StringifyPartial + & TupleOfNumbersPartial; + +declare class Spinner extends Component { } + +export = Spinner; diff --git a/types/ink-spinner/ink-spinner-tests.tsx b/types/ink-spinner/ink-spinner-tests.tsx new file mode 100644 index 0000000000..3d91bdf1bb --- /dev/null +++ b/types/ink-spinner/ink-spinner-tests.tsx @@ -0,0 +1,10 @@ +/** @jsx h */ +import { h } from 'ink'; +import Spinner from 'ink-spinner'; +// NOTE: `import Spinner = require('ink-spinner');` will work as well. +// If importing using ES6 default import as above, +// `allowSyntheticDefaultImports` flag in compiler options needs to be set to `true` + +const Demo = () => { + return ; +}; diff --git a/types/ink-spinner/tsconfig.json b/types/ink-spinner/tsconfig.json new file mode 100644 index 0000000000..3b72485a18 --- /dev/null +++ b/types/ink-spinner/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "jsx": "react", + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ink-spinner-tests.tsx" + ] +} diff --git a/types/ink-spinner/tslint.json b/types/ink-spinner/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ink-spinner/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/iobroker/index.d.ts b/types/iobroker/index.d.ts index 71fa1b4d78..c3f9cee9d3 100644 --- a/types/iobroker/index.d.ts +++ b/types/iobroker/index.d.ts @@ -900,7 +900,7 @@ declare global { q?: boolean; addID?: boolean; limit?: number; - ignoreNull: boolean; + ignoreNull?: boolean; sessionId?: any; aggregate?: "minmax" | "min" | "max" | "average" | "total" | "count" | "none"; } @@ -1627,11 +1627,11 @@ declare global { removeAllListeners(event?: "ready" | "unload" | "stateChange" | "objectChange" | "message"): this; } // end interface Adapter - type ReadyHandler = () => void; - type ObjectChangeHandler = (id: string, obj: ioBroker.Object | null | undefined) => void; - type StateChangeHandler = (id: string, obj: State | null | undefined) => void; - type MessageHandler = (obj: Message) => void; - type UnloadHandler = (callback: EmptyCallback) => void; + type ReadyHandler = () => void | Promise; + type ObjectChangeHandler = (id: string, obj: ioBroker.Object | null | undefined) => void | Promise; + type StateChangeHandler = (id: string, obj: State | null | undefined) => void | Promise; + type MessageHandler = (obj: Message) => void | Promise; + type UnloadHandler = (callback: EmptyCallback) => void | Promise; type EmptyCallback = () => void; type ErrorCallback = (err?: string) => void; @@ -1682,7 +1682,8 @@ declare global { type SetStateCallback = (err: string | null, id?: string) => void; type SetStateChangedCallback = (err: string | null, id: string, notChanged: boolean) => void; type DeleteStateCallback = (err: string | null, id?: string) => void; - type GetHistoryCallback = (err: string | null, result: Array<(State & { id?: string })>, step: number, sessionId?: string) => void; + type GetHistoryResult = Array<(State & { id?: string })>; + type GetHistoryCallback = (err: string | null, result: GetHistoryResult, step: number, sessionId?: string) => void; /** Contains the return values of readDir */ interface ReadDirResult { diff --git a/types/iobroker/iobroker-tests.ts b/types/iobroker/iobroker-tests.ts index 0302a5041a..49af1f6ebd 100644 --- a/types/iobroker/iobroker-tests.ts +++ b/types/iobroker/iobroker-tests.ts @@ -20,6 +20,16 @@ adapter ; adapter.removeAllListeners(); +// Test adapter constructor options +let adapterOptions: ioBroker.AdapterOptions = { + name: "foo", + ready: readyHandler, + stateChange: stateChangeHandler, + objectChange: objectChangeHandler, + message: messageHandler, + unload: unloadHandler, +}; + function readyHandler() { } function stateChangeHandler(id: string, state: ioBroker.State | null | undefined) { @@ -260,6 +270,8 @@ adapter.subscribeForeignStatesAsync("*").catch(handleError); adapter.unsubscribeStatesAsync("*").catch(handleError); adapter.unsubscribeForeignStatesAsync("*").catch(handleError); +adapter.getHistory("state.id", {}, (err, result: ioBroker.GetHistoryResult) => {}); + // Repro from https://github.com/ioBroker/adapter-core/issues/3 const repro1: ioBroker.ObjectChangeHandler = (id, obj) => { if (!obj || !obj.common) return; diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index d5f829c8fe..cbe5b0f8e2 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -272,7 +272,7 @@ declare namespace IORedis { hgetBuffer(key: KeyType, field: string, callback: (err: Error, res: Buffer) => void): void; hgetBuffer(key: KeyType, field: string): Promise; - hmset(key: KeyType, field: string, value: any, ...args: string[]): Promise<0 | 1>; + hmset(key: KeyType, ...args: any[]): Promise<0 | 1>; hmset(key: KeyType, data: any, callback: (err: Error, res: 0 | 1) => void): void; hmset(key: KeyType, data: any): Promise<0 | 1>; @@ -313,9 +313,13 @@ declare namespace IORedis { getset(key: KeyType, value: any, callback: (err: Error, res: string | null) => void): void; getset(key: KeyType, value: any): Promise; - mset(key: KeyType, value: any, ...args: string[]): any; + mset(...args: any[]): any; + mset(data: any, callback: (err: Error, res: string) => void): void; + mset(data: any): Promise; - msetnx(key: KeyType, value: any, ...args: string[]): any; + msetnx(...args: any[]): any; + msetnx(data: any, callback: (err: Error, res: 0 | 1) => void): void; + msetnx(data: any): Promise<0 | 1>; randomkey(callback: (err: Error, res: string) => void): void; randomkey(): Promise; @@ -489,6 +493,8 @@ declare namespace IORedis { xack(key: KeyType, group: string, ...ids: string[]): any; xadd(key: KeyType, id: string, ...args: string[]): any; + xadd(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', count: number, ...args: string[]): any; + xadd(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', approximate: '~', count: number, ...args: string[]): any; xclaim(key: KeyType, group: string, consumer: string, minIdleTime: number, ...args: any[]): any; @@ -673,7 +679,7 @@ declare namespace IORedis { hget(key: KeyType, field: string, callback?: (err: Error, res: string | string) => void): Pipeline; hgetBuffer(key: KeyType, field: string, callback?: (err: Error, res: Buffer) => void): Pipeline; - hmset(key: KeyType, field: string, value: any, ...args: string[]): Pipeline; + hmset(key: KeyType, ...args: any[]): Pipeline; hmset(key: KeyType, data: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; hmget(key: KeyType, ...fields: string[]): Pipeline; @@ -702,9 +708,11 @@ declare namespace IORedis { getset(key: KeyType, value: any, callback?: (err: Error, res: string) => void): Pipeline; - mset(key: KeyType, value: any, ...args: string[]): Pipeline; + mset(...args: any[]): Pipeline; + mset(data: any, callback?: (err: Error, res: string) => void): Pipeline; - msetnx(key: KeyType, value: any, ...args: string[]): Pipeline; + msetnx(...args: any[]): Pipeline; + msetnx(data: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; randomkey(callback?: (err: Error, res: string) => void): Pipeline; diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index 9950a8543f..fdb1fafcc1 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -154,6 +154,9 @@ redis.multi([ const keys = ['foo', 'bar']; redis.mget(...keys); +redis.mset(...['foo', 'bar']); +redis.mset({ foo: 'bar' }); + new Redis.Cluster([ 'localhost' ]); @@ -177,6 +180,8 @@ new Redis.Cluster([{ redis.xack('streamName', 'groupName', 'id'); redis.xadd('streamName', '*', 'field', 'name'); +redis.xadd('streamName', 'MAXLEN', 100, '*', 'field', 'name'); +redis.xadd('streamName', 'MAXLEN', '~', 100, '*', 'field', 'name'); redis.xclaim('streamName', 'groupName', 'consumerName', 3600000, 'id'); redis.xdel('streamName', 'id'); redis.xgroup('CREATE', 'streamName', 'groupName', '$'); diff --git a/types/is-blank/index.d.ts b/types/is-blank/index.d.ts new file mode 100644 index 0000000000..eedfa5bd6d --- /dev/null +++ b/types/is-blank/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for is-blank 2.1 +// Project: https://github.com/johnotander/is-blank#readme +// Definitions by: Christian Gambardella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function isBlank(input: any): boolean; +export = isBlank; diff --git a/types/is-blank/is-blank-tests.ts b/types/is-blank/is-blank-tests.ts new file mode 100644 index 0000000000..367571922a --- /dev/null +++ b/types/is-blank/is-blank-tests.ts @@ -0,0 +1,17 @@ +import isBlank = require('is-blank'); + +isBlank([]); // => true +isBlank({}); // => true +isBlank(0); // => true +isBlank(() => {}); // => true +isBlank(null); // => true +isBlank(undefined); // => true +isBlank(''); // => true +isBlank(' '); // => true +isBlank('\r\t\n '); // => true + +isBlank(['a', 'b']); // => false +isBlank({ a: 'b' }); // => false +isBlank('string'); // => false +isBlank(42); // => false +isBlank((a: number, b: number) => a + b); diff --git a/types/p-throttle/tsconfig.json b/types/is-blank/tsconfig.json similarity index 93% rename from types/p-throttle/tsconfig.json rename to types/is-blank/tsconfig.json index 81852e4d18..58f358a499 100644 --- a/types/p-throttle/tsconfig.json +++ b/types/is-blank/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "p-throttle-tests.ts" + "is-blank-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/is-blank/tslint.json b/types/is-blank/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/is-blank/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/jasmine-data_driven_tests/index.d.ts b/types/jasmine-data_driven_tests/index.d.ts index 8c719de652..553987ef60 100644 --- a/types/jasmine-data_driven_tests/index.d.ts +++ b/types/jasmine-data_driven_tests/index.d.ts @@ -34,6 +34,6 @@ interface JasmineDataDrivenTest { assertion: (arg0: T, arg1: U, done: () => void) => void): void; ( description: string, - dataset: T[], + dataset: T[] | Array<[T]>, assertion: (value: T, done: () => void) => void): void; } diff --git a/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts b/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts index 6689159b58..0523a28af0 100644 --- a/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts +++ b/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts @@ -37,6 +37,13 @@ xall("A data driven test can be pending", } ); +all("A data set must consist of array-wrapped arrays, if test expects single array input", + [[[1, 2]], [[3, 4]], [[5, 6]]], + (numberArray: number[]) => { + expect(numberArray.length).toBe(2); + } +); + describe("A suite", () => { let a: number; diff --git a/types/jenkins/index.d.ts b/types/jenkins/index.d.ts index 4e1c42fa3e..1155b430b0 100644 --- a/types/jenkins/index.d.ts +++ b/types/jenkins/index.d.ts @@ -15,7 +15,7 @@ declare namespace create { log(name: string, n: number, start: number, callback: (err: Error, data: any) => void): void; log(name: string, n: number, start: number, type: 'text' | 'html', callback: (err: Error, data: any) => void): void; log(name: string, n: number, start: number, type: 'text' | 'html', meta: boolean, callback: (err: Error, data: any) => void): void; - logStream(name: string, n: number, type?: 'text' | 'html', delay?: number): NodeJS.ReadableStream; + logStream(name: string, n: number, options?: { type?: 'text' | 'html', delay?: number }): NodeJS.ReadableStream; stop(name: string, n: number, callback: (err: Error) => void): void; term(name: string, n: number, callback: (err: Error) => void): void; }; diff --git a/types/jenkins/jenkins-tests.ts b/types/jenkins/jenkins-tests.ts index 93fc61bb07..8f3ffe4555 100644 --- a/types/jenkins/jenkins-tests.ts +++ b/types/jenkins/jenkins-tests.ts @@ -34,6 +34,20 @@ log.on('end', () => { console.log('end'); }); +const log2 = jenkins.build.logStream('example', 1, { type: 'html', delay: 2 * 1000 }); + +log2.on('data', (text: string) => { + process.stdout.write(text); +}); + +log2.on('error', (err: Error) => { + console.log('error', err); +}); + +log2.on('end', () => { + console.log('end'); +}); + jenkins.build.stop('example', 1, (err) => { if (err) throw err; }); diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 4ecf403a6f..c943fbfa33 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -15,6 +15,7 @@ // Peter Thorson // Will Garcia // Simon Schick +// Alejandro Fernandez Haro // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -704,7 +705,7 @@ export interface ArraySchema extends AnySchema { * `schema` - the validation rules required to satisfy the assertion. If the `schema` includes references, they are resolved against * the array item being tested, not the value of the `ref` target. */ - assertItem(schema: SchemaLike): this; + has(schema: SchemaLike): this; /** * Allow this array to be sparse. * enabled can be used with a falsy value to go back to the default behavior. diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index 4dbc784756..b4f01cfe56 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -312,7 +312,7 @@ anySchema = Joi.any(); arrSchema = Joi.array(); -arrSchema = arrSchema.assertItem(Joi.any()); +arrSchema = arrSchema.has(Joi.any()); arrSchema = arrSchema.sparse(); arrSchema = arrSchema.sparse(bool); arrSchema = arrSchema.single(); diff --git a/types/jsoneditor/index.d.ts b/types/jsoneditor/index.d.ts index f095cb8434..3c74a3d789 100644 --- a/types/jsoneditor/index.d.ts +++ b/types/jsoneditor/index.d.ts @@ -1,54 +1,199 @@ -// Type definitions for jsoneditor v5.19.0 +// Type definitions for jsoneditor v5.28.2 // Project: https://github.com/josdejong/jsoneditor // Definitions by: Alejandro Sánchez // Errietta Kostala +// Adam Vigneaux // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// +import { Ajv } from "ajv"; + declare module 'jsoneditor' { - export interface JSONEditorNode { + type JSONPath = (string|number)[]; + + export interface Node { field: string; - value: string; - path: Array; + value?: string; + path: JSONPath; } export type JSONEditorMode = 'tree' | 'view' | 'form' | 'code' | 'text'; + export interface NodeName { + path: string; + type: 'object'|'array'; + size: number; + } + + export interface ValidationError { + path: JSONPath; + message: string; + } + + export interface Template { + text: string; + title: string; + className?: string; + field: string; + value: any; + } + + export type AutoCompleteCompletion = null|string[]|{startFrom: number, options: string[]}; + + export type AutoCompleteOptionsGetter = ( + text: string, path: JSONPath, input: string, editor: JSONEditor, + ) => AutoCompleteCompletion|Promise; + + export interface AutoCompleteOptions { + /** + * @default [39, 35, 9] + */ + confirmKeys?: number[]; + caseSensitive?: boolean; + getOptions?: AutoCompleteOptionsGetter; + } + + export interface SelectionPosition { + row: number; + column: number; + } + + export interface SerializableNode { + value: any; + path: JSONPath; + } + + // Based on the API of https://github.com/Sphinxxxx/vanilla-picker + export interface Color { + rgba: Array; + hsla: Array; + rgbString: string; + rgbaString: string; + hslString: string; + hslaString: string; + hex: string; + } + export interface JSONEditorOptions { ace?: AceAjax.Ace; - ajv?: any; // Any for now, since ajv typings aren't A-Ok + ajv?: Ajv; onChange?: () => void; - onEditable?: (node: JSONEditorNode) => boolean | {field: boolean, value: boolean}; + onChangeJSON?: (json: any) => void; + onChangeText?: (jsonString: string) => void; + onEditable?: (node: Node) => boolean|{field: boolean, value: boolean}; onError?: (error: Error) => void; onModeChange?: (newMode: JSONEditorMode, oldMode: JSONEditorMode) => void; + onNodeName?: (nodeName: NodeName) => string|undefined; + onValidate?: (json: any) => ValidationError[]|Promise; + /** + * @default false + */ escapeUnicode?: boolean; + /** + * @default false + */ sortObjectKeys?: boolean; + /** + * @default true + */ history?: boolean; + /** + * @default 'tree' + */ mode?: JSONEditorMode; - modes?: Array; + modes?: JSONEditorMode[]; + /** + * @default undefined + */ name?: string; - schema?: Object; - schemaRefs?: Object; + schema?: object; + schemaRefs?: object; + /** + * @default true + */ search?: boolean; + /** + * @default 2 + */ indentation?: number; theme?: string; + templates?: Template[]; + autocomplete?: AutoCompleteOptions; + /** + * @default true + */ + mainMenuBar?: boolean; + /** + * @default true + */ + navigationBar?: boolean; + /** + * @default true + */ + statusBar?: boolean; + onTextSelectionChange?: (start: SelectionPosition, end: SelectionPosition, text: string) => void; + onSelectionChange?: (start: SerializableNode, end: SerializableNode) => void; + onEvent?: (node: Node, event: string) => void; + /** + * @default true + */ + colorPicker?: boolean; + onColorPicker?: (parent: HTMLElement, color: string, onChange: (color: Color) => void) => void; + /** + * @default true + */ + timestampTag?: boolean; + language?: string; + languages?: { + [lang: string]: { + [key: string]: string; + }; + }; + modalAnchor?: HTMLElement; + /** + * @default true + */ + enableSort?: boolean; + /** + * @default true + */ + enableTransform?: boolean; + /** + * @default 100 + */ + maxVisibleChilds?: number; + } export default class JSONEditor { - constructor(container: HTMLElement, options?: JSONEditorOptions, json?: Object); + constructor(container: HTMLElement, options?: JSONEditorOptions, json?: any); collapseAll(): void; destroy(): void; expandAll(): void; focus(): void; - set(json: Object): void; - setMode(mode: JSONEditorMode): void; - setName(name?: string): void; - setSchema(schema: Object): void; - setText(jsonString: string): void; get(): any; getMode(): JSONEditorMode; - getName(): string; + getName(): string|undefined; + getNodesByRange(start: {path: JSONPath}, end: {path: JSONPath}): Array; + getSelection(): {start: SerializableNode, end: SerializableNode}; getText(): string; + getTextSelection(): {start: SelectionPosition, end: SelectionPosition, text: string}; + refresh(): void; + set(json: any): void; + setMode(mode: JSONEditorMode): void; + setName(name?: string): void; + setSchema(schema: object, schemaRefs?: object): void; + setSelection(start: {path: JSONPath}, end: {path: JSONPath}): void; + setText(jsonString: string): void; + setTextSelection(start: SelectionPosition, end: SelectionPosition): void; + update(json: any): void; + updateText(jsonString: string): void; + + static VALID_OPTIONS: Array; + static ace: AceAjax.Ace; + static Ajv: Ajv; + static VanillaPicker: any; } } diff --git a/types/jsoneditor/jsoneditor-tests.ts b/types/jsoneditor/jsoneditor-tests.ts index d905e6ba76..b584a14416 100644 --- a/types/jsoneditor/jsoneditor-tests.ts +++ b/types/jsoneditor/jsoneditor-tests.ts @@ -1,11 +1,13 @@ -import JSONEditor, {JSONEditorMode, JSONEditorNode, JSONEditorOptions } from 'jsoneditor'; +import * as Ajv from 'ajv'; +import JSONEditor, {JSONEditorMode, Node, JSONEditorOptions } from 'jsoneditor'; let options: JSONEditorOptions; +options = {}; options = { ace: ace, - //ajv: Ajv({allErrors: true, verbose: true}) + ajv: new Ajv({allErrors: true, verbose: true}), onChange() {}, - onEditable(node: JSONEditorNode) { + onEditable(node: Node) { return true; }, onError(error: Error) {}, @@ -23,7 +25,7 @@ options = { theme: 'default' }; options = { - onEditable(node: JSONEditorNode) { + onEditable(node: Node) { return {field: true, value: false}; } }; diff --git a/types/jsoneditor/package.json b/types/jsoneditor/package.json new file mode 100644 index 0000000000..b47ef67b0a --- /dev/null +++ b/types/jsoneditor/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "ajv": "*" + } +} diff --git a/types/klaw/index.d.ts b/types/klaw/index.d.ts index 7b4e586842..32810990d5 100644 --- a/types/klaw/index.d.ts +++ b/types/klaw/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for klaw v2.1.1 +// Type definitions for klaw v3.0.0 // Project: https://github.com/jprichardson/node-klaw // Definitions by: Matthew McEachen +// Pascal Sthamer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -26,6 +27,7 @@ declare module "klaw" { fs?: any // fs or mock-fs filter?: (path: string) => boolean depthLimit?: number + preserveSymlinks?: boolean } type Event = "close" | "data" | "end" | "readable" | "error" diff --git a/types/klaw/klaw-tests.ts b/types/klaw/klaw-tests.ts index 69406f73e8..baecd656f3 100644 --- a/types/klaw/klaw-tests.ts +++ b/types/klaw/klaw-tests.ts @@ -5,7 +5,7 @@ const path = require('path'); let items: klaw.Item[] = [] // files, directories, symlinks, etc -klaw('/some/dir') +klaw('/some/dir', { preserveSymlinks: false }) .on('data', function(item: klaw.Item) { items.push(item) }) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index f99f76817d..708b8af387 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -626,7 +626,7 @@ export interface PathOptions extends InteractiveLayerOptions { opacity?: number; lineCap?: LineCapShape; lineJoin?: LineJoinShape; - dashArray?: string; + dashArray?: string | number[]; dashOffset?: string; fill?: boolean; fillColor?: string; @@ -1134,14 +1134,15 @@ export interface PopupOptions extends DivOverlayOptions { maxWidth?: number; minWidth?: number; maxHeight?: number; + keepInView?: boolean; + closeButton?: boolean; autoPan?: boolean; autoPanPaddingTopLeft?: PointExpression; autoPanPaddingBottomRight?: PointExpression; autoPanPadding?: PointExpression; - keepInView?: boolean; - closeButton?: boolean; autoClose?: boolean; closeOnClick?: boolean; + closeOnEscapeKey?: boolean; } export type Content = string | HTMLElement; @@ -1534,6 +1535,9 @@ export interface MarkerOptions extends InteractiveLayerOptions { opacity?: number; riseOnHover?: boolean; riseOffset?: number; + autoPan?: boolean; + autoPanSpeed?: number; + autoPanPadding?: PointExpression; } export class Marker

extends Layer { diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts index 2e0f139e9d..99ac56dd7f 100644 --- a/types/leaflet/leaflet-tests.ts +++ b/types/leaflet/leaflet-tests.ts @@ -506,7 +506,10 @@ export class MyNewControl extends L.Control { L.marker([1, 2], { icon: L.icon({ iconUrl: 'my-icon.png' - }) + }), + autoPan: true, + autoPanPadding: [10, 20], + autoPanSpeed: 5, }).bindPopup('

Hi

'); L.marker([1, 2], { diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index eebf89497d..44165c06c3 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -426,7 +426,7 @@ export class Interval { engulfs(other: Interval): boolean; equals(other: Interval): boolean; hasSame(unit: DurationUnit): boolean; - intersection(other: Interval): Interval; + intersection(other: Interval): Interval | null; isAfter(dateTime: DateTime): boolean; isBefore(dateTime: DateTime): boolean; isEmpty(): boolean; diff --git a/types/luxon/luxon-tests.ts b/types/luxon/luxon-tests.ts index 59566c35c3..ecf49e2081 100644 --- a/types/luxon/luxon-tests.ts +++ b/types/luxon/luxon-tests.ts @@ -140,6 +140,7 @@ i.length('years'); // $ExpectType number i.contains(DateTime.local(2019)); // $ExpectType boolean i.set({end: DateTime.local(2020)}); // $ExpectType Interval i.mapEndpoints((d) => d); // $ExpectType Interval +i.intersection(i); // $ExpectType Interval | null i.toISO(); // $ExpectType string i.toString(); // $ExpectType string diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 267163ac80..fde5e91372 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -337,7 +337,7 @@ declare module "mongoose" { /** Use ssl connection (needs to have a mongod server with ssl support) (default: true) */ ssl?: boolean; /** Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) */ - sslValidate?: object; + sslValidate?: boolean; /** Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. */ poolSize?: number; /** Reconnect on error (default: true) */ @@ -1722,6 +1722,9 @@ declare module "mongoose" { * If later in the query chain a method returns Query, we will need to know type T. * So we save this type as the second type parameter in DocumentQuery. Since people have * been using Query, we set it as an alias of DocumentQuery. + * + * Furthermore, Query is used for function that has an option { rawResult: true }. + * for instance findOneAndUpdate. */ class Query extends DocumentQuery { } class DocumentQuery extends mquery { @@ -1864,7 +1867,7 @@ declare module "mongoose" { equals(val: T): this; /** Executes the query */ - exec(callback?: (err: any, res: T) => void): Promise; + exec(callback?: (err: NativeError, res: T) => void): Promise; exec(operation: string | Function, callback?: (err: any, res: T) => void): Promise; /** Specifies an $exists condition */ @@ -1895,10 +1898,16 @@ declare module "mongoose" { * Issues a mongodb findAndModify remove command. * Finds a matching document, removes it, passing the found document (if any) to the * callback. Executes immediately if callback is passed. + * + * If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify(). + * https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set */ findOneAndRemove(callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery & QueryHelpers; findOneAndRemove(conditions: any, callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery & QueryHelpers; + findOneAndRemove(conditions: any, options: { rawResult: true } & QueryFindOneAndRemoveOptions, + callback?: (error: any, doc: mongodb.FindAndModifyWriteOpResultObject, result: any) => void) + : Query> & QueryHelpers; findOneAndRemove(conditions: any, options: QueryFindOneAndRemoveOptions, callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery & QueryHelpers; @@ -1906,6 +1915,9 @@ declare module "mongoose" { * Issues a mongodb findAndModify update command. * Finds a matching document, updates it according to the update arg, passing any options, and returns * the found document (if any) to the callback. The query executes immediately if callback is passed. + * + * If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify(). + * https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set */ findOneAndUpdate(callback?: (err: any, doc: DocType | null) => void): DocumentQuery & QueryHelpers; findOneAndUpdate(update: any, @@ -1913,8 +1925,15 @@ declare module "mongoose" { findOneAndUpdate(query: any, update: any, callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery & QueryHelpers; findOneAndUpdate(query: any, update: any, - options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions, - callback?: (err: any, doc: DocType, res: any) => void): DocumentQuery & QueryHelpers; + options: { rawResult: true } & { upsert: true } & { new: true } & QueryFindOneAndUpdateOptions, + callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject, res: any) => void) + : Query> & QueryHelpers; + findOneAndUpdate(query: any, update: any, + options: { upsert: true } & { new: true } & QueryFindOneAndUpdateOptions, + callback?: (err: any, doc: DocType, res: any) => void): DocumentQuery & QueryHelpers; + findOneAndUpdate(query: any, update: any, options: { rawResult: true } & QueryFindOneAndUpdateOptions, + callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject, res: any) => void) + : Query> & QueryHelpers; findOneAndUpdate(query: any, update: any, options: QueryFindOneAndUpdateOptions, callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery & QueryHelpers; @@ -2238,12 +2257,21 @@ declare module "mongoose" { class mquery { } interface QueryFindOneAndRemoveOptions { - /** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */ + /** + * if multiple docs are found by the conditions, sets the sort order to choose + * which doc to update + */ sort?: any; /** puts a time limit on the query - requires mongodb >= 2.6.0 */ maxTimeMS?: number; - /** if true, passes the raw result from the MongoDB driver as the third callback parameter */ + /** sets the document fields to return */ + select?: any; + /** like select, it determines which fields to return */ + projection?: any; + /** if true, returns the raw result from the MongoDB driver */ rawResult?: boolean; + /** overwrites the schema's strict mode option for this update */ + strict?: boolean|string; } interface QueryFindOneAndUpdateOptions extends QueryFindOneAndRemoveOptions { @@ -2251,8 +2279,6 @@ declare module "mongoose" { new?: boolean; /** creates the object if it doesn't exist. defaults to false. */ upsert?: boolean; - /** Field selection. Equivalent to .select(fields).findOneAndUpdate() */ - fields?: any | string; /** if true, runs update validators on this command. Update validators validate the update operation against the model's schema. */ runValidators?: boolean; /** @@ -2270,6 +2296,8 @@ declare module "mongoose" { * Turn on this option to aggregate all the cast errors. */ multipleCastError?: boolean; + /** Field selection. Equivalent to .select(fields).findOneAndUpdate() */ + fields?: any | string; } interface QueryUpdateOptions extends ModelUpdateOptions { @@ -2998,17 +3026,21 @@ declare module "mongoose" { * findByIdAndRemove(id, ...) is equivalent to findOneAndRemove({ _id: id }, ...). * Finds a matching document, removes it, passing the found document (if any) to the callback. * Executes immediately if callback is passed, else a Query object is returned. + * + * If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify(). + * https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set + * + * Note: same signatures as findByIdAndDelete + * * @param id value of _id to query by */ findByIdAndRemove(): DocumentQuery & QueryHelpers; findByIdAndRemove(id: any | number | string, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; - findByIdAndRemove(id: any | number | string, options: { - /** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */ - sort?: any; - /** sets the document fields to return */ - select?: any; - }, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; + findByIdAndRemove(id: any | number | string, options: QueryFindOneAndRemoveOptions, + callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject) => void) + : Query> & QueryHelpers; + findByIdAndRemove(id: any | number | string, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; /** @@ -3016,31 +3048,44 @@ declare module "mongoose" { * findByIdAndDelete(id, ...) is equivalent to findByIdAndDelete({ _id: id }, ...). * Finds a matching document, removes it, passing the found document (if any) to the callback. * Executes immediately if callback is passed, else a Query object is returned. + * + * Note: same signatures as findByIdAndRemove + * * @param id value of _id to query by */ - findByIdAndDelete(): DocumentQuery; + findByIdAndDelete(): DocumentQuery & QueryHelpers; findByIdAndDelete(id: any | number | string, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; - findByIdAndDelete(id: any | number | string, options: { - /** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */ - sort?: any; - /** sets the document fields to return */ - select?: any; - }, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; + findByIdAndDelete(id: any | number | string, options: QueryFindOneAndRemoveOptions, + callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject) => void) + : Query> & QueryHelpers; + findByIdAndDelete(id: any | number | string, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; /** * Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...) * is equivalent to findOneAndUpdate({ _id: id }, ...). + * + * If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify(). + * https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set + * * @param id value of _id to query by */ findByIdAndUpdate(): DocumentQuery & QueryHelpers; findByIdAndUpdate(id: any | number | string, update: any, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; findByIdAndUpdate(id: any | number | string, update: any, - options: { upsert: true, new: true } & ModelFindByIdAndUpdateOptions, + options: { rawResult: true } & { upsert: true } & { new: true } & QueryFindOneAndUpdateOptions, callback?: (err: any, res: T) => void): DocumentQuery & QueryHelpers; findByIdAndUpdate(id: any | number | string, update: any, - options: ModelFindByIdAndUpdateOptions, + options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions, + callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject) => void) + : Query> & QueryHelpers; + findByIdAndUpdate(id: any | number | string, update: any, + options: { rawResult : true } & QueryFindOneAndUpdateOptions, + callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject) => void) + : Query> & QueryHelpers; + findByIdAndUpdate(id: any | number | string, update: any, + options: QueryFindOneAndUpdateOptions, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; /** @@ -3059,62 +3104,62 @@ declare module "mongoose" { * Issue a mongodb findAndModify remove command. * Finds a matching document, removes it, passing the found document (if any) to the callback. * Executes immediately if callback is passed else a Query object is returned. + * + * If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify(). + * https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set + * + * Note: same signatures as findOneAndDelete + * */ findOneAndRemove(): DocumentQuery & QueryHelpers; findOneAndRemove(conditions: any, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; - findOneAndRemove(conditions: any, options: { - /** - * if multiple docs are found by the conditions, sets the sort order to choose - * which doc to update - */ - sort?: any; - /** puts a time limit on the query - requires mongodb >= 2.6.0 */ - maxTimeMS?: number; - /** sets the document fields to return */ - select?: any; - }, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; + findOneAndRemove(conditions: any, options: { rawResult: true } & QueryFindOneAndRemoveOptions, + callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject, res: any) => void) + : Query> & QueryHelpers; + findOneAndRemove(conditions: any, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; /** * Issues a mongodb findOneAndDelete command. * Finds a matching document, removes it, passing the found document (if any) to the * callback. Executes immediately if callback is passed. + * + * Note: same signatures as findOneAndRemove + * */ findOneAndDelete(): DocumentQuery & QueryHelpers; findOneAndDelete(conditions: any, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; - findOneAndDelete(conditions: any, options: { - /** - * if multiple docs are found by the conditions, sets the sort order to choose - * which doc to update - */ - sort?: any; - /** puts a time limit on the query - requires mongodb >= 2.6.0 */ - maxTimeMS?: number; - /** sets the document fields to return */ - select?: any; - /** like select, it determines which fields to return */ - projection?: any; - /** if true, returns the raw result from the MongoDB driver */ - rawResult?: boolean; - /** overwrites the schema's strict mode option for this update */ - strict?: boolean|string; - }, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; + findOneAndDelete(conditions: any, options: { rawResult: true } & QueryFindOneAndRemoveOptions, + callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject, res: any) => void) + : Query> & QueryHelpers; + findOneAndDelete(conditions: any, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery & QueryHelpers; /** * Issues a mongodb findAndModify update command. * Finds a matching document, updates it according to the update arg, passing any options, * and returns the found document (if any) to the callback. The query executes immediately * if callback is passed else a Query object is returned. + * ++ * If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than the deprecated findAndModify(). ++ * https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set */ findOneAndUpdate(): DocumentQuery & QueryHelpers; findOneAndUpdate(conditions: any, update: any, callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery & QueryHelpers; findOneAndUpdate(conditions: any, update: any, - options: { upsert: true, new: true } & ModelFindOneAndUpdateOptions, + options: { rawResult : true } & { upsert: true, new: true } & QueryFindOneAndUpdateOptions, + callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject, res: any) => void) + : Query> & QueryHelpers; + findOneAndUpdate(conditions: any, update: any, + options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions, callback?: (err: any, doc: T, res: any) => void): DocumentQuery & QueryHelpers; findOneAndUpdate(conditions: any, update: any, - options: ModelFindOneAndUpdateOptions, + options: { rawResult: true } & QueryFindOneAndUpdateOptions, + callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject, res: any) => void) + : Query> & QueryHelpers; + findOneAndUpdate(conditions: any, update: any, + options: QueryFindOneAndUpdateOptions, callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery & QueryHelpers; /** @@ -3308,43 +3353,6 @@ declare module "mongoose" { session?: ClientSession | null; } - interface ModelFindByIdAndUpdateOptions extends ModelOptions { - /** true to return the modified document rather than the original. defaults to false */ - new?: boolean; - /** creates the object if it doesn't exist. defaults to false. */ - upsert?: boolean; - /** - * if true, runs update validators on this command. Update validators validate the - * update operation against the model's schema. - */ - runValidators?: boolean; - /** - * if this and upsert are true, mongoose will apply the defaults specified in the model's - * schema if a new document is created. This option only works on MongoDB >= 2.4 because - * it relies on MongoDB's $setOnInsert operator. - */ - setDefaultsOnInsert?: boolean; - /** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */ - sort?: any; - /** sets the document fields to return */ - select?: any; - /** if true, passes the raw result from the MongoDB driver as the third callback parameter */ - rawResult?: boolean; - /** overwrites the schema's strict mode option for this update */ - strict?: boolean; - /** The context option lets you set the value of this in update validators to the underlying query. */ - context?: string; - } - - interface ModelFindOneAndUpdateOptions extends ModelFindByIdAndUpdateOptions { - /** Field selection. Equivalent to .select(fields).findOneAndUpdate() */ - fields?: any | string; - /** puts a time limit on the query - requires mongodb >= 2.6.0 */ - maxTimeMS?: number; - /** if true, passes the raw result from the MongoDB driver as the third callback parameter */ - rawResult?: boolean; - } - interface ModelPopulateOptions { /** space delimited path(s) to populate */ path: string; diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index 6d487dd14d..6eda6d5eb0 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -1021,7 +1021,7 @@ query.findOne(function (err, res) { query.findOneAndRemove({name: 'aa'}, { rawResult: true }, function (err, doc) { - doc.execPopulate(); + doc.lastErrorObject }).findOneAndRemove(); query.findOneAndUpdate({name: 'aa'}, {name: 'bb'}, { @@ -1911,6 +1911,14 @@ LocModel.findOneAndUpdate().exec().then(function (arg) { arg.openingTimes; } }); +LocModel.findOneAndUpdate( + // find a document with that filter + {name: "aa"}, + // document to insert when nothing was found + { $set: {name: "bb"} }, + // options + {upsert: true, new: true, runValidators: true, + rawResult: true, multipleCastError: true }); LocModel.geoSearch({}, { near: [1, 2], maxDistance: 22 diff --git a/types/moveto/index.d.ts b/types/moveto/index.d.ts index f9734ee184..729f70bd78 100644 --- a/types/moveto/index.d.ts +++ b/types/moveto/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for moveto 1.7 +// Type definitions for moveto 1.8 // Project: https://github.com/hsnaydd/moveTo // Definitions by: Rostislav Shermenyov +// pea3nut // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare class MoveTo { @@ -66,6 +67,10 @@ declare namespace MoveTo { * Ease function name */ easing?: string; + /** + * The container been computed and scrolled + */ + container?: Window | HTMLElement; /** * The function to be run after scrolling complete. Target passes as the first argument */ diff --git a/types/moveto/moveto-tests.ts b/types/moveto/moveto-tests.ts index 325cb57f3c..ea65854f25 100644 --- a/types/moveto/moveto-tests.ts +++ b/types/moveto/moveto-tests.ts @@ -2,6 +2,7 @@ const options: MoveTo.MoveToOptions = { tolerance: 70, duration: 300, easing: "easeOutQuart", + container: Math.random() > 0.5 ? window : document.createElement('div'), callback: () => {} }; diff --git a/types/mumath/index.d.ts b/types/mumath/index.d.ts new file mode 100644 index 0000000000..8967bafa4f --- /dev/null +++ b/types/mumath/index.d.ts @@ -0,0 +1,63 @@ +// Type definitions for mumath 3.3 +// Project: https://github.com/dfcreative/mumath +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +/** + * Detects proper clamp min/max. + */ +export function clamp(value: number, left: number, right: number): number; + +/** + * Get closest value out of a set. + */ +export function closest(value: number, list: number[]): number; + +/** + * Check if one number is multiple of other + * Same as a % b === 0, but with precision check. + */ +export function isMultiple(a: number, b: number, eps?: number): boolean; + +/** + * Return quadratic length of a vector. + */ +export function len(a: number, b: number): number; + +/** + * Return value interpolated between x and y. + */ +export function lerp(x: number, y: number, ratio: number): number; + +/** + * An enhanced mod-loop, like fmod — loops value within a frame. + */ +export function mod(value: number, max: number, min?: number): number; + +/** + * Get order of magnitude for a number. + */ +export function order(value: number): number; + +/** + * Get precision from float: + */ +export function precision(value: number): number; + +/** + * Rounds value to optional step. + */ +export function round(value: number, step?: number): number; + +/** + * Get first scale out of a list of basic scales, aligned to the power. E. g. + * step(.37, [1, 2, 5]) → .5 step(456, [1, 2]) → 1000 + * Similar to closest, but takes all possible powers of scales. + */ +export function scale(value: number, list: number[]): number; + +/** + * Whether element is between left & right, including. + */ +export function within(value: number, left: number, right: number): number; diff --git a/types/mumath/mumath-tests.ts b/types/mumath/mumath-tests.ts new file mode 100644 index 0000000000..c0fed04336 --- /dev/null +++ b/types/mumath/mumath-tests.ts @@ -0,0 +1,25 @@ +import * as mumath from "mumath"; + +mumath.clamp(1, 2, 3); + +mumath.closest(5, [1, 7, 3, 6, 10]); + +mumath.isMultiple(5, 10, 1.000074); +mumath.isMultiple(5, 10); + +mumath.len(15, 1.0); + +mumath.lerp(1, 2, 3); + +mumath.mod(1, 2, 3); +mumath.mod(1, 2); + +mumath.order(5); + +mumath.precision(5.0000001); + +mumath.round(0.3, 0.5); + +mumath.scale(5.93, [1.0, 35, 10, 7.135]); + +mumath.within(5, 1, 10); diff --git a/types/mumath/tsconfig.json b/types/mumath/tsconfig.json new file mode 100644 index 0000000000..67aa9c2b29 --- /dev/null +++ b/types/mumath/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mumath-tests.ts" + ] +} diff --git a/types/mumath/tslint.json b/types/mumath/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/mumath/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/nanoid/nanoid-tests.ts b/types/nanoid/nanoid-tests.ts index e026ec0659..8783d1b61f 100644 --- a/types/nanoid/nanoid-tests.ts +++ b/types/nanoid/nanoid-tests.ts @@ -6,6 +6,8 @@ import randomBrowser = require('nanoid/random-browser'); import url = require('nanoid/url'); import nanoidAsync = require('nanoid/async'); import nanoidAsyncBrowser = require('nanoid/async-browser'); +import nanoidNonSecure = require('nanoid/non-secure'); +import generateNonSecure = require('nanoid/non-secure/generate'); const _random = (size: number) => [1, 2, 3, 4]; @@ -22,5 +24,9 @@ nanoidAsync(null, (error, id) => { }); nanoidAsyncBrowser().then((id) => console.log(id)); nanoidAsyncBrowser(10).then((id) => console.log(id)); +nanoidNonSecure(); +nanoidNonSecure(10); +generateNonSecure('0123456789абвгдеё', 5); +generateNonSecure('0123456789абвгдеё'); console.log(url); diff --git a/types/nanoid/non-secure/generate.d.ts b/types/nanoid/non-secure/generate.d.ts new file mode 100644 index 0000000000..c7fac1dfef --- /dev/null +++ b/types/nanoid/non-secure/generate.d.ts @@ -0,0 +1,19 @@ +/** + * Generate URL-friendly unique ID. This method use non-secure predictable + * random generator. + * + * By default, ID will have 21 symbols to have a collision probability similar + * to UUID v4. + * + * @param alphabet Symbols to be used in ID. + * @param [size=21] The number of symbols in ID. + * + * @return Random string. + * + * @example + * const nanoid = require('nanoid/non-secure') + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + */ +declare function generate(alphabet: string, size?: number): string; + +export = generate; diff --git a/types/nanoid/non-secure/index.d.ts b/types/nanoid/non-secure/index.d.ts new file mode 100644 index 0000000000..d3cd25d817 --- /dev/null +++ b/types/nanoid/non-secure/index.d.ts @@ -0,0 +1,18 @@ +/** + * Generate URL-friendly unique ID. This method use non-secure predictable + * random generator. + * + * By default, ID will have 21 symbols to have a collision probability similar + * to UUID v4. + * + * @param [size=21] The number of symbols in ID. + * + * @return Random string. + * + * @example + * const nanoid = require('nanoid/non-secure') + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + */ +declare function nanoid(size?: number): string; + +export = nanoid; diff --git a/types/nanoid/tsconfig.json b/types/nanoid/tsconfig.json index 1051097a89..1c64d18467 100644 --- a/types/nanoid/tsconfig.json +++ b/types/nanoid/tsconfig.json @@ -17,6 +17,8 @@ "strictFunctionTypes": true }, "files": [ + "non-secure/index.d.ts", + "non-secure/generate.d.ts", "async-browser.d.ts", "async.d.ts", "format.d.ts", diff --git a/types/next-server/dynamic.d.ts b/types/next-server/dynamic.d.ts index 2d06273bd5..61847c2d3c 100644 --- a/types/next-server/dynamic.d.ts +++ b/types/next-server/dynamic.d.ts @@ -7,9 +7,9 @@ import { type Omit = Pick>; -type AsyncComponent

= Promise>; +type AsyncComponent

= Promise | { default: React.ComponentType

}>; type AsyncComponentLoader

= () => AsyncComponent

; -type ModuleMapping = Record; +type ModuleMapping = Record; type LoadedModuleMapping = Record; interface NextDynamicOptions

extends Omit { @@ -31,10 +31,10 @@ type DynamicComponent

= React.ComponentType

& LoadableComponent; * https://github.com/zeit/next.js/blob/7.0.0/lib/dynamic.js#L55 */ declare function dynamic

( - options: AsyncComponentLoader

| AsyncComponent

| NextDynamicOptions

+ asyncModuleOrOptions: AsyncComponentLoader

| AsyncComponent

| NextDynamicOptions

): DynamicComponent

; declare function dynamic

( - asyncModule: AsyncComponent

, + asyncModule: AsyncComponentLoader

| AsyncComponent

, options: NextDynamicOptions

): DynamicComponent

; diff --git a/types/next-server/test/imports/no-default.tsx b/types/next-server/test/imports/no-default.tsx new file mode 100644 index 0000000000..1f406a3fe3 --- /dev/null +++ b/types/next-server/test/imports/no-default.tsx @@ -0,0 +1,7 @@ +import * as React from "react"; + +interface Props { + foo: string; +} + +export const MyComponent: React.SFC = ({ foo: text }) => {text}; diff --git a/types/next-server/test/imports/with-default.tsx b/types/next-server/test/imports/with-default.tsx new file mode 100644 index 0000000000..f448a16680 --- /dev/null +++ b/types/next-server/test/imports/with-default.tsx @@ -0,0 +1,11 @@ +import * as React from "react"; + +interface Props { + foo: boolean; +} + +export default class MyComponent extends React.Component { + render() { + return this.props.foo ?

: null; + } +} diff --git a/types/next-server/test/next-server-dynamic-tests.tsx b/types/next-server/test/next-server-dynamic-tests.tsx index 07844cad08..ae4297e189 100644 --- a/types/next-server/test/next-server-dynamic-tests.tsx +++ b/types/next-server/test/next-server-dynamic-tests.tsx @@ -1,12 +1,7 @@ import * as React from "react"; import dynamic, { LoadingComponentProps } from "next-server/dynamic"; -// You'd typically do this via import('./MyComponent') -interface MyComponentProps { - foo: string; -} -const MyComponent: React.StatelessComponent = () =>
I'm async!
; -const asyncComponent = Promise.resolve(MyComponent); +const asyncComponent = import('./imports/with-default'); // Examples from // https://github.com/zeit/next.js/#dynamic-import @@ -17,30 +12,31 @@ const LoadingComponent: React.StatelessComponent = ({ }) =>

loading...

; // 1. Basic Usage (Also does SSR) -const DynamicComponent = dynamic(asyncComponent); -const dynamicComponentJSX = ; +const Test1 = dynamic(asyncComponent); +const test1JSX = ; // 1.1 Basic Usage (Loader function) -const DynamicComponent2 = dynamic(() => asyncComponent); -const dynamicComponent2JSX = ; +const Test1Func = dynamic(() => asyncComponent); +const test1FuncJSX = ; -// 2. With Custom Loading Component -const DynamicComponentWithCustomLoading = dynamic(asyncComponent, { - loading: LoadingComponent -}); -const dynamicComponentWithCustomLoadingJSX = ; - -// 3. With No SSR -const DynamicComponentWithNoSSR = dynamic(asyncComponent, { +// 2. With Custom Options +const Test2 = dynamic(() => asyncComponent, { + loading: LoadingComponent, ssr: false }); +const test2JSX = ; // 4. With Multiple Modules At Once -const HelloBundle = dynamic({ +// TODO: Mapped components still doesn't infer their props. +interface BundleComponentProps { + foo: string; +} + +const HelloBundle = dynamic({ modules: () => { const components = { - Hello1: asyncComponent, - Hello2: asyncComponent + Hello1: () => asyncComponent, + Hello2: () => asyncComponent }; return components; @@ -64,6 +60,6 @@ const LoadableComponent = dynamic({ }); // 6. No loading -const DynamicComponentWithNoLoading = dynamic(asyncComponent, { +const DynamicComponentWithNoLoading = dynamic(() => asyncComponent, { loading: () => null }); diff --git a/types/next-server/tsconfig.json b/types/next-server/tsconfig.json index 4d72dadef2..f05382ea65 100644 --- a/types/next-server/tsconfig.json +++ b/types/next-server/tsconfig.json @@ -33,6 +33,8 @@ "test/next-server-head-tests.tsx", "test/next-server-link-tests.tsx", "test/next-server-dynamic-tests.tsx", - "test/next-server-router-tests.tsx" + "test/next-server-router-tests.tsx", + "test/imports/no-default.tsx", + "test/imports/with-default.tsx" ] } diff --git a/types/next/test/next-constants-tests.ts b/types/next/test/next-constants-tests.ts deleted file mode 100644 index 64413ea97c..0000000000 --- a/types/next/test/next-constants-tests.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { - PHASE_DEVELOPMENT_SERVER, - IS_BUNDLED_PAGE_REGEX -} from "next/constants"; - -const isIndexPage = IS_BUNDLED_PAGE_REGEX.test( - "static/CjW0mFnyG80HdP4eSUiy7/pages/index.js" -); - -// Example taken from: https://github.com/cyrilwanner/next-compose-plugins/blob/a25b313899638912cc9defc0be072f4fe4a1e855/README.md -const config = (nextConfig: any = {}) => { - return { - ...nextConfig, - - // define in which phases this plugin should get applied. - // you can also use multiple phases or negate them. - // however, users can still overwrite them in their configuration if they really want to. - phases: [PHASE_DEVELOPMENT_SERVER], - - webpack(config: any, options: any) { - // do something here which only gets applied during development server phase - - if (typeof nextConfig.webpack === "function") { - return nextConfig.webpack(config, options); - } - - return config; - } - }; -}; diff --git a/types/next/test/next-dynamic-tests.tsx b/types/next/test/next-dynamic-tests.tsx deleted file mode 100644 index 3e929e5cd0..0000000000 --- a/types/next/test/next-dynamic-tests.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import * as React from "react"; -import dynamic, { LoadingComponentProps } from "next/dynamic"; - -// You'd typically do this via import('./MyComponent') -interface MyComponentProps { - foo: string; -} -const MyComponent: React.FunctionComponent = () =>
I'm async!
; -const asyncComponent = Promise.resolve(MyComponent); - -// Examples from -// https://github.com/zeit/next.js/#dynamic-import - -const LoadingComponent: React.StatelessComponent = ({ - isLoading, - error -}) =>

loading...

; - -// 1. Basic Usage (Also does SSR) -const DynamicComponent = dynamic(asyncComponent); -const dynamicComponentJSX = ; - -// 2. With Custom Loading Component -const DynamicComponentWithCustomLoading = dynamic(asyncComponent, { - loading: LoadingComponent -}); -const dynamicComponentWithCustomLoadingJSX = ; - -// 3. With No SSR -const DynamicComponentWithNoSSR = dynamic(asyncComponent, { - ssr: false -}); - -// 4. With Multiple Modules At Once -const HelloBundle = dynamic({ - modules: () => { - const components = { - Hello1: asyncComponent, - Hello2: asyncComponent - }; - - return components; - }, - render: (props, { Hello1, Hello2 }) => ( -
-

{props.foo}

- - -
- ) -}); -const helloBundleJSX = ; - -// 5. With plain Loadable options -const LoadableComponent = dynamic({ - loader: () => asyncComponent, - loading: LoadingComponent, - delay: 200, - timeout: 10000 -}); - -// 6. No loading -const DynamicComponentWithNoLoading = dynamic(asyncComponent, { - loading: () => null -}); diff --git a/types/next/test/next-head-tests.tsx b/types/next/test/next-head-tests.tsx deleted file mode 100644 index 735402ca9a..0000000000 --- a/types/next/test/next-head-tests.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import Head, * as head from "next/head"; -import * as React from "react"; - -const elements: JSX.Element[] = head.defaultHead(); -const jsx = {elements}; - -if (!Head.canUseDOM) { - Head.rewind().map(x => [x.key, x.props, x.type]); -} - -Head.peek().map(x => [x.key, x.props, x.type]); diff --git a/types/next/test/next-link-tests.tsx b/types/next/test/next-link-tests.tsx deleted file mode 100644 index 2a85fec1ad..0000000000 --- a/types/next/test/next-link-tests.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import Link from "next/link"; -import * as React from "react"; - -const links = ( -
- { - console.log("Handled error!", e); - }} - prefetch - replace - scroll - shallow - > - Gotta link to somewhere! - - - All props are optional! - -
-); diff --git a/types/next/test/next-router-tests.tsx b/types/next/test/next-router-tests.tsx deleted file mode 100644 index b06c1ad3a7..0000000000 --- a/types/next/test/next-router-tests.tsx +++ /dev/null @@ -1,110 +0,0 @@ -import Router, { withRouter, WithRouterProps } from "next/router"; -import * as React from "react"; -import * as qs from "querystring"; - -Router.readyCallbacks.push(() => { - console.log("I'll get called when the router initializes."); -}); -Router.ready(() => { - console.log( - "I'll get called immediately if the router initializes, or when it eventually does.", - ); -}); - -// Access readonly properties of the router. - -Object.keys(Router.components).forEach(key => { - const c = Router.components[key]; - c.err.isAnAny; - - return ; -}); - -function split(routeLike: string) { - routeLike.split("/").forEach(part => { - console.log("path part: ", part); - }); -} - -if (Router.asPath) { - split(Router.asPath); - split(Router.asPath); -} - -split(Router.pathname); - -const query = `?${qs.stringify(Router.query)}`; - -// Assign some callback methods. -Router.events.on('routeChangeStart', (url: string) => console.log("Route is starting to change.", url)); -Router.events.on('beforeHistoryChange', (as: string) => console.log("History hasn't changed yet.", as)); -Router.events.on('routeChangeComplete', (url: string) => console.log("Route change is complete.", url)); -Router.events.on('routeChangeError', (err: any, url: string) => console.log("Route change errored.", err, url)); - -// Call methods on the router itself. -Router.reload("/route").then(() => console.log("route was reloaded")); -Router.back(); -Router.beforePopState(({ url }) => !!url); - -Router.push("/route").then((success: boolean) => - console.log("route push success: ", success), -); -Router.push("/route", "/asRoute").then((success: boolean) => - console.log("route push success: ", success), -); -Router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) => - console.log("route push success: ", success), -); - -Router.replace("/route").then((success: boolean) => - console.log("route replace success: ", success), -); -Router.replace("/route", "/asRoute").then((success: boolean) => - console.log("route replace success: ", success), -); -Router.replace("/route", "/asRoute", { - shallow: false, -}).then((success: boolean) => console.log("route replace success: ", success)); - -Router.prefetch("/route").then(Component => { - const element = ; -}); - -interface TestComponentProps { - testValue: string; -} - -class TestComponent extends React.Component { - state = { ready: false }; - - constructor(props: TestComponentProps & WithRouterProps) { - super(props); - if (props.router) { - props.router.ready(() => { - this.setState({ ready: true }); - }); - } - } - - render() { - return ( -
-

{this.state.ready ? 'Ready' : 'Not Ready'}

-

Route: {this.props.router ? this.props.router.route : ""}

-

Another prop: {this.props.testValue}

-
- ); - } -} - -withRouter(TestComponent); - -interface TestFCQuery { - test?: string; -} - -interface TestFCProps extends WithRouterProps { } - -const TestFC: React.FunctionComponent = ({ router }) => { - return
{router && router.query && router.query.test}
; -}; diff --git a/types/next/tsconfig.json b/types/next/tsconfig.json index 9981affbd3..41f6efc969 100644 --- a/types/next/tsconfig.json +++ b/types/next/tsconfig.json @@ -30,14 +30,9 @@ "router.d.ts", "config.d.ts", "test/next-tests.ts", - "test/next-constants-tests.ts", "test/next-app-tests.tsx", "test/next-error-tests.tsx", - "test/next-head-tests.tsx", "test/next-document-tests.tsx", - "test/next-link-tests.tsx", - "test/next-dynamic-tests.tsx", - "test/next-router-tests.tsx", "test/next-component-tests.tsx" ] } diff --git a/types/node-cache/index.d.ts b/types/node-cache/index.d.ts index 6bac061ecb..61100a574d 100644 --- a/types/node-cache/index.d.ts +++ b/types/node-cache/index.d.ts @@ -283,3 +283,4 @@ declare class NodeCache extends events.EventEmitter implements NodeCache.NodeCac } export = NodeCache; +export as namespace NodeCache; diff --git a/types/node-sass-middleware/index.d.ts b/types/node-sass-middleware/index.d.ts index badbd843d1..53cde2a10a 100644 --- a/types/node-sass-middleware/index.d.ts +++ b/types/node-sass-middleware/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/sass/node-sass-middleware // Definitions by: Pascal Garber // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.7 diff --git a/types/node-sass/index.d.ts b/types/node-sass/index.d.ts index b208b57f19..f5445689b4 100644 --- a/types/node-sass/index.d.ts +++ b/types/node-sass/index.d.ts @@ -1,56 +1,410 @@ -// Type definitions for Node Sass v3.10.1 +// Type definitions for node-sass 4.11 // Project: https://github.com/sass/node-sass -// Definitions by: Asana +// Definitions by: Asana , Chris Eppstein // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 /// -type ImporterReturnType = { file: string } | { contents: string } | Error | null; +export type ImporterReturnType = { file: string } | { file?: string; contents: string } | Error | null | types.Null | types.Error; -interface Importer { - (url: string, prev: string, done: (data: ImporterReturnType) => void): ImporterReturnType | void; +/** + * The context value is a value that is shared for the duration of a single render. + * The context object is the implicit `this` for importers and sass functions + * that are implemented in javascript. + * + * A render can be detected as asynchronous if the `callback` property is set on the context object. + */ +export interface Context { + options: Options; + callback: SassRenderCallback | undefined; + [data: string]: any; } -interface Options { - file?: string; - data?: string; - importer?: Importer | Importer[]; - functions?: { [key: string]: Function }; - includePaths?: string[]; - indentedSyntax?: boolean; - indentType?: string; - indentWidth?: number; - linefeed?: string; - omitSourceMapUrl?: boolean; - outFile?: string; - outputStyle?: "compact" | "compressed" | "expanded" | "nested"; - precision?: number; - sourceComments?: boolean; - sourceMap?: boolean | string; - sourceMapContents?: boolean; - sourceMapEmbed?: boolean; - sourceMapRoot?: string; +export interface AsyncContext extends Context { + callback: SassRenderCallback; } -interface SassError extends Error { - message: string; - line: number; - column: number; - status: number; - file: string; +export interface SyncContext extends Context { + callback: undefined; } -interface Result { - css: Buffer; - map: Buffer; - stats: { - entry: string; - start: number; - end: number; - duration: number; - includedFiles: string[]; - } +export type AsyncImporter = (this: AsyncContext, url: string, prev: string, done: (data: ImporterReturnType) => void) => void; +export type SyncImporter = (this: SyncContext, url: string, prev: string) => ImporterReturnType; +export type Importer = AsyncImporter | SyncImporter; + +// These function types enumerate up to 6 js arguments. More than that will be incorrectly marked by the compiler as an error. + +// ** Sync Sass functions receiving fixed # of arguments *** +export type SyncSassFn = (this: SyncContext, ...$args: types.Value[]) => types.ReturnValue; + +/* tslint:disable:max-line-length */ +// ** Sync Sass functions receiving variable # of arguments *** +export type SyncSassVarArgFn1 = (this: SyncContext, $arg1: types.Value[]) => types.ReturnValue; +export type SyncSassVarArgFn2 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value[]) => types.ReturnValue; +export type SyncSassVarArgFn3 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value[]) => types.ReturnValue; +export type SyncSassVarArgFn4 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value[]) => types.ReturnValue; +export type SyncSassVarArgFn5 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value[]) => types.ReturnValue; +export type SyncSassVarArgFn6 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: types.Value[]) => types.ReturnValue; + +export type SassFunctionCallback = ($result: types.ReturnValue) => void; + +// ** Async Sass functions receiving fixed # of arguments *** +export type AsyncSassFn0 = (this: AsyncContext, cb: SassFunctionCallback) => void; +export type AsyncSassFn1 = (this: AsyncContext, $arg1: types.Value, cb: SassFunctionCallback) => void; +export type AsyncSassFn2 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, cb: SassFunctionCallback) => void; +export type AsyncSassFn3 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, cb: SassFunctionCallback) => void; +export type AsyncSassFn4 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, cb: SassFunctionCallback) => void; +export type AsyncSassFn5 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, cb: SassFunctionCallback) => void; +export type AsyncSassFn6 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: types.Value, cb: SassFunctionCallback) => void; + +// *** Async Sass Functions receiving variable # of arguments *** +export type AsyncSassVarArgFn1 = (this: AsyncContext, $arg1: types.Value[], cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn2 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value[], cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn3 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value[], cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn4 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value[], cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn5 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value[], cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn6 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: types.Value[], cb: SassFunctionCallback) => void; +/* tslint:enable:max-line-length */ + +export type SyncSassFunction = SyncSassFn | SyncSassVarArgFn1 | SyncSassVarArgFn2 | SyncSassVarArgFn3 | SyncSassVarArgFn4 | SyncSassVarArgFn5 | SyncSassVarArgFn6; + +export type AsyncSassFunction = AsyncSassFn0 | AsyncSassFn1 | AsyncSassFn2 | AsyncSassFn3 | AsyncSassFn4 | AsyncSassFn5 | AsyncSassFn6 + | AsyncSassVarArgFn1 | AsyncSassVarArgFn2 | AsyncSassVarArgFn3 | AsyncSassVarArgFn4 | AsyncSassVarArgFn5 | AsyncSassVarArgFn6; + +export type SassFunction = SyncSassFunction | AsyncSassFunction; + +export type FunctionDeclarations = Record; + +export interface Options { + file?: string; + data?: string; + importer?: Importer | Importer[]; + functions?: FunctionDeclarations; + includePaths?: string[]; + indentedSyntax?: boolean; + indentType?: string; + indentWidth?: number; + linefeed?: string; + omitSourceMapUrl?: boolean; + outFile?: string; + outputStyle?: "compact" | "compressed" | "expanded" | "nested"; + precision?: number; + sourceComments?: boolean; + sourceMap?: boolean | string; + sourceMapContents?: boolean; + sourceMapEmbed?: boolean; + sourceMapRoot?: string; + [key: string]: any; } -export declare function render(options: Options, callback: (err: SassError, result: Result) => any): void; -export declare function renderSync(options: Options): Result; +export interface SyncOptions extends Options { + functions?: FunctionDeclarations; + importer?: SyncImporter | SyncImporter[]; +} + +/** + * The error object returned to javascript by sass's render methods. + * + * This is not the same thing as types.Error. + */ +export interface SassError extends Error { + message: string; + line: number; + column: number; + status: number; + file: string; +} + +/** + * The result of successfully compiling a Sass file. + */ +export interface Result { + css: Buffer; + map: Buffer; + stats: { + entry: string; + start: number; + end: number; + duration: number; + includedFiles: string[]; + }; +} +export type SassRenderCallback = (err: SassError, result: Result) => any; + +// Note, most node-sass constructors can be invoked as a function or with a new +// operator. The exception: the types Null and Boolean for which new is +// forbidden. +// +// Because of this, the new-able object notation is used here, a class does not +// work for these types. +export namespace types { + /* eslint-disable @typescript-eslint/ban-types */ + /* tslint:disable:ban-types */ + /** + * Values that are received from Sass as an argument to a javascript function. + */ + export type Value = Null | Number | String | Color | Boolean | List | Map; + + /** + * Values that are legal to return to Sass from a javascript function. + */ + export type ReturnValue = Value | Error; + + // *** Sass Null *** + + export interface Null { + /** + * This property doesn't exist, but its presence forces the typescript + * compiler to properly type check this type. Without it, it seems to + * allow things that aren't types.Null to match it in case statements and + * assignments. + */ + readonly ___NULL___: unique symbol; + } + + interface NullConstructor { + (): Null; + NULL: Null; + } + export const Null: NullConstructor; + + // *** Sass Number *** + + export interface Number { + getValue(): number; + setValue(n: number): void; + getUnit(): string; + setUnit(u: string): void; + } + interface NumberConstructor { + /** + * Constructs a new Sass number. Does not require use of the `new` keyword. + */ + new(value: number, unit?: string): Number; + /** + * Constructs a new Sass number. Can also be used with the `new` keyword. + */ + (value: number, unit?: string): Number; + } + + export const Number: NumberConstructor; + + // *** Sass String *** + + export interface String { + getValue(): string; + setValue(s: string): void; + } + + interface StringConstructor { + /** + * Constructs a new Sass string. Does not require use of the `new` keyword. + */ + new (value: string): String; + /** + * Constructs a new Sass string. Can also be used with the `new` keyword. + */ + (value: string): String; + } + + export const String: StringConstructor; + + // *** Sass Color *** + + export interface Color { + /** + * Get the red component of the color. + * @returns integer between 0 and 255 inclusive; + */ + getR(): number; + /** + * Set the red component of the color. + * @returns integer between 0 and 255 inclusive; + */ + setR(r: number): void; + /** + * Get the green component of the color. + * @returns integer between 0 and 255 inclusive; + */ + getG(): number; + /** + * Set the green component of the color. + * @param g integer between 0 and 255 inclusive; + */ + setG(g: number): void; + /** + * Get the blue component of the color. + * @returns integer between 0 and 255 inclusive; + */ + getB(): number; + /** + * Set the blue component of the color. + * @param b integer between 0 and 255 inclusive; + */ + setB(b: number): void; + /** + * Get the alpha transparency component of the color. + * @returns number between 0 and 1 inclusive; + */ + getA(): number; + /** + * Set the alpha component of the color. + * @param a number between 0 and 1 inclusive; + */ + setA(a: number): void; + } + + interface ColorConstructor { + /** + * Constructs a new Sass color given the RGBA component values. Do not invoke with the `new` keyword. + * + * @param r integer 0-255 inclusive + * @param g integer 0-255 inclusive + * @param b integer 0-255 inclusive + * @param [a] float 0 - 1 inclusive + * @returns a SassColor instance. + */ + new (r: number, g: number, b: number, a?: number): Color; + + /** + * Constructs a new Sass color given a 4 byte number. Do not invoke with the `new` keyword. + * + * If a single number is passed it is assumed to be a number that contains + * all the components which are extracted using bitmasks and bitshifting. + * + * @param hexN A number that is usually written in hexadecimal form. E.g. 0xff0088cc. + * @returns a Sass Color instance. + * @example + * // Comparison with byte array manipulation + * let a = new ArrayBuffer(4); + * let hexN = 0xCCFF0088; // 0xAARRGGBB + * let a32 = new Uint32Array(a); // Uint32Array [ 0 ] + * a32[0] = hexN; + * let a8 = new Uint8Array(a); // Uint8Array [ 136, 0, 255, 204 ] + * let componentBytes = [a8[2], a8[1], a8[0], a8[3] / 255] // [ 136, 0, 255, 0.8 ] + * let c = sass.types.Color(hexN); + * let components = [c.getR(), c.getG(), c.getR(), c.getA()] // [ 136, 0, 255, 0.8 ] + * assert.deepEqual(componentBytes, components); // does not raise. + */ + new (hexN: number): Color; + + /** + * Constructs a new Sass color given the RGBA component values. Do not invoke with the `new` keyword. + * + * @param r integer 0-255 inclusive + * @param g integer 0-255 inclusive + * @param b integer 0-255 inclusive + * @param [a] float 0 - 1 inclusive + * @returns a SassColor instance. + */ + (r: number, g: number, b: number, a?: number): Color; + + /** + * Constructs a new Sass color given a 4 byte number. Do not invoke with the `new` keyword. + * + * If a single number is passed it is assumed to be a number that contains + * all the components which are extracted using bitmasks and bitshifting. + * + * @param hexN A number that is usually written in hexadecimal form. E.g. 0xff0088cc. + * @returns a Sass Color instance. + * @example + * // Comparison with byte array manipulation + * let a = new ArrayBuffer(4); + * let hexN = 0xCCFF0088; // 0xAARRGGBB + * let a32 = new Uint32Array(a); // Uint32Array [ 0 ] + * a32[0] = hexN; + * let a8 = new Uint8Array(a); // Uint8Array [ 136, 0, 255, 204 ] + * let componentBytes = [a8[2], a8[1], a8[0], a8[3] / 255] // [ 136, 0, 255, 0.8 ] + * let c = sass.types.Color(hexN); + * let components = [c.getR(), c.getG(), c.getR(), c.getA()] // [ 136, 0, 255, 0.8 ] + * assert.deepEqual(componentBytes, components); // does not raise. + */ + (hexN: number): Color; + } + + export const Color: ColorConstructor; + + // *** Sass Boolean *** + + export interface Boolean { + getValue(): boolean; + } + + interface BooleanConstructor { + (bool: boolean): Boolean; + TRUE: Boolean; + FALSE: Boolean; + } + + export const Boolean: BooleanConstructor; + + // *** Sass List *** + + export interface Enumerable { + getValue(index: number): Value; + setValue(index: number, value: Value): void; + getLength(): number; + } + + export interface List extends Enumerable { + getSeparator(): boolean; + setSeparator(isComma: boolean): void; + } + interface ListConstructor { + new (length: number, commaSeparator?: boolean): List; + (length: number, commaSeparator?: boolean): List; + } + export const List: ListConstructor; + + // *** Sass Map *** + + export interface Map extends Enumerable { + getKey(index: number): Value; + setKey(index: number, key: Value): void; + } + interface MapConstructor { + new (length: number): Map; + (length: number): Map; + } + export const Map: MapConstructor; + + // *** Sass Error *** + + export interface Error { + /** + * This property doesn't exist, but its presence forces the typescript + * compiler to properly type check this type. Without it, it seems to + * allow things that aren't types.Error to match it in case statements and + * assignments. + */ + readonly ___SASS_ERROR___: unique symbol; + // why isn't there a getMessage() method? + } + + interface ErrorConstructor { + /** + * An error return value for async functions. + * For synchronous functions, this can be returned or a standard error object can be thrown. + */ + new (message: string): Error; + /** + * An error return value for async functions. + * For synchronous functions, this can be returned or a standard error object can be thrown. + */ + (message: string): Error; + } + export const Error: ErrorConstructor; + + /* eslint-enable @typescript-eslint/ban-types */ + /* tslint:enable:ban-types */ +} + +// *** Top level Constants *** + +export const NULL: types.Null; +export const TRUE: types.Boolean; +export const FALSE: types.Boolean; +export const info: string; +export function render(options: Options, callback: SassRenderCallback): void; +export function renderSync(options: SyncOptions): Result; diff --git a/types/node-sass/node-sass-tests.ts b/types/node-sass/node-sass-tests.ts index 4de32d7d06..e8ae73cef7 100644 --- a/types/node-sass/node-sass-tests.ts +++ b/types/node-sass/node-sass-tests.ts @@ -1,48 +1,193 @@ import * as sass from 'node-sass'; -sass.render({ - file: '/path/to/myFile.scss', - data: 'body{background:blue; a{color:black;}}', - importer: function(url, prev, done) { - someAsyncFunction(url, prev, function(result) { - if (result == null) { - // return null to opt out of handling this path - // compiler will fall to next importer in array (or its own default) - return null; - } - // only one of them is required, see section Sepcial Behaviours. - done({ file: result.path }); - done({ contents: result.data }); - }); - }, - includePaths: ['lib/', 'mod/'], - outputStyle: 'compressed' -}, function(error, result) { // node-style callback from v3.0.0 onwards +console.log(sass.info); + +const syncImporter: sass.SyncImporter = function(url, prev) { + if (url.startsWith('!')) { + return sass.NULL; + } + if (url.endsWith('?')) { + return sass.types.Error("cannot question mark"); + } + console.log(typeof this.callback); // "undefined" + return { file: [prev, url].join('/') }; +}; + +const asyncImporter: sass.AsyncImporter = function(url, prev, done) { + if (url.startsWith('!')) { + // shouldn't really call twice, just checking for compiler validity + done(null); + done(sass.NULL); + } + if (url.endsWith('?')) { + // shouldn't really call twice, just checking for compiler validity + done(new sass.types.Error('Cannot accept this file')); + done(new Error('Cannot accept this file')); + } else { + console.log(this.options.file); // "string" + console.log(typeof this.callback); // "function" + done({ file: [prev, url].join('/') }); + } +}; + +const anotherAsyncImporter: sass.AsyncImporter = (url, prev, done) => { + someAsyncFunction(url, prev, (result) => { + if (result == null) { + // return null to opt out of handling this path + // compiler will fall to next importer in array (or its own default) + done(null); + } + // only one of them is required, see section Special Behaviors. + done({ file: result.path }); + done({ contents: result.data }); + }); +}; + +const handleAsyncResult: sass.SassRenderCallback = (error, result) => { // node-style callback from v3.0.0 onwards if (error) { console.log(error.status, error.column, error.message, error.line); - } - else { + } else { console.log(result.stats); console.log(result.css.toString()); console.log(result.map.toString()); // or better console.log(JSON.stringify(result.map)); // note, JSON.stringify accepts Buffer too } -}); +}; + +const syncFunction: Record = { + "pow($base, $exp)"($base, $exp) { + console.log(this.options.file); // "string" + console.log(typeof this.callback); // "undefined" + if ($base instanceof sass.types.Number && $exp instanceof sass.types.Number) { + if ($base.getUnit() !== "" || $exp.getUnit() !== "") { + throw new Error("Cannot have units in an exponent"); + } + return new sass.types.Number(Math.pow($base.getValue(), $exp.getValue())); + } else { + throw new Error("Number expected"); + } + } +}; + +const syncVarArg: Record = { + "add-all($n1, $n2, $ns...)"($n1, $n2, $ns) { + if (!($n1 instanceof sass.types.Number)) { + throw new Error("Expected a number"); + } + if (!($n2 instanceof sass.types.Number)) { + throw new Error("Expected a number"); + } + const unit = $n1.getUnit(); + if ($n2.getUnit() !== unit) { + throw new Error("units don't match"); + } + let accum = $n1.getValue() + $n2.getValue(); + $ns.forEach(($n) => { + if (!($n instanceof sass.types.Number)) { + throw new Error("Expected a number"); + } + if ($n.getUnit() !== unit) { + throw new Error("units don't match"); + } + accum = accum + $n.getValue(); + }); + return sass.types.Number(accum, unit); + } +}; + +const syncFunctions: Record = {...syncFunction, ...syncVarArg}; + +const asyncFunction: Record = { + "pow-async($base, $exp)"($base, $exp, done) { + console.log(this.options.file); // "string" + console.log(typeof this.callback); // "function" + if ($base instanceof sass.types.Number && $exp instanceof sass.types.Number) { + if ($base.getUnit() !== "" || $exp.getUnit() !== "") { + done(new sass.types.Error("Cannot have units in an exponent")); + } + done(new sass.types.Number(Math.pow($base.getValue(), $exp.getValue()))); + } else { + done(new sass.types.Error("Number expected")); + } + } +}; + +const asyncVarArg: Record = { + "add-all-async($n1, $n2, $ns...)"($n1, $n2, $ns, done) { + if (!($n1 instanceof sass.types.Number)) { + done(new sass.types.Error("Expected a number")); + return; + } + if (!($n2 instanceof sass.types.Number)) { + done(new sass.types.Error("Expected a number")); + return; + } + const unit = $n1.getUnit(); + if ($n2.getUnit() !== unit) { + done(new sass.types.Error("units don't match")); + return; + } + let accum = $n1.getValue() + $n2.getValue(); + for (const $n of $ns) { + if (!($n instanceof sass.types.Number)) { + done(new sass.types.Error("Expected a number")); + return; + } + if ($n.getUnit() !== unit) { + done(new sass.types.Error("units don't match")); + return; + } + accum = accum + $n.getValue(); + } + done(sass.types.Number(accum, unit)); + } +}; + +const asyncFunctions: Record = {...asyncFunction, ...asyncVarArg}; + +const functions: sass.FunctionDeclarations = {...syncFunctions, ...asyncFunctions}; + +sass.render({ + file: '/path/to/myFile.scss', + data: 'body{background:blue; a{color:black;}}', + functions, + importer: [anotherAsyncImporter, asyncImporter, syncImporter], + includePaths: ['lib/', 'mod/'], + outputStyle: 'compressed' +}, handleAsyncResult); + // OR + +sass.render({ + file: '/path/to/myFile.scss', + data: 'body{background:blue; a{color:black;}}', + importer: asyncImporter, + includePaths: ['lib/', 'mod/'], + outputStyle: 'compressed' +}, handleAsyncResult); + +// OR + +sass.render({ + file: '/path/to/myFile.scss', + data: 'body{background:blue; a{color:black;}}', + importer: syncImporter, + includePaths: ['lib/', 'mod/'], + outputStyle: 'compressed' +}, handleAsyncResult); + +// OR + const result = sass.renderSync({ file: '/path/to/file.scss', data: 'body{background:blue; a{color:black;}}', outputStyle: 'compressed', + functions: syncFunctions, outFile: '/to/my/output.css', sourceMap: true, // or an absolute or relative (to outFile) path sourceMapRoot: '.', - importer: function(url, prev) { - if (url.startsWith('!')) { - return new Error('Cannot accept this file'); - } - return { file: [prev, url].join('/') }; - }, + importer: syncImporter, }); console.log(result.css); @@ -50,6 +195,104 @@ console.log(result.map); console.log(result.stats); function someAsyncFunction(url: string, prev: string, callback: (result: { path: string; data: string }) => void): void { } -function someSyncFunction(url: string, prev: string): { path: string; data: string } { - return null; + +function sameType(v1: V, v2: V): boolean { + return v1.constructor === v2.constructor; } + +// function-based Constructors and instance methods for types +const true1 = sass.types.Boolean(true); +true1.getValue(); // true +const true2 = sass.types.Boolean.TRUE; +const true3 = sass.TRUE; +sameType(true2, true3); +true2 === true3; // true +const false1 = sass.types.Boolean(false); +const false2 = sass.types.Boolean.FALSE; +const false3 = sass.FALSE; +false2 === false3; // true +false1.getValue(); // false +const null1 = sass.types.Null(); +const null2 = sass.types.Null.NULL; +const null3 = sass.NULL; +sameType(null2, null3); +null1 === null2; // true +null1 === null3; // true +const ident = sass.types.String("x"); +ident.getValue(); // 'x' +const stringQuoted = sass.types.String("'x'"); +stringQuoted.getValue(); // '\'x\'' +const number = sass.types.Number(5); +number.getUnit(); // "" +number.getValue(); // 5 +const dimension = sass.types.Number(5, "px"); +dimension.getUnit(); // "px" +const redOpaque = sass.types.Color(240, 15, 0); +redOpaque.getR(); // 240 +redOpaque.getG(); // 15 +redOpaque.getB(); // 0 +redOpaque.getA(); // 1 +const redTranslucent = sass.types.Color(240, 15, 0, 0.5); +redTranslucent.getA(); // 0.5 +const redOpaque2 = sass.types.Color(0xF00F00FF); +redOpaque2.getR(); // 240 +redOpaque2.getG(); // 15 +redOpaque2.getB(); // 0 +redOpaque2.getA(); // 1 +const redTranslucent2 = sass.types.Color(0xF00F007F); +redTranslucent.getA(); // 0.5 +const spaceList1 = sass.types.List(1); +spaceList1.getLength(); // 1 +spaceList1.getSeparator(); // false +spaceList1.setValue(0, ident); +spaceList1.setValue(0, true1); +spaceList1.setValue(0, false1); +spaceList1.setValue(0, null1); +spaceList1.setValue(0, dimension); +spaceList1.setValue(0, redOpaque); +spaceList1.getValue(0) === redOpaque; // true +const spaceList2 = sass.types.List(1, false); +spaceList2.setValue(0, sass.types.String("s")); +const commaList1 = sass.types.List(2, true); +commaList1.getLength(); // 2 +commaList1.getSeparator(); // true (it's a comma) +commaList1.setValue(0, spaceList1); +commaList1.setValue(2, spaceList2); +const map1 = sass.types.Map(2); +map1.getLength(); // 2 +map1.setKey(0, ident); +map1.setValue(0, spaceList1); +ident === map1.getKey(0); // true +spaceList1 === map1.getValue(1); // true +sameType(ident, map1.getKey(0)); // true +const error = new sass.types.Error("message"); + +function valuesOf(enumerable: sass.types.Enumerable): sass.types.Value[] { + const values = new Array(); + for (let i = 0; i < enumerable.getLength(); i++) { + values.push(enumerable.getValue(i)); + } + return values; +} + +let arr = valuesOf(map1); +console.dir(arr); +arr = valuesOf(commaList1); +console.dir(arr); + +// new-based Constructors +// boolean and null raise a runtime error if constructed with new. +// const newTrue = new sass.types.Boolean(true); +// const newFalse = new sass.types.Boolean(false); +// const newNull = new sass.types.Null(); +const newIdent = new sass.types.String("x"); +const newNumber = new sass.types.Number(5); +const newDimension = new sass.types.Number(5, "px"); +const newRedOpaque = new sass.types.Color(240, 15, 0); +const newRedTranslucent = new sass.types.Color(240, 15, 0, 0.5); +const newRedOpaque2 = new sass.types.Color(0xF00F00FF); +const newSpaceList1 = new sass.types.List(1); +const newSpaceList2 = new sass.types.List(1, false); +const newCommaList1 = new sass.types.List(2, true); +const newMap1 = new sass.types.Map(2); +const newError = new sass.types.Error("message"); diff --git a/types/node-sass/tsconfig.json b/types/node-sass/tsconfig.json index a1e4cdb079..172d6270c7 100644 --- a/types/node-sass/tsconfig.json +++ b/types/node-sass/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/node-sass/tslint.json b/types/node-sass/tslint.json index a41bf5d19a..0b6d65eeac 100644 --- a/types/node-sass/tslint.json +++ b/types/node-sass/tslint.json @@ -1,79 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + // We don't want to export the Constructor interfaces + // and I can't figure out how to disable this lint using + // `export {}` + "strict-export-declare-modifiers": false } } diff --git a/types/node/ts3.1/index.d.ts b/types/node/ts3.1/index.d.ts index be36602300..ee9f75cc5f 100644 --- a/types/node/ts3.1/index.d.ts +++ b/types/node/ts3.1/index.d.ts @@ -7,7 +7,7 @@ // Reference required types from the default lib: /// -/// +/// /// // Base definitions for all NodeJS modules that are not specific to any version of TypeScript: diff --git a/types/node/v10/ts3.1/index.d.ts b/types/node/v10/ts3.1/index.d.ts index be36602300..ee9f75cc5f 100644 --- a/types/node/v10/ts3.1/index.d.ts +++ b/types/node/v10/ts3.1/index.d.ts @@ -7,7 +7,7 @@ // Reference required types from the default lib: /// -/// +/// /// // Base definitions for all NodeJS modules that are not specific to any version of TypeScript: diff --git a/types/npm-registry-package-info/index.d.ts b/types/npm-registry-package-info/index.d.ts new file mode 100644 index 0000000000..e66d3ae1b1 --- /dev/null +++ b/types/npm-registry-package-info/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for npm-registry-package-info 1.0 +// Project: https://github.com/kgryte/npm-registry-package-info#readme +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace pkginfo { + interface Options { + /** Boolean indicating whether to return only the latest package information from a registry. */ + latest?: boolean; + /** Array of package names (required). */ + packages: string[]; + /** Registry port. Default: 443 (HTTPS) or 80 (HTTP). */ + port?: number; + /** Registry protocol. Default: 'https'. */ + protocol?: 'http' | 'https'; + /** Registry. Default: 'registry.npmjs.org'. */ + registry?: string; + } + + interface Data { + data: any; + meta: { + failure: number; + success: number; + total: number; + }; + } + + type Callback = (error: Error | null, data: Data) => void; + + function factory(opts: Options, callback: Callback): () => void; +} + +declare function pkginfo(opts: pkginfo.Options, callback: pkginfo.Callback): void; + +export = pkginfo; diff --git a/types/npm-registry-package-info/npm-registry-package-info-tests.ts b/types/npm-registry-package-info/npm-registry-package-info-tests.ts new file mode 100644 index 0000000000..3b0183b13a --- /dev/null +++ b/types/npm-registry-package-info/npm-registry-package-info-tests.ts @@ -0,0 +1,21 @@ +import pkginfo = require('npm-registry-package-info'); + +const opts: pkginfo.Options = { + latest: true, + packages: ['dstructs-array', 'flow-map', 'utils-merge2'], + port: 80, + protocol: 'http', + registry: 'my.favorite.npm/registry', +}; + +pkginfo(opts, (error, data) => { + data; // $ExpectType Data +}); + +const pkgs = ['dstructs-matrix', 'compute-stdev', 'compute-variance']; + +const get = pkginfo.factory({ packages: pkgs }, (error, data) => { + data; // $ExpectType Data +}); + +get(); diff --git a/types/npm-registry-package-info/tsconfig.json b/types/npm-registry-package-info/tsconfig.json new file mode 100644 index 0000000000..d20c3201d2 --- /dev/null +++ b/types/npm-registry-package-info/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "npm-registry-package-info-tests.ts" + ] +} diff --git a/types/npm-registry-package-info/tslint.json b/types/npm-registry-package-info/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/npm-registry-package-info/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/npm/index.d.ts b/types/npm/index.d.ts index 21ee933e59..066a932440 100644 --- a/types/npm/index.d.ts +++ b/types/npm/index.d.ts @@ -167,8 +167,8 @@ declare namespace NPM { Conf: ConfigStatic; defs: ConfigDefs; - get(setting: string): string; - set(setting: string, value: string): void; + get(setting: string): any; + set(setting: string, value: any): void; loadPrefix(cb: ErrorCallback): void; loadCAFile(caFilePath: string, cb: ErrorCallback): void; diff --git a/types/npm/npm-tests.ts b/types/npm/npm-tests.ts index 8ca5f01887..460e6f450a 100644 --- a/types/npm/npm-tests.ts +++ b/types/npm/npm-tests.ts @@ -22,4 +22,6 @@ npm.load({}, function (er) { npm.on("log", function (message: string) { console.log(message); }); + + npm.config.set('audit', false); }) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 48756495bf..a1528d6348 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -10597,6 +10597,18 @@ declare namespace Office { * */ optionalAttendees: string[] | EmailAddressDetails[]; + /** + * Provides access to the resources of an event. Returns an array of strings containing the resources required for the appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
+ */ resources: string[]; /** * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. @@ -10776,7 +10788,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coercionType: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(coercionType: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns the current body in a specified format. * @@ -10798,27 +10810,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; - /** - * Returns the current body in a specified format. - * - * This method returns the entire current body in the format specified by coercionType. - * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. - * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. - * The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param coercionType - The format for the returned body. - */ - getAsync(coercionType: Office.CoercionType): void; + getAsync(coercionType: Office.CoercionType, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a value that indicates whether the content is in HTML or text format. * @@ -10835,7 +10827,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The content type is returned as one of the CoercionType values in the asyncResult.value property. */ - getTypeAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getTypeAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a value that indicates whether the content is in HTML or text format. * @@ -10850,20 +10842,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The content type is returned as one of the CoercionType values in the asyncResult.value property. */ - getTypeAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets a value that indicates whether the content is in HTML or text format. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - */ - getTypeAsync(): void; + getTypeAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds the specified content to the beginning of the item body. * @@ -10889,7 +10868,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - prependAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + prependAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds the specified content to the beginning of the item body. * @@ -10912,28 +10891,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - prependAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Adds the specified content to the beginning of the item body. - * - * The prependAsync method inserts the specified string at the beginning of the item body. - * After insertion, the cursor is returned to its original place, relative to the inserted content. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
- * - * @param data - The string to be inserted at the beginning of the body. The string is limited to 1,000,000 characters. - */ - prependAsync(data: string): void; + prependAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * @@ -10961,7 +10919,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * @@ -10986,30 +10944,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Replaces the entire body with the specified text. - * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. - * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method - * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.
- * - * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. - */ - setAsync(data: string): void; + setAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. @@ -11038,7 +10973,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. * @@ -11063,30 +10998,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Replaces the selection in the body with the specified text. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in - * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the - * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.
- * - * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. - */ - setSelectedDataAsync(data: string): void; + setSelectedDataAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Represents a contact stored on the server. Read mode only. @@ -11219,52 +11131,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - saveAsync(callback?: (result: Office.AsyncResult) => void, asyncContext?: any): void; - /** - * Saves item-specific custom properties to the server. - * - * You must call the saveAsync method to persist any changes made with the set method or the remove method of the CustomProperties object. - * The saving action is asynchronous. - * - * It's a good practice to have your callback function check for and handle errors from saveAsync. - * In particular, a read add-in can be activated while the user is in a connected state in a read form, and subsequently the user becomes - * disconnected. - * If the add-in calls saveAsync while in the disconnected state, saveAsync would return an error. - * Your callback method should handle this error accordingly. - * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Saves item-specific custom properties to the server. - * - * You must call the saveAsync method to persist any changes made with the set method or the remove method of the CustomProperties object. - * The saving action is asynchronous. - * - * It's a good practice to have your callback function check for and handle errors from saveAsync. - * In particular, a read add-in can be activated while the user is in a connected state in a read form, and subsequently the user becomes - * disconnected. - * If the add-in calls saveAsync while in the disconnected state, saveAsync would return an error. - * Your callback method should handle this error accordingly. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(): void; + saveAsync(callback?: (asyncResult: Office.AsyncResult) => void, asyncContext?: any): void; } /** * Provides diagnostic information to an Outlook add-in. @@ -11420,7 +11287,7 @@ declare namespace Office { * * @beta */ - addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; + addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Adds to the set of locations associated with the appointment. * @@ -11439,24 +11306,7 @@ declare namespace Office { * * @beta */ - addAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; - /** - * Adds to the set of locations associated with the appointment. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidFormatError - The format of the specified data object is not valid.
- * - * @param locationIdentifiers The locations to be added to the current list of locations. - * - * @beta - */ - addAsync(locationIdentifiers: LocationIdentifier[]): void; + addAsync(locationIdentifiers: LocationIdentifier[], callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Gets the set of locations associated with the appointment. * @@ -11475,7 +11325,7 @@ declare namespace Office { * * @beta */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the set of locations associated with the appointment. * @@ -11492,21 +11342,7 @@ declare namespace Office { * * @beta */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the set of locations associated with the appointment. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @beta - */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the set of locations associated with the appointment. * @@ -11528,7 +11364,7 @@ declare namespace Office { * * @beta */ - removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; + removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Removes the set of locations associated with the appointment. * @@ -11548,25 +11384,7 @@ declare namespace Office { * * @beta */ - removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; - /** - * Removes the set of locations associated with the appointment. - * - * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param locationIdentifiers The locations to be removed from the current list of locations. - * - * @beta - */ - removeAsync(locationIdentifiers: LocationIdentifier[]): void; + removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (asyncResult: Office.AsyncResultStatus) => void): void; } /** * Represents a collection of entities found in an email message or appointment. Read mode only. @@ -11657,12 +11475,13 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. - * The `value` property of the result is message's from value, as an EmailAddressDetails object. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * The `value` property of the result is the item's from value, as an EmailAddressDetails object. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the from value of a message. * @@ -11679,27 +11498,11 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. - * The `value` property of the result is message's from value, as an EmailAddressDetails object. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * The `value` property of the result is the item's from value, as an EmailAddressDetails object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the from value of a message. - * - * The getAsync method starts an asynchronous call to the Exchange server to get the from value of a message. - * - * The from value of the item is provided as an {@link Office.EmailAddressDetails} in the asyncResult.value property. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -11739,7 +11542,7 @@ declare namespace Office { * * @beta */ - getAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. * If the add-in requests an x-header that is not available, that x-header will not be returned in the results. @@ -11758,24 +11561,7 @@ declare namespace Office { * * @beta */ - getAsync(names: string[], callback?: (result: Office.AsyncResult) => void): void; - /** - * Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. - * If the add-in requests an x-header that is not available, that x-header will not be returned in the results. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param names - The names of the internet headers to be returned. - * - * @beta - */ - getAsync(names: string[]): void; + getAsync(names: string[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method removes the specified headers from the internet header collection. * @@ -11795,7 +11581,7 @@ declare namespace Office { * * @beta */ - removeAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + removeAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method removes the specified headers from the internet header collection. * @@ -11813,23 +11599,7 @@ declare namespace Office { * * @beta */ - removeAsync(names: string[], callback?: (result: Office.AsyncResult) => void): void; - /** - * Given an array of internet header names, this method removes the specified headers from the internet header collection. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param names - The names of the internet headers to be removed. - * - * @beta - */ - removeAsync(names: string[]): void; + removeAsync(names: string[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the specified internet headers to the specified values. * @@ -11853,7 +11623,7 @@ declare namespace Office { * * @beta */ - setAsync(headers: Object, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(headers: Object, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the specified internet headers to the specified values. * @@ -11875,27 +11645,7 @@ declare namespace Office { * * @beta */ - setAsync(headers: Object, callback?: (result: Office.AsyncResult) => void): void; - /** - * Sets the specified internet headers to the specified values. - * - * The setAsync method creates a new header if the specified header does not already exist; otherwise, the existing value is replaced with - * the new value. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param headers - The names and corresponding values of the headers to be set. Should be a dictionary object with keys being the names of the - * internet headers and values being the values of the internet headers. - * - * @beta - */ - setAsync(headers: Object): void; + setAsync(headers: Object, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -11980,10 +11730,10 @@ declare namespace Office { * * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an asyncResult object. - * The `value` property of the result is message's organizer value, as an EmailAddressDetails object. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * The `value` property of the result is the appointment's organizer value, as an EmailAddressDetails object. */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the organizer value of an appointment as an {@link Office.EmailAddressDetails} in the asyncResult.value property. * @@ -11995,22 +11745,10 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an asyncResult object. - * The `value` property of the result is message's organizer value, as an EmailAddressDetails object. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * The `value` property of the result is the appointment's organizer value, as an EmailAddressDetails object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the organizer value of an appointment as an {@link Office.EmailAddressDetails} in the asyncResult.value property. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -12269,11 +12007,11 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12294,33 +12032,11 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12344,13 +12060,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12371,37 +12087,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentFromBase64Async method uploads the file from the base64 encoding and attaches it to the item in the compose form. This method returns the attachment identifier in the asyncResult.value object. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param base64File - The base64 encoded content of an image or file to be added to an email or event. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -12426,7 +12118,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -12449,28 +12141,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -12495,13 +12166,13 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -12526,37 +12197,11 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. - * You can use the options parameter to pass state information to the callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed * @@ -12598,7 +12243,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -12617,22 +12262,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -12657,7 +12287,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -12680,26 +12310,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -12727,7 +12338,7 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -12754,7 +12365,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. * @@ -12780,31 +12391,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes an attachment from a message or appointment. * @@ -12830,29 +12417,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -12878,7 +12443,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -12901,7 +12466,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -12922,26 +12487,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -12973,44 +12519,11 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - */ - saveAsync(): void; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -13041,9 +12554,9 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -13063,7 +12576,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -13072,10 +12585,10 @@ declare namespace Office { * If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -13095,31 +12608,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -13491,7 +12983,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -13514,28 +13006,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the * selected appointment. @@ -13563,33 +13034,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -13617,33 +13062,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -13669,7 +13088,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -13692,24 +13111,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -13945,31 +13347,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. @@ -13993,7 +13371,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -14014,26 +13392,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -14141,7 +13500,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. @@ -14165,29 +13524,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. @@ -14217,32 +13554,7 @@ declare namespace Office { * * @beta */ - getAttachmentContentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. - * - * The `getAttachmentContentAsync` method gets the attachment with the specified identifier from the item. As a best practice, you should use - * the identifier to retrieve an attachment in the same session that the attachmentIds were retrieved with the `getAttachmentsAsync` or - * `item.attachments` call. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment you want to get. - * - * @beta - */ - getAttachmentContentAsync(attachmentId: string): void; + getAttachmentContentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. @@ -14270,7 +13582,7 @@ declare namespace Office { * * @beta */ - getAttachmentContentAsync(attachmentId: string, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentContentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -14297,7 +13609,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -14322,26 +13634,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the properties of an appointment or message in a shared folder, calendar, or mailbox. @@ -14362,7 +13655,7 @@ declare namespace Office { * * @beta */ - getSharedPropertiesAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSharedPropertiesAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the properties of an appointment or message in a shared folder, calendar, or mailbox. @@ -14381,7 +13674,7 @@ declare namespace Office { * * @beta */ - getSharedPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + getSharedPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. @@ -14408,32 +13701,8 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. @@ -14457,7 +13726,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. @@ -14479,27 +13748,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * The compose mode of {@link Office.Item | Office.context.mailbox.item}. @@ -14526,6 +13775,7 @@ declare namespace Office { * */ subject: Subject; + /** * Adds a file to a message or appointment as an attachment. * @@ -14550,12 +13800,12 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the * attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14576,34 +13826,12 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. @@ -14628,13 +13856,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14655,37 +13883,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentFromBase64Async method uploads the file from the base64 encoding and attaches it to the item in the compose form. This method returns the attachment identifier in the asyncResult.value object. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param base64File - The base64 encoded content of an image or file to be added to an email or event. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. @@ -14711,14 +13915,14 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -14743,38 +13947,12 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the - * callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed @@ -14817,7 +13995,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -14836,22 +14014,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -14878,7 +14041,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -14903,26 +14066,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -14951,7 +14095,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -14978,7 +14122,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -15005,53 +14149,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - */ - removeAttachmentAsync(attachmentId: string, options: Office.AsyncContextOptions): void; + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -15076,7 +14174,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. @@ -15109,13 +14207,13 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -15147,44 +14245,11 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - */ - saveAsync(): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -15204,7 +14269,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -15213,10 +14278,10 @@ declare namespace Office { * If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -15236,31 +14301,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -15407,33 +14451,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -15461,33 +14479,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -15513,7 +14505,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -15537,25 +14529,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -16013,12 +14987,12 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the * attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16039,34 +15013,12 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16090,13 +15042,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16117,13 +15069,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -16148,7 +15100,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -16171,28 +15123,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -16217,14 +15148,14 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -16249,38 +15180,12 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. - * You can use the options parameter to pass state information to the callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed * @@ -16322,7 +15227,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -16341,22 +15246,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -16384,7 +15274,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -16410,27 +15300,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -16459,7 +15329,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -16486,7 +15356,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. * @@ -16512,19 +15382,67 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** - * Asynchronously loads custom properties for this add-in on the selected item. + * Removes an attachment from a message or appointment. * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. + * [Api set: Mailbox 1.1] * - * [Api set: Mailbox 1.0] + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param attachmentId - The identifier of the attachment to remove. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param attachmentId - The identifier of the attachment to remove. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes the event handlers for a supported event type. + * + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. + * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. + * + * [Api set: Mailbox 1.7] * * @remarks * @@ -16532,254 +15450,107 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose * + * + * @param eventType - The event that should revoke the handler. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes the event handlers for a supported event type. + * + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. + * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. + * + * [Api set: Mailbox 1.7] + * + * @remarks + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
+ * + * @param eventType - The event that should revoke the handler. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. + * + * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. + * + * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param options - An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + */ + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. + * + * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. + * + * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
* * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. - */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. - */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should revoke the handler. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should revoke the handler. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - */ - saveAsync(): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -16799,7 +15570,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -16807,10 +15578,10 @@ declare namespace Office { * applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -16830,31 +15601,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The message read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -17240,13 +15990,12 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -17263,28 +16012,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the * selected appointment. @@ -17312,33 +16040,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -17366,33 +16068,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -17419,7 +16095,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -17444,26 +16120,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is - * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the - * web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -17701,31 +16358,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. * @@ -17748,7 +16381,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -17769,26 +16402,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -17855,9 +16469,9 @@ declare namespace Office { * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. * The location of the appointment is provided as a string in the asyncResult.value property. * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * * [Api set: Mailbox 1.1] @@ -17868,14 +16482,14 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the location of an appointment. * * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. * The location of the appointment is provided as a string in the asyncResult.value property. * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * * [Api set: Mailbox 1.1] @@ -17886,22 +16500,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * */ - getAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Gets the location of an appointment. - * - * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. - * The location of the appointment is provided as a string in the asyncResult.value property. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the location of an appointment. * @@ -17923,25 +16522,7 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters. * */ - setAsync(location: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Sets the location of an appointment. - * - * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. - * Setting the location of an appointment overwrites the current location. - * - * @param location - The location of the appointment. The string is limited to 255 characters. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters.
- */ - setAsync(location: string): void; + setAsync(location: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the location of an appointment. * @@ -17961,7 +16542,7 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters. * */ - setAsync(location: string, callback: (result: Office.AsyncResult) => void): void; + setAsync(location: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Provides access to the Outlook Add-in object model for Microsoft Outlook and Microsoft Outlook on the web. @@ -18088,7 +16669,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -18110,27 +16691,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently, the only supported event type is `Office.EventType.ItemChanged`. - * In Preview, `Office.EventType.OfficeThemeChanged` is also supported. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Converts an item ID formatted for REST into EWS format. * @@ -18392,36 +16953,7 @@ declare namespace Office { * type Office.AsyncResult. The token is provided as a string in the `asyncResult.value` property. * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. */ - getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (result: Office.AsyncResult) => void): void; - /** - * Gets a string that contains a token used to get an attachment or item from an Exchange Server. - * - * The getCallbackTokenAsync method makes an asynchronous call to get an opaque token from the Exchange Server that hosts the user's mailbox. - * The lifetime of the callback token is 5 minutes. - * - * You can pass the token and an attachment identifier or item identifier to a third-party system. - * The third-party system uses the token as a bearer authorization token to call the Exchange Web Services (EWS) GetAttachment or - * GetItem operation to return an attachment or item. For example, you can create a remote service to get attachments from the selected item. - * - * Your app must have the ReadItem permission specified in its manifest to call the getCallbackTokenAsync method in read mode. - * - * In compose mode you must call the saveAsync method to get an item identifier to pass to the getCallbackTokenAsync method. - * Your app must have ReadWriteItem permissions to call the saveAsync method. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. - * The token is provided as a string in the `asyncResult.value` property. - * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. - */ - getCallbackTokenAsync(callback: (result: Office.AsyncResult) => void): void; + getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a string that contains a token used to get an attachment or item from an Exchange Server. * @@ -18451,7 +16983,7 @@ declare namespace Office { * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. * @param userContext - Optional. Any state data that is passed to the asynchronous method. */ - getCallbackTokenAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + getCallbackTokenAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Gets a token identifying the user and the Office Add-in. * @@ -18475,30 +17007,7 @@ declare namespace Office { * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. * @param userContext - Optional. Any state data that is passed to the asynchronous method.| */ - getUserIdentityTokenAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Gets a token identifying the user and the Office Add-in. - * - * The token is provided as a string in the asyncResult.value property. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * The getUserIdentityTokenAsync method returns a token that you can use to identify and - * {@link https://docs.microsoft.com/outlook/add-ins/authentication | authenticate the add-in and user with a third-party system}. - * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * The token is provided as a string in the `asyncResult.value` property. - * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. - */ - getUserIdentityTokenAsync(callback: (result: Office.AsyncResult) => void): void; + getUserIdentityTokenAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Makes an asynchronous request to an Exchange Web Services (EWS) service on the Exchange server that hosts the user's mailbox. * @@ -18552,60 +17061,7 @@ declare namespace Office { * If the result exceeds 1 MB in size, an error message is returned instead. * @param userContext - Optional. Any state data that is passed to the asynchronous method. */ - makeEwsRequestAsync(data: any, callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Makes an asynchronous request to an Exchange Web Services (EWS) service on the Exchange server that hosts the user's mailbox. - * - * In these cases, add-ins should use REST APIs to access the user's mailbox instead. - * - * The makeEwsRequestAsync method sends an EWS request on behalf of the add-in to Exchange. - * - * You cannot request Folder Associated Items with the makeEwsRequestAsync method. - * - * The XML request must specify UTF-8 encoding. \ - * - * Your add-in must have the ReadWriteMailbox permission to use the makeEwsRequestAsync method. - * For information about using the ReadWriteMailbox permission and the EWS operations that you can call with the makeEwsRequestAsync method, - * see {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Specify permissions for mail add-in access to the user's mailbox}. - * - * The XML result of the EWS call is provided as a string in the asyncResult.value property. - * If the result exceeds 1 MB in size, an error message is returned instead. - * - * **Note**: This method is not supported in the following scenarios: - * - * - In Outlook for iOS or Outlook for Android. - * - * - When the add-in is loaded in a Gmail mailbox. - * - * **Note**: The server administrator must set OAuthAuthentication to true on the Client Access Server EWS directory to enable the - * makeEwsRequestAsync method to make EWS requests. - * - * *Version differences* - * - * When you use the makeEwsRequestAsync method in mail apps running in Outlook versions earlier than version 15.0.4535.1004, you should set - * the encoding value to ISO-8859-1. - * - * `` - * - * You do not need to set the encoding value when your mail app is running in Outlook on the web. - * You can determine whether your mail app is running in Outlook or Outlook on the web by using the mailbox.diagnostics.hostName property. - * You can determine what version of Outlook is running by using the mailbox.diagnostics.hostVersion property. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteMailbox
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param data - The EWS request. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. - * The `value` property of the result is the XML of the EWS request provided as a string. - * If the result exceeds 1 MB in size, an error message is returned instead. - */ - makeEwsRequestAsync(data: any, callback: (result: Office.AsyncResult) => void): void; + makeEwsRequestAsync(data: any, callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. * @@ -18626,7 +17082,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeHandlerAsync(eventType: Office.EventType, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -18646,25 +17102,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently, the only supported event type is `Office.EventType.ItemChanged`. - * In Preview, `Office.EventType.OfficeThemeChanged` is also supported. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -18786,26 +17224,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - addAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a notification to an item. - * - * There are a maximum of 5 notifications per message. Setting more will return a NumberOfNotificationMessagesExceeded error. - * - * @param key - A developer-specified key used to reference this notification message. Developers can use it to modify this message later. - * It can't be longer than 32 characters. - * @param JSONmessage - A JSON object that contains the notification message to be added to the item. - * It contains a NotificationMessageDetails object. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - addAsync(key: string, JSONmessage: NotificationMessageDetails): void; + addAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a notification to an item. * @@ -18826,7 +17245,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - addAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: Office.AsyncResult) => void): void; + addAsync(key: string, JSONmessage: NotificationMessageDetails, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns all keys and messages for an item. * @@ -18843,7 +17262,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is an array of NotificationMessageDetails objects. */ - getAllAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAllAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns all keys and messages for an item. * @@ -18858,19 +17277,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is an array of NotificationMessageDetails objects. */ - getAllAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Returns all keys and messages for an item. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - getAllAsync(): void; + getAllAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes a notification message for an item. * @@ -18883,24 +17290,12 @@ declare namespace Office { * * * @param key - The key for the notification message to remove. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeAsync(key: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes a notification message for an item. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param key - The key for the notification message to remove. - */ - removeAsync(key: string): void; + removeAsync(key: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes a notification message for an item. * @@ -18916,7 +17311,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeAsync(key: string, callback: (result: Office.AsyncResult) => void): void; + removeAsync(key: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces a notification message that has a given key with another message. * @@ -18938,25 +17333,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Replaces a notification message that has a given key with another message. - * - * If a notification message with the specified key doesn't exist, replaceAsync will add the notification. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param key - The key for the notification message to replace. It can't be longer than 32 characters. - * @param JSONmessage - A JSON object that contains the new notification message to replace the existing message. - * It contains a NotificationMessageDetails object. - */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails): void; + replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces a notification message that has a given key with another message. * @@ -18976,7 +17353,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: Office.AsyncResult) => void): void; + replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Represents a phone number identified in an item. Read mode only. @@ -19042,30 +17419,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code. */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a recipient list to the existing recipients for an appointment or message. - * - * The recipients parameter can be an array of one of the following: - * - * - Strings containing SMTP email addresses - * - * - EmailUser objects - * - * - EmailAddressDetails objects - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
- * - * @param recipients - The recipients to add to the recipients list. - */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void; + addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a recipient list to the existing recipients for an appointment or message. * @@ -19090,7 +17444,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code. */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: Office.AsyncResult) => void): void; + addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * @@ -19110,7 +17464,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is an array of EmailAddressDetails objects. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * @@ -19128,7 +17482,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is an array of EmailAddressDetails objects. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets a recipient list for an appointment or message. * @@ -19152,14 +17506,14 @@ declare namespace Office { * * * @param recipients - The recipients to add to the recipients list. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred * while adding the data. */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets a recipient list for an appointment or message. * @@ -19183,38 +17537,12 @@ declare namespace Office { * * * @param recipients - The recipients to add to the recipients list. - */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void; - /** - * Sets a recipient list for an appointment or message. - * - * The setAsync method overwrites the current recipient list. - * - * The recipients parameter can be an array of one of the following: - * - * - Strings containing SMTP email addresses - * - * - {@link Office.EmailUser} objects - * - * - {@link Office.EmailAddressDetails} objects - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
- * - * @param recipients - The recipients to add to the recipients list. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred * while adding the data. */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: Office.AsyncResult) => void): void; - + setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -19349,7 +17677,7 @@ declare namespace Office { * asyncResult, which is an Office.AsyncResult object. * The `value` property of the result is a Recurrence object. */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns the current recurrence object of an appointment series. @@ -19369,23 +17697,7 @@ declare namespace Office { * asyncResult, which is an Office.AsyncResult object. * The `value` property of the result is a Recurrence object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - - /** - * Returns the current recurrence object of an appointment series. - * - * This method returns the entire recurrence object for the appointment series. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the recurrence pattern of an appointment series. @@ -19408,7 +17720,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - setAsync(recurrencePattern: Recurrence, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(recurrencePattern: Recurrence, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the recurrence pattern of an appointment series. @@ -19429,28 +17741,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - setAsync(recurrencePattern: Recurrence, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Sets the recurrence pattern of an appointment series. - * - * **Note**: setAsync should only be available for series items and not instance items. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidEndTime - The appointment end time is before its start time.
- * - * @param recurrencePattern - A recurrence object. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - setAsync(recurrencePattern: Recurrence): void; + setAsync(recurrencePattern: Recurrence, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -19564,7 +17855,7 @@ declare namespace Office { * When the reply display call completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - callback?: (result: Office.AsyncResult) => void; + callback?: (asyncResult: Office.AsyncResult) => void; } /** * The settings created by using the methods of the RoamingSettings object are saved per add-in and per user. @@ -19639,23 +17930,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - saveAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Saves the settings. - * - * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use - * the set and get methods to work with the in-memory copy of the settings property bag. - * When you want to persist the settings so that they are available the next time the add-in is used, use the saveAsync method. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}Restricted
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(): void; + saveAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets or creates the specified setting. * @@ -19937,7 +18212,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is the subject of the item. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the subject of an appointment or message. * @@ -19954,7 +18229,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is the subject of the item. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the subject of an appointment or message. * @@ -19971,12 +18246,12 @@ declare namespace Office { * * * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code. */ - setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the subject of an appointment or message. * @@ -19993,28 +18268,10 @@ declare namespace Office { * * * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - */ - setAsync(data: string): void; - /** - * Sets the subject of an appointment or message. - * - * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. - * Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The subject parameter is longer than 255 characters.
- * - * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code. */ - setAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -20072,7 +18329,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is a Date object. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the start or end time of an appointment. * @@ -20090,7 +18347,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is a Date object. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the start or end time of an appointment. * @@ -20109,13 +18366,13 @@ declare namespace Office { * * * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the date and time fails, the asyncResult.error property will contain an error code. */ - setAsync(dateTime: Date, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(dateTime: Date, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the start or end time of an appointment. * @@ -20134,31 +18391,11 @@ declare namespace Office { * * * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - */ - setAsync(dateTime: Date): void; - /** - * Sets the start or end time of an appointment. - * - * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as - * previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. - * - * The time must be in UTC; you can get the correct UTC time by using the convertToUtcClientTime method. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidEndTime - The appointment end time is before the appointment start time.
- * - * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the date and time fails, the asyncResult.error property will contain an error code. */ - setAsync(dateTime: Date, callback: (result: Office.AsyncResult) => void): void; + setAsync(dateTime: Date, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 7953bdd7c0..edae85ea8a 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -10597,6 +10597,18 @@ declare namespace Office { * */ optionalAttendees: string[] | EmailAddressDetails[]; + /** + * Provides access to the resources of an event. Returns an array of strings containing the resources required for the appointment. + * + * [Api set: Mailbox 1.0] + * + * @remarks + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
+ */ resources: string[]; /** * Provides access to the required attendees of an event. The type of object and level of access depends on the mode of the current item. @@ -10776,7 +10788,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coercionType: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(coercionType: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns the current body in a specified format. * @@ -10798,27 +10810,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; - /** - * Returns the current body in a specified format. - * - * This method returns the entire current body in the format specified by coercionType. - * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. - * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. - * The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param coercionType - The format for the returned body. - */ - getAsync(coercionType: Office.CoercionType): void; + getAsync(coercionType: Office.CoercionType, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a value that indicates whether the content is in HTML or text format. * @@ -10835,7 +10827,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The content type is returned as one of the CoercionType values in the asyncResult.value property. */ - getTypeAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getTypeAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a value that indicates whether the content is in HTML or text format. * @@ -10850,20 +10842,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The content type is returned as one of the CoercionType values in the asyncResult.value property. */ - getTypeAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets a value that indicates whether the content is in HTML or text format. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - */ - getTypeAsync(): void; + getTypeAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds the specified content to the beginning of the item body. * @@ -10889,7 +10868,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - prependAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + prependAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds the specified content to the beginning of the item body. * @@ -10912,28 +10891,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - prependAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Adds the specified content to the beginning of the item body. - * - * The prependAsync method inserts the specified string at the beginning of the item body. - * After insertion, the cursor is returned to its original place, relative to the inserted content. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
- * - * @param data - The string to be inserted at the beginning of the body. The string is limited to 1,000,000 characters. - */ - prependAsync(data: string): void; + prependAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * @@ -10961,7 +10919,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * @@ -10986,30 +10944,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Replaces the entire body with the specified text. - * - * When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. - * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method - * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.
- * - * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. - */ - setAsync(data: string): void; + setAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. @@ -11038,7 +10973,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. * @@ -11063,30 +10998,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * Any errors encountered will be provided in the asyncResult.error property. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Replaces the selection in the body with the specified text. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in - * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the - * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. - * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" - * (please see the Examples section for a sample). - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.
- * - * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. - */ - setSelectedDataAsync(data: string): void; + setSelectedDataAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Represents a contact stored on the server. Read mode only. @@ -11219,52 +11131,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - saveAsync(callback?: (result: Office.AsyncResult) => void, asyncContext?: any): void; - /** - * Saves item-specific custom properties to the server. - * - * You must call the saveAsync method to persist any changes made with the set method or the remove method of the CustomProperties object. - * The saving action is asynchronous. - * - * It's a good practice to have your callback function check for and handle errors from saveAsync. - * In particular, a read add-in can be activated while the user is in a connected state in a read form, and subsequently the user becomes - * disconnected. - * If the add-in calls saveAsync while in the disconnected state, saveAsync would return an error. - * Your callback method should handle this error accordingly. - * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Saves item-specific custom properties to the server. - * - * You must call the saveAsync method to persist any changes made with the set method or the remove method of the CustomProperties object. - * The saving action is asynchronous. - * - * It's a good practice to have your callback function check for and handle errors from saveAsync. - * In particular, a read add-in can be activated while the user is in a connected state in a read form, and subsequently the user becomes - * disconnected. - * If the add-in calls saveAsync while in the disconnected state, saveAsync would return an error. - * Your callback method should handle this error accordingly. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(): void; + saveAsync(callback?: (asyncResult: Office.AsyncResult) => void, asyncContext?: any): void; } /** * Provides diagnostic information to an Outlook add-in. @@ -11420,7 +11287,7 @@ declare namespace Office { * * @beta */ - addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; + addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Adds to the set of locations associated with the appointment. * @@ -11439,24 +11306,7 @@ declare namespace Office { * * @beta */ - addAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; - /** - * Adds to the set of locations associated with the appointment. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidFormatError - The format of the specified data object is not valid.
- * - * @param locationIdentifiers The locations to be added to the current list of locations. - * - * @beta - */ - addAsync(locationIdentifiers: LocationIdentifier[]): void; + addAsync(locationIdentifiers: LocationIdentifier[], callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Gets the set of locations associated with the appointment. * @@ -11475,7 +11325,7 @@ declare namespace Office { * * @beta */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the set of locations associated with the appointment. * @@ -11492,21 +11342,7 @@ declare namespace Office { * * @beta */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the set of locations associated with the appointment. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @beta - */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the set of locations associated with the appointment. * @@ -11528,7 +11364,7 @@ declare namespace Office { * * @beta */ - removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; + removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResultStatus) => void): void; /** * Removes the set of locations associated with the appointment. * @@ -11548,25 +11384,7 @@ declare namespace Office { * * @beta */ - removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; - /** - * Removes the set of locations associated with the appointment. - * - * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param locationIdentifiers The locations to be removed from the current list of locations. - * - * @beta - */ - removeAsync(locationIdentifiers: LocationIdentifier[]): void; + removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (asyncResult: Office.AsyncResultStatus) => void): void; } /** * Represents a collection of entities found in an email message or appointment. Read mode only. @@ -11657,12 +11475,13 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. - * The `value` property of the result is message's from value, as an EmailAddressDetails object. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * The `value` property of the result is the item's from value, as an EmailAddressDetails object. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the from value of a message. * @@ -11679,27 +11498,11 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. - * The `value` property of the result is message's from value, as an EmailAddressDetails object. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * The `value` property of the result is the item's from value, as an EmailAddressDetails object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the from value of a message. - * - * The getAsync method starts an asynchronous call to the Exchange server to get the from value of a message. - * - * The from value of the item is provided as an {@link Office.EmailAddressDetails} in the asyncResult.value property. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -11739,7 +11542,7 @@ declare namespace Office { * * @beta */ - getAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. * If the add-in requests an x-header that is not available, that x-header will not be returned in the results. @@ -11758,24 +11561,7 @@ declare namespace Office { * * @beta */ - getAsync(names: string[], callback?: (result: Office.AsyncResult) => void): void; - /** - * Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. - * If the add-in requests an x-header that is not available, that x-header will not be returned in the results. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param names - The names of the internet headers to be returned. - * - * @beta - */ - getAsync(names: string[]): void; + getAsync(names: string[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method removes the specified headers from the internet header collection. * @@ -11795,7 +11581,7 @@ declare namespace Office { * * @beta */ - removeAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + removeAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Given an array of internet header names, this method removes the specified headers from the internet header collection. * @@ -11813,23 +11599,7 @@ declare namespace Office { * * @beta */ - removeAsync(names: string[], callback?: (result: Office.AsyncResult) => void): void; - /** - * Given an array of internet header names, this method removes the specified headers from the internet header collection. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param names - The names of the internet headers to be removed. - * - * @beta - */ - removeAsync(names: string[]): void; + removeAsync(names: string[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the specified internet headers to the specified values. * @@ -11853,7 +11623,7 @@ declare namespace Office { * * @beta */ - setAsync(headers: Object, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(headers: Object, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the specified internet headers to the specified values. * @@ -11875,27 +11645,7 @@ declare namespace Office { * * @beta */ - setAsync(headers: Object, callback?: (result: Office.AsyncResult) => void): void; - /** - * Sets the specified internet headers to the specified values. - * - * The setAsync method creates a new header if the specified header does not already exist; otherwise, the existing value is replaced with - * the new value. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @param headers - The names and corresponding values of the headers to be set. Should be a dictionary object with keys being the names of the - * internet headers and values being the values of the internet headers. - * - * @beta - */ - setAsync(headers: Object): void; + setAsync(headers: Object, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -11980,10 +11730,10 @@ declare namespace Office { * * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an asyncResult object. - * The `value` property of the result is message's organizer value, as an EmailAddressDetails object. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * The `value` property of the result is the appointment's organizer value, as an EmailAddressDetails object. */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the organizer value of an appointment as an {@link Office.EmailAddressDetails} in the asyncResult.value property. * @@ -11995,22 +11745,10 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an asyncResult object. - * The `value` property of the result is message's organizer value, as an EmailAddressDetails object. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an AsyncResult object. + * The `value` property of the result is the appointment's organizer value, as an EmailAddressDetails object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the organizer value of an appointment as an {@link Office.EmailAddressDetails} in the asyncResult.value property. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -12269,11 +12007,11 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12294,33 +12032,11 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12344,13 +12060,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12371,37 +12087,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentFromBase64Async method uploads the file from the base64 encoding and attaches it to the item in the compose form. This method returns the attachment identifier in the asyncResult.value object. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param base64File - The base64 encoded content of an image or file to be added to an email or event. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -12426,7 +12118,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -12449,28 +12141,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -12495,13 +12166,13 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -12526,37 +12197,11 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. - * You can use the options parameter to pass state information to the callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed * @@ -12598,7 +12243,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -12617,22 +12262,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -12657,7 +12287,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -12680,26 +12310,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -12727,7 +12338,7 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -12754,7 +12365,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. * @@ -12780,31 +12391,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes an attachment from a message or appointment. * @@ -12830,29 +12417,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -12878,7 +12443,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -12901,7 +12466,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -12922,26 +12487,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -12973,44 +12519,11 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - */ - saveAsync(): void; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -13041,9 +12554,9 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -13063,7 +12576,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -13072,10 +12585,10 @@ declare namespace Office { * If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -13095,31 +12608,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -13491,7 +12983,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -13514,28 +13006,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the * selected appointment. @@ -13563,33 +13034,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -13617,33 +13062,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -13669,7 +13088,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -13692,24 +13111,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -13945,31 +13347,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. @@ -13993,7 +13371,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -14014,26 +13392,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -14141,7 +13500,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. @@ -14165,29 +13524,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. @@ -14217,32 +13554,7 @@ declare namespace Office { * * @beta */ - getAttachmentContentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. - * - * The `getAttachmentContentAsync` method gets the attachment with the specified identifier from the item. As a best practice, you should use - * the identifier to retrieve an attachment in the same session that the attachmentIds were retrieved with the `getAttachmentsAsync` or - * `item.attachments` call. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment you want to get. - * - * @beta - */ - getAttachmentContentAsync(attachmentId: string): void; + getAttachmentContentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets an attachment from a message or appointment and returns it as an **AttachmentContent** object. @@ -14270,7 +13582,7 @@ declare namespace Office { * * @beta */ - getAttachmentContentAsync(attachmentId: string, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentContentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -14297,7 +13609,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -14322,26 +13634,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the properties of an appointment or message in a shared folder, calendar, or mailbox. @@ -14362,7 +13655,7 @@ declare namespace Office { * * @beta */ - getSharedPropertiesAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSharedPropertiesAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the properties of an appointment or message in a shared folder, calendar, or mailbox. @@ -14381,7 +13674,7 @@ declare namespace Office { * * @beta */ - getSharedPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + getSharedPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. @@ -14408,32 +13701,8 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. @@ -14457,7 +13726,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. @@ -14479,27 +13748,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * The compose mode of {@link Office.Item | Office.context.mailbox.item}. @@ -14526,6 +13775,7 @@ declare namespace Office { * */ subject: Subject; + /** * Adds a file to a message or appointment as an attachment. * @@ -14550,12 +13800,12 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the * attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14576,34 +13826,12 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. @@ -14628,13 +13856,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14655,37 +13883,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentFromBase64Async method uploads the file from the base64 encoding and attaches it to the item in the compose form. This method returns the attachment identifier in the asyncResult.value object. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param base64File - The base64 encoded content of an image or file to be added to an email or event. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. @@ -14711,14 +13915,14 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -14743,38 +13947,12 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. You can use the options parameter to pass state information to the - * callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed @@ -14817,7 +13995,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -14836,22 +14014,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -14878,7 +14041,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -14903,26 +14066,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -14951,7 +14095,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -14978,7 +14122,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -15005,53 +14149,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - */ - removeAttachmentAsync(attachmentId: string, options: Office.AsyncContextOptions): void; + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes an attachment from a message or appointment. * @@ -15076,7 +14174,7 @@ declare namespace Office { * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. @@ -15109,13 +14207,13 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -15147,44 +14245,11 @@ declare namespace Office { * ErrorsInvalidAttachmentId - The attachment identifier does not exist. * * - */ - saveAsync(): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -15204,7 +14269,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -15213,10 +14278,10 @@ declare namespace Office { * If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -15236,31 +14301,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -15407,33 +14451,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -15461,33 +14479,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -15513,7 +14505,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. * @@ -15537,25 +14529,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -16013,12 +14987,12 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the * attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16039,34 +15013,12 @@ declare namespace Office { * * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addFileAttachmentAsync(uri: string, attachmentName: string): void; - /** - * Adds a file to a message or appointment as an attachment. - * - * The addFileAttachmentAsync method uploads the file at the specified URI and attaches it to the item in the compose form. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsAttachmentSizeExceeded - The attachment is larger than allowed.
FileTypeNotSupported - The attachment has an extension that is not allowed.
NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param uri - The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16090,13 +15042,13 @@ declare namespace Office { * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: Office.AsyncContextOptions & { isInline: boolean }, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16117,13 +15069,13 @@ declare namespace Office { * * @param base64File - The base64 encoded content of an image or file to be added to an email or event. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * On success, the attachment identifier will be provided in the asyncResult.value property. * If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of the error. * * @beta */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (result: Office.AsyncResult) => void): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -16148,7 +15100,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -16171,28 +15123,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -16217,14 +15148,14 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. * @@ -16249,38 +15180,12 @@ declare namespace Office { * * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - */ - addItemAttachmentAsync(itemId: any, attachmentName: string): void; - /** - * Adds an Exchange item, such as a message, as an attachment to the message or appointment. - * - * The addItemAttachmentAsync method attaches the item with the specified Exchange identifier to the item in the compose form. - * If you specify a callback method, the method is called with one parameter, asyncResult, which contains either the attachment identifier or - * a code that indicates any error that occurred while attaching the item. - * You can use the options parameter to pass state information to the callback method, if needed. - * - * You can subsequently use the identifier with the removeAttachmentAsync method to remove the attachment in the same session. - * - * If your Office add-in is running in Outlook Web App, the addItemAttachmentAsync method can attach items to items other than the item that - * you are editing; however, this is not supported and is not recommended. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsNumberOfAttachmentsExceeded - The message or appointment has too many attachments.
- * - * @param itemId - The Exchange identifier of the item to attach. The maximum length is 100 characters. - * @param attachmentName - The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property. * If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of * the error. */ - addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: Office.AsyncResult) => void): void; + addItemAttachmentAsync(itemId: any, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Closes the current item that is being composed * @@ -16322,7 +15227,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the item's attachments as an array. * @@ -16341,22 +15246,7 @@ declare namespace Office { * * @beta */ - getAttachmentsAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets the item's attachments as an array. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @beta - */ - getAttachmentsAsync(): void; + getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -16384,7 +15274,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -16410,27 +15300,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is activated by an actionable message. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the web - * for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * More information on {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | actionable messages}. - * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -16459,7 +15329,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously returns selected data from the subject or body of a message. * @@ -16486,7 +15356,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - getSelectedDataAsync(coercionType: Office.CoercionType, callback: (result: Office.AsyncResult) => void): void; + getSelectedDataAsync(coercionType: Office.CoercionType, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously loads custom properties for this add-in on the selected item. * @@ -16512,19 +15382,67 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** - * Asynchronously loads custom properties for this add-in on the selected item. + * Removes an attachment from a message or appointment. * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. + * [Api set: Mailbox 1.1] * - * [Api set: Mailbox 1.0] + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param attachmentId - The identifier of the attachment to remove. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes an attachment from a message or appointment. + * + * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. + * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment + * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. + * + * [Api set: Mailbox 1.1] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param attachmentId - The identifier of the attachment to remove. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. + */ + removeAttachmentAsync(attachmentId: string, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes the event handlers for a supported event type. + * + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. + * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. + * + * [Api set: Mailbox 1.7] * * @remarks * @@ -16532,254 +15450,107 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose * + * + * @param eventType - The event that should revoke the handler. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Removes the event handlers for a supported event type. + * + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. + * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. + * + * [Api set: Mailbox 1.7] + * + * @remarks + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
+ * + * @param eventType - The event that should revoke the handler. + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. + * + * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. + * + * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
+ * + * @param options - An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + */ + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; + /** + * Asynchronously saves an item. + * + * When invoked, this method saves the current message as a draft and returns the item id via the callback method. + * In Outlook Web App or Outlook in online mode, the item is saved to the server. + * In Outlook in cached mode, the item is saved to the local cache. + * + * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal + * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. + * Saving an existing appointment will send an update to added or removed attendees. + * + * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that + * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. + * Until the item is synced, using the itemId will return an error. + * + * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: + * + * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. + * + * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. + * + * [Api set: Mailbox 1.3] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
* * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. - */ - removeAttachmentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - */ - removeAttachmentAsync(attachmentId: string): void; - /** - * Removes an attachment from a message or appointment. - * - * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. - * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment - * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to - * continue in a separate window. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param attachmentId - The identifier of the attachment to remove. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure. - */ - removeAttachmentAsync(attachmentId: string, callback: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should revoke the handler. - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param eventType - The event that should revoke the handler. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - removeHandlerAsync(eventType: Office.EventType): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param options - Optional. An object literal that contains one or more of the following properties. - * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - */ - saveAsync(): void; - /** - * Asynchronously saves an item. - * - * When invoked, this method saves the current message as a draft and returns the item id via the callback method. - * In Outlook Web App or Outlook in online mode, the item is saved to the server. - * In Outlook in cached mode, the item is saved to the local cache. - * - * Since appointments have no draft state, if saveAsync is called on an appointment in compose mode, the item will be saved as a normal - * appointment on the user's calendar. For new appointments that have not been saved before, no invitation will be sent. - * Saving an existing appointment will send an update to added or removed attendees. - * - * **Note**: If your add-in calls saveAsync on an item in compose mode in order to get an itemId to use with EWS or the REST API, be aware that - * when Outlook is in cached mode, it may take some time before the item is actually synced to the server. - * Until the item is synced, using the itemId will return an error. - * - * **Note**: The following clients have different behavior for saveAsync on appointments in compose mode: - * - * - Mac Outlook does not support saveAsync on a meeting in compose mode. Calling saveAsync on a meeting in Mac Outlook will return an error. - * - * - Outlook on the web always sends an invitation or update when saveAsync is called on an appointment in compose mode. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - saveAsync(callback: (result: Office.AsyncResult) => void): void; + saveAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -16799,7 +15570,7 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * coercionType: If text, the current style is applied in Outlook Web App and Outlook. * If the field is an HTML editor, only the text data is inserted, even if the data is HTML. @@ -16807,10 +15578,10 @@ declare namespace Office { * applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. * If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used; * if the field is text, then plain text is used. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -16830,31 +15601,10 @@ declare namespace Office { * * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - */ - setSelectedDataAsync(data: string): void; - /** - * Asynchronously inserts data into the body or subject of a message. - * - * The setSelectedDataAsync method inserts the specified string at the cursor location in the subject or body of the item, or, if text is - * selected in the editor, it replaces the selected text. If the cursor is not in the body or subject field, an error is returned. - * After insertion, the cursor is placed at the end of the inserted content. - * - * [Api set: Mailbox 1.2] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
ErrorsInvalidAttachmentId - The attachment identifier does not exist.
- * - * @param data - The data to be inserted. Data is not to exceed 1,000,000 characters. - * If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The message read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -17240,13 +15990,12 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -17263,28 +16012,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: any): void; + addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the * selected appointment. @@ -17312,33 +16040,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyAllForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes the sender and all recipients of the selected message or the organizer and all attendees of the - * selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyAllForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyAllForm(formData: string | ReplyFormData): void; + displayReplyAllForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. * @@ -17366,33 +16068,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - displayReplyForm(formData: string | ReplyFormData, callback?: (result: Office.AsyncResult) => void): void; - /** - * Displays a reply form that includes only the sender of the selected message or the organizer of the selected appointment. - * - * In Outlook Web App, the reply form is displayed as a pop-out form in the 3-column view and a pop-up form in the 2- or 1-column view. - * - * If any of the string parameters exceed their limits, displayReplyForm throws an exception. - * - * When attachments are specified in the formData.attachments parameter, Outlook and Outlook Web App attempt to download all attachments and - * attach them to the reply form. If any attachments fail to be added, an error is shown in the form UI. - * If this isn't possible, then no error message is thrown. - * - * **Note**: This method is not supported in Outlook for iOS or Outlook for Android. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param formData - A string that contains text and HTML and that represents the body of the reply form. The string is limited to 32 KB - * OR an {@link Office.ReplyFormData} object that contains body or attachment data and a callback function. - */ - displayReplyForm(formData: string | ReplyFormData): void; + displayReplyForm(formData: string | ReplyFormData, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -17419,7 +16095,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getInitializationContextAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -17444,26 +16120,7 @@ declare namespace Office { * * @beta */ - getInitializationContextAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Gets initialization data passed when the add-in is - * {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. - * - * **Note**: This method is only supported by Outlook 2016 for Windows (Click-to-Run versions greater than 16.0.8413.1000) and Outlook on the - * web for Office 365. - * - * [Api set: Mailbox Preview] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @beta - */ - getInitializationContextAsync(): void; + getInitializationContextAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the entities found in the selected item's body. * @@ -17701,31 +16358,7 @@ declare namespace Office { * @param userContext - Optional. Developers can provide any object they wish to access in the callback function. * This object can be accessed by the asyncResult.asyncContext property in the callback function. */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Asynchronously loads custom properties for this add-in on the selected item. - * - * Custom properties are stored as key/value pairs on a per-app, per-item basis. - * This method returns a CustomProperties object in the callback, which provides methods to access the custom properties specific to the - * current item and the current add-in. Custom properties are not encrypted on the item, so this should not be used as secure storage. - * - * The custom properties are provided as a CustomProperties object in the asyncResult.value property. - * This object can be used to get, set, and remove custom properties from the item and save changes to the custom property set back to - * the server. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - */ - loadCustomPropertiesAsync(callback: (result: Office.AsyncResult) => void): void; + loadCustomPropertiesAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. * @@ -17748,7 +16381,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: any, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -17769,26 +16402,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. - * In Preview, `Office.EventType.AttachmentsChanged` and `Office.EventType.EnhancedLocationsChanged` are also supported. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -17855,9 +16469,9 @@ declare namespace Office { * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. * The location of the appointment is provided as a string in the asyncResult.value property. * - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * * [Api set: Mailbox 1.1] @@ -17868,14 +16482,14 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the location of an appointment. * * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. * The location of the appointment is provided as a string in the asyncResult.value property. * - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * * [Api set: Mailbox 1.1] @@ -17886,22 +16500,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * */ - getAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Gets the location of an appointment. - * - * The getAsync method starts an asynchronous call to the Exchange server to get the location of an appointment. - * The location of the appointment is provided as a string in the asyncResult.value property. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
- */ - getAsync(): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the location of an appointment. * @@ -17923,25 +16522,7 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters. * */ - setAsync(location: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Sets the location of an appointment. - * - * The setAsync method starts an asynchronous call to the Exchange server to set the location of an appointment. - * Setting the location of an appointment overwrites the current location. - * - * @param location - The location of the appointment. The string is limited to 255 characters. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters.
- */ - setAsync(location: string): void; + setAsync(location: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the location of an appointment. * @@ -17961,7 +16542,7 @@ declare namespace Office { * ErrorsDataExceedsMaximumSize - The location parameter is longer than 255 characters. * */ - setAsync(location: string, callback: (result: Office.AsyncResult) => void): void; + setAsync(location: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Provides access to the Outlook Add-in object model for Microsoft Outlook and Microsoft Outlook on the web. @@ -18088,7 +16669,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -18110,27 +16691,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds an event handler for a supported event. - * - * Currently, the only supported event type is `Office.EventType.ItemChanged`. - * In Preview, `Office.EventType.OfficeThemeChanged` is also supported. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should invoke the handler. - * @param handler - The function to handle the event. The function must accept a single parameter, which is an object literal. - * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. - */ - addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Converts an item ID formatted for REST into EWS format. * @@ -18392,36 +16953,7 @@ declare namespace Office { * type Office.AsyncResult. The token is provided as a string in the `asyncResult.value` property. * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. */ - getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (result: Office.AsyncResult) => void): void; - /** - * Gets a string that contains a token used to get an attachment or item from an Exchange Server. - * - * The getCallbackTokenAsync method makes an asynchronous call to get an opaque token from the Exchange Server that hosts the user's mailbox. - * The lifetime of the callback token is 5 minutes. - * - * You can pass the token and an attachment identifier or item identifier to a third-party system. - * The third-party system uses the token as a bearer authorization token to call the Exchange Web Services (EWS) GetAttachment or - * GetItem operation to return an attachment or item. For example, you can create a remote service to get attachments from the selected item. - * - * Your app must have the ReadItem permission specified in its manifest to call the getCallbackTokenAsync method in read mode. - * - * In compose mode you must call the saveAsync method to get an item identifier to pass to the getCallbackTokenAsync method. - * Your app must have ReadWriteItem permissions to call the saveAsync method. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. - * The token is provided as a string in the `asyncResult.value` property. - * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. - */ - getCallbackTokenAsync(callback: (result: Office.AsyncResult) => void): void; + getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a string that contains a token used to get an attachment or item from an Exchange Server. * @@ -18451,7 +16983,7 @@ declare namespace Office { * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. * @param userContext - Optional. Any state data that is passed to the asynchronous method. */ - getCallbackTokenAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; + getCallbackTokenAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Gets a token identifying the user and the Office Add-in. * @@ -18475,30 +17007,7 @@ declare namespace Office { * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. * @param userContext - Optional. Any state data that is passed to the asynchronous method.| */ - getUserIdentityTokenAsync(callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Gets a token identifying the user and the Office Add-in. - * - * The token is provided as a string in the asyncResult.value property. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * The getUserIdentityTokenAsync method returns a token that you can use to identify and - * {@link https://docs.microsoft.com/outlook/add-ins/authentication | authenticate the add-in and user with a third-party system}. - * - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. - * The token is provided as a string in the `asyncResult.value` property. - * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. - */ - getUserIdentityTokenAsync(callback: (result: Office.AsyncResult) => void): void; + getUserIdentityTokenAsync(callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Makes an asynchronous request to an Exchange Web Services (EWS) service on the Exchange server that hosts the user's mailbox. * @@ -18552,60 +17061,7 @@ declare namespace Office { * If the result exceeds 1 MB in size, an error message is returned instead. * @param userContext - Optional. Any state data that is passed to the asynchronous method. */ - makeEwsRequestAsync(data: any, callback: (result: Office.AsyncResult) => void, userContext?: any): void; - /** - * Makes an asynchronous request to an Exchange Web Services (EWS) service on the Exchange server that hosts the user's mailbox. - * - * In these cases, add-ins should use REST APIs to access the user's mailbox instead. - * - * The makeEwsRequestAsync method sends an EWS request on behalf of the add-in to Exchange. - * - * You cannot request Folder Associated Items with the makeEwsRequestAsync method. - * - * The XML request must specify UTF-8 encoding. \ - * - * Your add-in must have the ReadWriteMailbox permission to use the makeEwsRequestAsync method. - * For information about using the ReadWriteMailbox permission and the EWS operations that you can call with the makeEwsRequestAsync method, - * see {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Specify permissions for mail add-in access to the user's mailbox}. - * - * The XML result of the EWS call is provided as a string in the asyncResult.value property. - * If the result exceeds 1 MB in size, an error message is returned instead. - * - * **Note**: This method is not supported in the following scenarios: - * - * - In Outlook for iOS or Outlook for Android. - * - * - When the add-in is loaded in a Gmail mailbox. - * - * **Note**: The server administrator must set OAuthAuthentication to true on the Client Access Server EWS directory to enable the - * makeEwsRequestAsync method to make EWS requests. - * - * *Version differences* - * - * When you use the makeEwsRequestAsync method in mail apps running in Outlook versions earlier than version 15.0.4535.1004, you should set - * the encoding value to ISO-8859-1. - * - * `` - * - * You do not need to set the encoding value when your mail app is running in Outlook on the web. - * You can determine whether your mail app is running in Outlook or Outlook on the web by using the mailbox.diagnostics.hostName property. - * You can determine what version of Outlook is running by using the mailbox.diagnostics.hostVersion property. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteMailbox
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param data - The EWS request. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. - * The `value` property of the result is the XML of the EWS request provided as a string. - * If the result exceeds 1 MB in size, an error message is returned instead. - */ - makeEwsRequestAsync(data: any, callback: (result: Office.AsyncResult) => void): void; + makeEwsRequestAsync(data: any, callback: (asyncResult: Office.AsyncResult) => void, userContext?: any): void; /** * Removes the event handlers for a supported event type. * @@ -18626,7 +17082,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeHandlerAsync(eventType: Office.EventType, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + removeHandlerAsync(eventType: Office.EventType, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes the event handlers for a supported event type. * @@ -18646,25 +17102,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeHandlerAsync(eventType: Office.EventType, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes the event handlers for a supported event type. - * - * Currently, the only supported event type is `Office.EventType.ItemChanged`. - * In Preview, `Office.EventType.OfficeThemeChanged` is also supported. - * - * [Api set: Mailbox 1.5] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param eventType - The event that should revoke the handler. - */ - removeHandlerAsync(eventType: Office.EventType): void; + removeHandlerAsync(eventType: Office.EventType, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -18786,26 +17224,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - addAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a notification to an item. - * - * There are a maximum of 5 notifications per message. Setting more will return a NumberOfNotificationMessagesExceeded error. - * - * @param key - A developer-specified key used to reference this notification message. Developers can use it to modify this message later. - * It can't be longer than 32 characters. - * @param JSONmessage - A JSON object that contains the notification message to be added to the item. - * It contains a NotificationMessageDetails object. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - addAsync(key: string, JSONmessage: NotificationMessageDetails): void; + addAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a notification to an item. * @@ -18826,7 +17245,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * */ - addAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: Office.AsyncResult) => void): void; + addAsync(key: string, JSONmessage: NotificationMessageDetails, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns all keys and messages for an item. * @@ -18843,7 +17262,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is an array of NotificationMessageDetails objects. */ - getAllAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAllAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns all keys and messages for an item. * @@ -18858,19 +17277,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is an array of NotificationMessageDetails objects. */ - getAllAsync(callback: (result: Office.AsyncResult) => void): void; - /** - * Returns all keys and messages for an item. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - getAllAsync(): void; + getAllAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes a notification message for an item. * @@ -18883,24 +17290,12 @@ declare namespace Office { * * * @param key - The key for the notification message to remove. + * @param options - Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeAsync(key: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Removes a notification message for an item. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param key - The key for the notification message to remove. - */ - removeAsync(key: string): void; + removeAsync(key: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Removes a notification message for an item. * @@ -18916,7 +17311,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - removeAsync(key: string, callback: (result: Office.AsyncResult) => void): void; + removeAsync(key: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces a notification message that has a given key with another message. * @@ -18938,25 +17333,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Replaces a notification message that has a given key with another message. - * - * If a notification message with the specified key doesn't exist, replaceAsync will add the notification. - * - * [Api set: Mailbox 1.3] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- * - * @param key - The key for the notification message to replace. It can't be longer than 32 characters. - * @param JSONmessage - A JSON object that contains the new notification message to replace the existing message. - * It contains a NotificationMessageDetails object. - */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails): void; + replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces a notification message that has a given key with another message. * @@ -18976,7 +17353,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: Office.AsyncResult) => void): void; + replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Represents a phone number identified in an item. Read mode only. @@ -19042,30 +17419,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code. */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; - /** - * Adds a recipient list to the existing recipients for an appointment or message. - * - * The recipients parameter can be an array of one of the following: - * - * - Strings containing SMTP email addresses - * - * - EmailUser objects - * - * - EmailAddressDetails objects - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
- * - * @param recipients - The recipients to add to the recipients list. - */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void; + addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a recipient list to the existing recipients for an appointment or message. * @@ -19090,7 +17444,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code. */ - addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: Office.AsyncResult) => void): void; + addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * @@ -19110,7 +17464,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is an array of EmailAddressDetails objects. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * @@ -19128,7 +17482,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is an array of EmailAddressDetails objects. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets a recipient list for an appointment or message. * @@ -19152,14 +17506,14 @@ declare namespace Office { * * * @param recipients - The recipients to add to the recipients list. - * @param options - Optional. An object literal that contains one or more of the following properties. + * @param options - An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred * while adding the data. */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets a recipient list for an appointment or message. * @@ -19183,38 +17537,12 @@ declare namespace Office { * * * @param recipients - The recipients to add to the recipients list. - */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void; - /** - * Sets a recipient list for an appointment or message. - * - * The setAsync method overwrites the current recipient list. - * - * The recipients parameter can be an array of one of the following: - * - * - Strings containing SMTP email addresses - * - * - {@link Office.EmailUser} objects - * - * - {@link Office.EmailAddressDetails} objects - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
- * - * @param recipients - The recipients to add to the recipients list. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred * while adding the data. */ - setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: Office.AsyncResult) => void): void; - + setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -19349,7 +17677,7 @@ declare namespace Office { * asyncResult, which is an Office.AsyncResult object. * The `value` property of the result is a Recurrence object. */ - getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Returns the current recurrence object of an appointment series. @@ -19369,23 +17697,7 @@ declare namespace Office { * asyncResult, which is an Office.AsyncResult object. * The `value` property of the result is a Recurrence object. */ - getAsync(callback?: (result: Office.AsyncResult) => void): void; - - /** - * Returns the current recurrence object of an appointment series. - * - * This method returns the entire recurrence object for the appointment series. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - getAsync(): void; + getAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the recurrence pattern of an appointment series. @@ -19408,7 +17720,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - setAsync(recurrencePattern: Recurrence, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(recurrencePattern: Recurrence, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the recurrence pattern of an appointment series. @@ -19429,28 +17741,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - setAsync(recurrencePattern: Recurrence, callback?: (result: Office.AsyncResult) => void): void; - - /** - * Sets the recurrence pattern of an appointment series. - * - * **Note**: setAsync should only be available for series items and not instance items. - * - * [Api set: Mailbox 1.7] - * - * @remarks - * - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidEndTime - The appointment end time is before its start time.
- * - * @param recurrencePattern - A recurrence object. - * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. - */ - setAsync(recurrencePattern: Recurrence): void; + setAsync(recurrencePattern: Recurrence, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -19564,7 +17855,7 @@ declare namespace Office { * When the reply display call completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. */ - callback?: (result: Office.AsyncResult) => void; + callback?: (asyncResult: Office.AsyncResult) => void; } /** * The settings created by using the methods of the RoamingSettings object are saved per add-in and per user. @@ -19639,23 +17930,7 @@ declare namespace Office { * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. */ - saveAsync(callback?: (result: Office.AsyncResult) => void): void; - /** - * Saves the settings. - * - * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use - * the set and get methods to work with the in-memory copy of the settings property bag. - * When you want to persist the settings so that they are available the next time the add-in is used, use the saveAsync method. - * - * [Api set: Mailbox 1.0] - * - * @remarks - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}Restricted
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read
- */ - saveAsync(): void; + saveAsync(callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets or creates the specified setting. * @@ -19937,7 +18212,7 @@ declare namespace Office { * type Office.AsyncResult. * The `value` property of the result is the subject of the item. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the subject of an appointment or message. * @@ -19954,7 +18229,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is the subject of the item. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the subject of an appointment or message. * @@ -19971,12 +18246,12 @@ declare namespace Office { * * * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code. */ - setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the subject of an appointment or message. * @@ -19993,28 +18268,10 @@ declare namespace Office { * * * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - */ - setAsync(data: string): void; - /** - * Sets the subject of an appointment or message. - * - * The setAsync method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. - * Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsDataExceedsMaximumSize - The subject parameter is longer than 255 characters.
- * - * @param subject - The subject of the appointment or message. The string is limited to 255 characters. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code. */ - setAsync(data: string, callback: (result: Office.AsyncResult) => void): void; + setAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -20072,7 +18329,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is a Date object. */ - getAsync(options: Office.AsyncContextOptions, callback: (result: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the start or end time of an appointment. * @@ -20090,7 +18347,7 @@ declare namespace Office { * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The `value` property of the result is a Date object. */ - getAsync(callback: (result: Office.AsyncResult) => void): void; + getAsync(callback: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the start or end time of an appointment. * @@ -20109,13 +18366,13 @@ declare namespace Office { * * * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - * @param options - An object literal that contains one or more of the following properties. + * @param options - Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the date and time fails, the asyncResult.error property will contain an error code. */ - setAsync(dateTime: Date, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + setAsync(dateTime: Date, options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Sets the start or end time of an appointment. * @@ -20134,31 +18391,11 @@ declare namespace Office { * * * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - */ - setAsync(dateTime: Date): void; - /** - * Sets the start or end time of an appointment. - * - * If the setAsync method is called on the start property, the end property will be adjusted to maintain the duration of the appointment as - * previously set. If the setAsync method is called on the end property, the duration of the appointment will be extended to the new end time. - * - * The time must be in UTC; you can get the correct UTC time by using the convertToUtcClientTime method. - * - * [Api set: Mailbox 1.1] - * - * @remarks - * - * - * - * - *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidEndTime - The appointment end time is before the appointment start time.
- * - * @param dateTime - A date-time object in Coordinated Universal Time (UTC). - * @param callback - When the method completes, the function passed in the callback parameter is called with a single parameter of + * @param callback - Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. * If setting the date and time fails, the asyncResult.error property will contain an error code. */ - setAsync(dateTime: Date, callback: (result: Office.AsyncResult) => void): void; + setAsync(dateTime: Date, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** diff --git a/types/p-throttle/index.d.ts b/types/p-throttle/index.d.ts deleted file mode 100644 index ae331e1ca2..0000000000 --- a/types/p-throttle/index.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -// Type definitions for p-throttle 1.1 -// Project: https://github.com/sindresorhus/p-throttle#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pThrottle; - -declare function pThrottle(fn: () => PromiseLike | R, limit: number, interval: number): (() => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1) => PromiseLike | R, limit: number, interval: number): ((arg1: T1) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1, arg2: T2) => PromiseLike | R, limit: number, interval: number): ((arg1: T1, arg2: T2) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1, arg2: T2, arg3: T3) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise) & { abort(): void; }; -declare function pThrottle( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7) => Promise) & { abort(): void; }; -declare function pThrottle( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8) => Promise) & { abort(): void; }; -declare function pThrottle( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9) => Promise) & { abort(): void; }; -declare function pThrottle( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10) => PromiseLike | R, - limit: number, - interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10) => Promise) & { abort(): void; }; -declare function pThrottle(fn: (...args: any[]) => PromiseLike | R, limit: number, interval: number): ((...args: any[]) => Promise) & { abort(): void; }; - -declare namespace pThrottle { - class AbortError extends Error { - readonly name: 'AbortError'; - - constructor(); - } -} diff --git a/types/p-throttle/p-throttle-tests.ts b/types/p-throttle/p-throttle-tests.ts deleted file mode 100644 index 713d445e6b..0000000000 --- a/types/p-throttle/p-throttle-tests.ts +++ /dev/null @@ -1,47 +0,0 @@ -import pThrottle = require('p-throttle'); - -const now = Date.now(); - -const throttled = pThrottle((i: number) => { - const secDiff = ((Date.now() - now) / 1000).toFixed(); - return Promise.resolve(`${i}: ${secDiff}s`); -}, 2, 1000); - -for (let i = 1; i <= 6; i++) { - throttled(i).then(res => { - const str: string = res; - }); -} - -throttled.abort(); - -pThrottle(() => true, 2, 3).abort(); -pThrottle(() => true, 2, 3)(); -pThrottle((n: number, s: string) => true, 2, 3).abort(); -pThrottle((n: number, s: string) => true, 2, 3)(1, 's'); -pThrottle((n: number, s: string, b: boolean) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean) => true, 2, 3)(1, 's', true); -pThrottle((n: number, s: string, b: boolean, n2: number) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number) => true, 2, 3)(1, 's', true, 1); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string) => true, 2, 3)(1, 's', true, 1, 's'); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean) => true, 2, 3)(1, 's', true, 1, 's', false); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1, 2); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1, 2, 3); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number) => true, 2, 3).abort(); -pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1, 2, 3, 4); -pThrottle( - (n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number, s3: string) => true, - 2, - 3).abort(); -pThrottle( - (n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number, s3: string) => true, - 2, - 3)(1, 's', true, 1, 's', false, 1, 2, 3, 4, 'as'); - -throw new pThrottle.AbortError(); diff --git a/types/parse-unit/index.d.ts b/types/parse-unit/index.d.ts index 238f3cfc06..7b37d0e64b 100644 --- a/types/parse-unit/index.d.ts +++ b/types/parse-unit/index.d.ts @@ -3,5 +3,5 @@ // Definitions by: Jack Works // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function parse(value: string): [number, string]; +declare function parse(value: string | number): [number, string]; export = parse; diff --git a/types/parse-unit/parse-unit-tests.ts b/types/parse-unit/parse-unit-tests.ts index dd5dcb7e9f..5cd4b180b8 100644 --- a/types/parse-unit/parse-unit-tests.ts +++ b/types/parse-unit/parse-unit-tests.ts @@ -2,3 +2,7 @@ import parse = require('parse-unit'); const [number, length] = parse('10px'); number === 50; length === 'px'; + +parse(10).length === 2; +parse(10)[0] === 10; +parse(10)[1] === ''; diff --git a/types/petit-dom/index.d.ts b/types/petit-dom/index.d.ts index 52e507f980..7f850bb1dd 100644 --- a/types/petit-dom/index.d.ts +++ b/types/petit-dom/index.d.ts @@ -98,6 +98,7 @@ export namespace PetitDom { }; interface IntrinsicProps { + content?: Content | ReadonlyArray; key?: Key; } diff --git a/types/postcss-nested/index.d.ts b/types/postcss-nested/index.d.ts new file mode 100644 index 0000000000..6bf8c45349 --- /dev/null +++ b/types/postcss-nested/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for postcss-nested 4.1 +// Project: https://github.com/postcss/postcss-nested#readme +// Definitions by: Maxim Vorontsov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import { Plugin } from 'postcss'; + +declare namespace nested { + interface Options { + /** + * By default, plugin will bubble only @media and @supports at-rules. + * You can add your custom at-rules to this list by this option. + */ + bubble?: string[]; + + /** + * By default, plugin will unwrap only @font-face, @keyframes and @document at-rules. + * You can add your custom at-rules to this list by this option. + */ + unwrap?: string[]; + + /** + * By default, plugin will strip out any empty selector generated by intermediate nesting + * levels. You can set this option to true to preserve them. + */ + preserveEmpty?: boolean; + } + + type Nested = Plugin; +} + +declare const nested: nested.Nested; +export = nested; diff --git a/types/postcss-nested/package.json b/types/postcss-nested/package.json new file mode 100644 index 0000000000..1e1a719545 --- /dev/null +++ b/types/postcss-nested/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "postcss": "7.x.x" + } +} diff --git a/types/postcss-nested/postcss-nested-tests.ts b/types/postcss-nested/postcss-nested-tests.ts new file mode 100644 index 0000000000..86b0401559 --- /dev/null +++ b/types/postcss-nested/postcss-nested-tests.ts @@ -0,0 +1,12 @@ +import * as postcss from 'postcss'; +import nested = require('postcss-nested'); + +const withDefaultOptions: postcss.Transformer = nested(); +const withCustomOptions: postcss.Transformer = nested({ + bubble: ['phone'], + unwrap: ['phone'], + preserveEmpty: true +}); + +postcss().use(withDefaultOptions); +postcss().use(withCustomOptions); diff --git a/types/postcss-nested/tsconfig.json b/types/postcss-nested/tsconfig.json new file mode 100644 index 0000000000..b6e9346303 --- /dev/null +++ b/types/postcss-nested/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "postcss-nested-tests.ts" + ] +} diff --git a/types/postcss-nested/tslint.json b/types/postcss-nested/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/postcss-nested/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pretty/index.d.ts b/types/pretty/index.d.ts new file mode 100644 index 0000000000..a1bdfcb5a7 --- /dev/null +++ b/types/pretty/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for pretty 2.0 +// Project: https://github.com/jonschlinkert/pretty +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface PrettyOptions { + ocd: boolean; +} + +declare function pretty(str: string, options?: PrettyOptions): string; + +export = pretty; diff --git a/types/pretty/pretty-tests.ts b/types/pretty/pretty-tests.ts new file mode 100644 index 0000000000..0fe99519b4 --- /dev/null +++ b/types/pretty/pretty-tests.ts @@ -0,0 +1,5 @@ +import pretty = require("pretty"); + +pretty(`

nice

`); + +pretty(`

nice

`, {ocd: true}); diff --git a/types/pretty/tsconfig.json b/types/pretty/tsconfig.json new file mode 100644 index 0000000000..b46d610e45 --- /dev/null +++ b/types/pretty/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pretty-tests.ts" + ] +} diff --git a/types/pretty/tslint.json b/types/pretty/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/pretty/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/raygun/index.d.ts b/types/raygun/index.d.ts index 9315161a33..b2da46c446 100644 --- a/types/raygun/index.d.ts +++ b/types/raygun/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -declare namespace raygun { +export namespace raygun { interface KeyValueObject { [key: string]: string | number | boolean | KeyValueObject; } @@ -143,4 +143,4 @@ declare class Client { ): void; } -export = Client; +export { Client }; diff --git a/types/raygun/raygun-tests.ts b/types/raygun/raygun-tests.ts index 76328b01c5..abef1e9021 100644 --- a/types/raygun/raygun-tests.ts +++ b/types/raygun/raygun-tests.ts @@ -1,6 +1,6 @@ -import Client = require('raygun'); +import raygun = require('raygun'); -const client = new Client(); // $ExpectType Client +const client = new raygun.Client(); // $ExpectType Client client.init({apiKey: '1'}); // $ExpectType Client client.init(); // $ExpectError diff --git a/types/rc-time-picker/package.json b/types/rc-time-picker/package.json new file mode 100644 index 0000000000..f06689a6b9 --- /dev/null +++ b/types/rc-time-picker/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "moment": "^2.19.4" + } +} diff --git a/types/react-aria-menubutton/index.d.ts b/types/react-aria-menubutton/index.d.ts index 157fdff642..dc3d975d64 100644 --- a/types/react-aria-menubutton/index.d.ts +++ b/types/react-aria-menubutton/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-aria-menubutton 6.1 +// Type definitions for react-aria-menubutton 6.2 // Project: https://github.com/davidtheclark/react-aria-menubutton // Definitions by: Muhammad Fawwaz Orabi // Chris Rohlfs @@ -100,7 +100,7 @@ export interface MenuItemProps * If value has a value, it will be passed to the onSelection handler * when the `MenuItem` is selected */ - value?: string | boolean | number; + value?: any; /** * If `text` has a value, its first letter will be the letter a user can diff --git a/types/react-aria-menubutton/react-aria-menubutton-tests.tsx b/types/react-aria-menubutton/react-aria-menubutton-tests.tsx index f284e932a4..e3b543103a 100644 --- a/types/react-aria-menubutton/react-aria-menubutton-tests.tsx +++ b/types/react-aria-menubutton/react-aria-menubutton-tests.tsx @@ -121,3 +121,18 @@ closeMenu("", { focusMenu: true }); openMenu(""); openMenu("", { focusMenu: true }); + +class ObjectMenuItem extends React.Component { + render() { + const itemValue = { name: "Test name", label: "Only item to select" }; + return ( + console.log(value.name)}> +
  • + {itemValue.label} +
  • +
    + ); + } +} + +ReactDOM.render(, document.body); diff --git a/types/react-big-calendar/index.d.ts b/types/react-big-calendar/index.d.ts index 3607086e06..7a6bebe1c2 100644 --- a/types/react-big-calendar/index.d.ts +++ b/types/react-big-calendar/index.d.ts @@ -114,7 +114,7 @@ export interface HeaderProps { } export interface Components { - event?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + event?: React.ComponentType; eventWrapper?: React.ComponentType; eventContainerWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; dayWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; @@ -157,6 +157,11 @@ export interface ToolbarProps { children?: React.ReactNode; } +export interface EventProps { + event: T; + title: string; +} + export interface EventWrapperProps { // https://github.com/intljusticemission/react-big-calendar/blob/27a2656b40ac8729634d24376dff8ea781a66d50/src/TimeGridEvent.js#L28 style?: React.CSSProperties & { xOffset: number }; diff --git a/types/react-draft-wysiwyg/index.d.ts b/types/react-draft-wysiwyg/index.d.ts index 7b9b3577d8..46fab16511 100644 --- a/types/react-draft-wysiwyg/index.d.ts +++ b/types/react-draft-wysiwyg/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jpuri/react-draft-wysiwyg#readme // Definitions by: imechZhangLY // brunoMaurice +// ldanet // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -18,9 +19,9 @@ export class ContentBlock extends Draft.ContentBlock {} export class SelectionState extends Draft.SelectionState {} export interface EditorProps { - onChange?(contentState: ContentState): RawDraftContentState; + onChange?(contentState: RawDraftContentState): void; onEditorStateChange?(editorState: EditorState): void; - onContentStateChange?(contentState: ContentState): RawDraftContentState; + onContentStateChange?(contentState: RawDraftContentState): void; initialContentState?: RawDraftContentState; defaultContentState?: RawDraftContentState; contentState?: RawDraftContentState; diff --git a/types/react-draft-wysiwyg/test/uncontrolled-raw-draft-content-state.tsx b/types/react-draft-wysiwyg/test/uncontrolled-raw-draft-content-state.tsx new file mode 100644 index 0000000000..4118ce2d09 --- /dev/null +++ b/types/react-draft-wysiwyg/test/uncontrolled-raw-draft-content-state.tsx @@ -0,0 +1,48 @@ +// From https://github.com/jpuri/react-draft-wysiwyg/blob/master/docs/src/components/Docs/Props/EditorStateProp/index.js#L125 + +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import { Editor, RawDraftContentState } from "react-draft-wysiwyg"; + +class UncontrolledEditor extends React.Component< + {}, + { contentState: RawDraftContentState } +> { + constructor(props: any) { + super(props); + this.state = { + contentState: JSON.parse(`{ + "entityMap":{}, + "blocks":[{ + "key":"1ljs", + "text":"Initializing from content state", + "type":"unstyled", + "depth":0, + "inlineStyleRanges":[], + "entityRanges":[], + "data":{} + }] + }`) + }; + } + + onContentStateChange = (contentState: RawDraftContentState) => { + this.setState({ + contentState + }); + } + + render() { + const { contentState } = this.state; + return ( + + ); + } +} + +ReactDOM.render(, document.getElementById("target")); diff --git a/types/react-draft-wysiwyg/tsconfig.json b/types/react-draft-wysiwyg/tsconfig.json index 35720c1979..0218edab95 100644 --- a/types/react-draft-wysiwyg/tsconfig.json +++ b/types/react-draft-wysiwyg/tsconfig.json @@ -24,6 +24,7 @@ "test/basic-controlled-tests.tsx", "test/basic-tests.tsx", "test/custom-toolbar-tests.tsx", - "test/focus-blur-callbacks-tests.tsx" + "test/focus-blur-callbacks-tests.tsx", + "test/uncontrolled-raw-draft-content-state.tsx" ] } diff --git a/types/react-hammerjs/index.d.ts b/types/react-hammerjs/index.d.ts index 03f3f36f98..6c9e29fab9 100644 --- a/types/react-hammerjs/index.d.ts +++ b/types/react-hammerjs/index.d.ts @@ -38,6 +38,7 @@ declare namespace ReactHammer { onPinchCancel?: HammerListener; onPinchEnd?: HammerListener; onPinchIn?: HammerListener; + onPinchOut?: HammerListener; onPinchStart?: HammerListener; onPress?: HammerListener; onPressUp?: HammerListener; diff --git a/types/react-instantsearch-core/index.d.ts b/types/react-instantsearch-core/index.d.ts index bceb91ca85..5743c07a36 100644 --- a/types/react-instantsearch-core/index.d.ts +++ b/types/react-instantsearch-core/index.d.ts @@ -403,7 +403,7 @@ export interface StateResultsProvided { * https://community.algolia.com/react-instantsearch/connectors/connectStateResults.html */ export function connectStateResults(stateless: React.StatelessComponent): React.ComponentClass; -export function connectStateResults>, TDoc>(ctor: React.ComponentType): ConnectedComponentClass>; +export function connectStateResults(ctor: React.ComponentType): ConnectedComponentClass>; export function connectStats(Composed: React.ComponentType): React.ComponentClass; export function connectToggleRefinement(Composed: React.ComponentType): React.ComponentClass; diff --git a/types/react-jss/index.d.ts b/types/react-jss/index.d.ts index c2ee0a008a..b7dafa5982 100644 --- a/types/react-jss/index.d.ts +++ b/types/react-jss/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Sebastian Silbermann // James Lawrence // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.9 import { createGenerateClassName, JSS, SheetsRegistry } from "jss"; import * as React from "react"; import { createTheming, ThemeProvider, withTheme } from "theming"; diff --git a/types/react-jss/lib/injectSheet.d.ts b/types/react-jss/lib/injectSheet.d.ts index d165ee7e6d..eb35117017 100644 --- a/types/react-jss/lib/injectSheet.d.ts +++ b/types/react-jss/lib/injectSheet.d.ts @@ -73,11 +73,11 @@ export interface CSSProperties { | DynamicCSSRule | CSSProperties; } -export type Styles = Record< +export type Styles = Record< ClassKey, CSSProperties >; -export type StyleCreator = ( +export type StyleCreator = ( theme: T ) => Styles; @@ -93,20 +93,20 @@ export interface InjectOptions extends CreateStyleSheetOptions { theming?: Theming; } -export type ClassNameMap = Record; +export type ClassNameMap = Record; export type WithSheet< - S extends string | Styles | StyleCreator, + S extends string | Styles | StyleCreator, GivenTheme = undefined, - Props = {} +Props = {}, > = { classes: ClassNameMap< - S extends string + S extends string | number | symbol ? S : S extends StyleCreator ? C : S extends Styles ? C : never >; -} & WithTheme ? T : GivenTheme>; +} & WithTheme ? T : GivenTheme>; export interface WithTheme { theme: T; diff --git a/types/react-lottie/index.d.ts b/types/react-lottie/index.d.ts index a57da91307..d547396a11 100644 --- a/types/react-lottie/index.d.ts +++ b/types/react-lottie/index.d.ts @@ -21,7 +21,7 @@ export interface Options { */ animationData: any; rendererSettings?: { - preserveAspectRatio?: boolean; + preserveAspectRatio?: string; /** * The canvas context */ diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 0cee14dfd2..a96ffd41eb 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -9297,7 +9297,9 @@ export const PointPropType: React.Validator; export const ViewPropTypes: React.ValidationMap; declare global { - function require(name: string): any; + type ReactNativeRequireFunction = (name: string) => any; + + var require: ReactNativeRequireFunction; /** * Console polyfill @@ -9315,7 +9317,7 @@ declare global { ignoredYellowBox: string[]; } - const console: Console; + var console: Console; /** * Navigator object for accessing location API diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index df678c4ed9..860d54523e 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -31,6 +31,7 @@ // Fellipe Chagas // Deniss Borisovs // Kenneth Skovhus +// Aaron Rosen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -623,7 +624,7 @@ export interface NavigationEventSubscription { } export interface NavigationEventsProps extends ViewProps { - navigation?: NavigationNavigator; + navigation?: NavigationScreenProp; onWillFocus?: NavigationEventCallback; onDidFocus?: NavigationEventCallback; onWillBlur?: NavigationEventCallback; @@ -1367,3 +1368,5 @@ export interface SafeAreaViewProps extends ViewProps { } export const SafeAreaView: React.ComponentClass; + +export const NavigationContext: React.Context>; diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index d30714fadb..777a8fa9f3 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -42,6 +42,7 @@ import { HeaderBackButton, Header, NavigationContainer, + NavigationContext, NavigationParams, NavigationPopAction, NavigationPopToTopAction, @@ -681,3 +682,14 @@ const ViewWithNavigationEvents = ( onDidBlur={console.log} /> ); + +// Test NavigationContext +const componentWithNavigationContext = ( + + { + navigationContext => ( + + ) + } + +); diff --git a/types/react-places-autocomplete/index.d.ts b/types/react-places-autocomplete/index.d.ts index dffcbf29f8..bf11a9fa30 100644 --- a/types/react-places-autocomplete/index.d.ts +++ b/types/react-places-autocomplete/index.d.ts @@ -53,24 +53,24 @@ export interface PropTypes { role: 'combobox'; 'aria-autocomplete': 'list'; 'aria-expanded': boolean; - 'aria-activedescendant': string | null; + 'aria-activedescendant': string | undefined; disabled: boolean; onKeyDown: React.KeyboardEventHandler; - onBlur: () => void; + onBlur: React.FocusEventHandler; value: string | undefined; onChange: (ev: { target: { value: string }}) => void; } & InputProps; getSuggestionItemProps: (suggestion: Suggestion, options?: SuggestionProps) => { key: number; - id: string | null; + id: string | undefined; role: 'option'; - onMouseEnter: () => void; - onMouseLeave: () => void; + onMouseEnter: React.MouseEventHandler; + onMouseLeave: React.MouseEventHandler; onMouseDown: React.MouseEventHandler; - onMouseUp: () => void; - onTouchStart: () => void; - onTouchEnd: () => void; - onClick: (event?: Event) => void; + onMouseUp: React.MouseEventHandler; + onTouchStart: React.TouchEventHandler; + onTouchEnd: React.TouchEventHandler; + onClick: React.MouseEventHandler; } & SuggestionProps; }>) => React.ReactNode; } diff --git a/types/react-places-autocomplete/react-places-autocomplete-tests.tsx b/types/react-places-autocomplete/react-places-autocomplete-tests.tsx index 7d72ac4397..3da7a4e81c 100644 --- a/types/react-places-autocomplete/react-places-autocomplete-tests.tsx +++ b/types/react-places-autocomplete/react-places-autocomplete-tests.tsx @@ -31,18 +31,30 @@ class Test extends React.Component { return (
    - {({getInputProps, getSuggestionItemProps, suggestions}) => ( - <> - -
    - {suggestions.map(suggestion => ( -
    - {suggestion.description} -
    - ))} -
    - - )} + {({getInputProps, suggestions, getSuggestionItemProps, loading}) => { + const inputProps = getInputProps({ + required: true, + className: loading ? 'is-pending' : '' + }); + return ( + <> + +
    + {suggestions.map(suggestion => { + const divProps = getSuggestionItemProps(suggestion, { + className: suggestion.active ? 'active' : '' + }); + return ( +
    + {suggestion.description} +
    + ); + })} +
    + + ); + } + }
    ); diff --git a/types/react/index.d.ts b/types/react/index.d.ts index bc9c4ce342..97adab18d4 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -807,6 +807,14 @@ declare namespace React { * @see https://reactjs.org/docs/hooks-reference.html#usestate */ function useState(initialState: S | (() => S)): [S, Dispatch>]; + // convenience overload when first argument is ommitted + /** + * Returns a stateful value, and a function to update it. + * + * @version 16.8.0 + * @see https://reactjs.org/docs/hooks-reference.html#usestate + */ + function useState(): [S | undefined, Dispatch>]; /** * An alternative to `useState`. * @@ -894,6 +902,20 @@ declare namespace React { */ // TODO (TypeScript 3.0): function useRef(initialValue: T|null): RefObject; + // convenience overload for potentially undefined initialValue / call with 0 arguments + // has a default to stop it from defaulting to {} instead + /** + * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument + * (`initialValue`). The returned object will persist for the full lifetime of the component. + * + * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable + * value around similar to how you’d use instance fields in classes. + * + * @version 16.8.0 + * @see https://reactjs.org/docs/hooks-reference.html#useref + */ + // TODO (TypeScript 3.0): + function useRef(): MutableRefObject; /** * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations. * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside @@ -958,7 +980,8 @@ declare namespace React { * @version 16.8.0 * @see https://reactjs.org/docs/hooks-reference.html#usememo */ - function useMemo(factory: () => T, deps: DependencyList): T; + // allow undefined, but don't make it optional as that is very likely a mistake + function useMemo(factory: () => T, deps: DependencyList | undefined): T; /** * `useDebugValue` can be used to display a label for custom hooks in React DevTools. * diff --git a/types/react/test/hooks.tsx b/types/react/test/hooks.tsx index 26ff634e89..70ea9a0ce7 100644 --- a/types/react/test/hooks.tsx +++ b/types/react/test/hooks.tsx @@ -100,9 +100,46 @@ function useEveryHook(ref: React.Ref<{ id: number }>|undefined): () => boolean { // inline object, to (manually) check if autocomplete works React.useReducer(reducer, { age: 42, name: 'The Answer' }); - // make sure this is not going to the |null overload - // $ExpectType MutableRefObject - const didLayout = React.useRef(false); + // test useRef and its convenience overloads + // $ExpectType MutableRefObject + React.useRef(0); + + // these are not very useful (can't assign anything else to .current) + // but it's the only safe way to resolve them + // $ExpectType MutableRefObject + React.useRef(null); + // $ExpectType MutableRefObject + React.useRef(undefined); + + // |null convenience overload + // it should _not_ be mutable if the generic argument doesn't include null + // $ExpectType RefObject + React.useRef(null); + // but it should be mutable if it does (i.e. is not the convenience overload) + // $ExpectType MutableRefObject + React.useRef(null); + + // |undefined convenience overload + // with no contextual type or generic argument it should default to undefined only (not {} or unknown!) + // $ExpectType MutableRefObject + React.useRef(); + // $ExpectType MutableRefObject + React.useRef(); + // don't just accept a potential undefined if there is a generic argument + // $ExpectError + React.useRef(undefined); + // make sure once again there's no |undefined if the initial value doesn't either + // $ExpectType MutableRefObject + React.useRef(1); + // and also that it is not getting erased if the parameter is wider + // $ExpectType MutableRefObject + React.useRef(1); + + // should be contextually typed + const a: React.MutableRefObject = React.useRef(undefined); + const b: React.MutableRefObject = React.useRef(); + const c: React.MutableRefObject = React.useRef(null); + const d: React.RefObject = React.useRef(null); const id = React.useMemo(() => Math.random(), []); React.useImperativeHandle(ref, () => ({ id }), [id]); @@ -110,6 +147,10 @@ function useEveryHook(ref: React.Ref<{ id: number }>|undefined): () => boolean { // $ExpectError React.useImperativeMethods(ref, () => ({}), [id]); + // make sure again this is not going to the |null convenience overload + // $ExpectType MutableRefObject + const didLayout = React.useRef(false); + React.useLayoutEffect(() => { setState(1); setState(prevState => prevState - 1); @@ -140,6 +181,29 @@ function useEveryHook(ref: React.Ref<{ id: number }>|undefined): () => boolean { React.useDebugValue(id, value => value.toFixed()); React.useDebugValue(id); + // allow passing an explicit undefined + React.useMemo(() => {}, undefined); + // but don't allow it to be missing + // $ExpectError + React.useMemo(() => {}); + + // useState convenience overload + // default to undefined only (not that useful, but type-safe -- no {} or unknown!) + // $ExpectType undefined + React.useState()[0]; + // $ExpectType number | undefined + React.useState()[0]; + // default overload + // $ExpectType number + React.useState(0)[0]; + // $ExpectType undefined + React.useState(undefined)[0]; + // make sure the generic argument does reject actual potentially undefined inputs + // $ExpectError + React.useState(undefined)[0]; + + // useReducer convenience overload + return React.useCallback(() => didLayout.current, []); } diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 963f68600c..44f97c933b 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -30,7 +30,7 @@ export type TooltipFormatter = (value: string | number | Array, entry: TooltipPayload, index: number) => React.ReactNode; export type ItemSorter = (a: T, b: T) => number; export type ContentRenderer

    = (props: P) => React.ReactNode; -export type DataKey = string | number | ((dataObject: any) => number | [number, number] | null); +export type DataKey = string | number | ((dataObject: any) => string | number | [number, number] | null); export type IconType = 'plainline' | 'line' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'plainline'; export type LegendType = IconType | 'none'; @@ -201,6 +201,7 @@ export interface BarProps extends EventAttributes, Partial { - + diff --git a/types/rmc-drawer/package.json b/types/rmc-drawer/package.json new file mode 100644 index 0000000000..f06689a6b9 --- /dev/null +++ b/types/rmc-drawer/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "moment": "^2.19.4" + } +} diff --git a/types/sass-webpack-plugin/index.d.ts b/types/sass-webpack-plugin/index.d.ts index df589ca034..1299429790 100644 --- a/types/sass-webpack-plugin/index.d.ts +++ b/types/sass-webpack-plugin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/jalkoby/sass-webpack-plugin // Definitions by: AEPKILL // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.7 import { Options } from 'node-sass'; import { Plugin } from 'webpack'; diff --git a/types/seamless-immutable/index.d.ts b/types/seamless-immutable/index.d.ts index 1990dff0ab..1206034846 100644 --- a/types/seamless-immutable/index.d.ts +++ b/types/seamless-immutable/index.d.ts @@ -80,7 +80,7 @@ declare namespace SeamlessImmutable { propertyPath: [ K, L, M, N ], updaterFunction: (value: T[K][L][M][N], ...additionalParameters: any[]) => any, ...additionalArguments: any[]): Immutable; updateIn( propertyPath: [ K, L, M, N, O ], updaterFunction: (value: T[K][L][M][N][O], ...additionalParameters: any[]) => any, ...additionalArguments: any[]): Immutable; - updateIn(propertyPath: string[], updaterFunction: (value: TValue, ...additionalParameters: any[]) => any, ...additionalArguments: any[]): Immutable; + updateIn(propertyPath: string[], updaterFunction: (value: TValue, ...additionalParameters: any[]) => any, ...additionalArguments: any[]): Immutable; without(property: K): Immutable; without(...properties: K[]): Immutable; diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 5d1131684c..d89dac0d4a 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3286,6 +3286,11 @@ declare namespace sequelize { * if true, it will also eager load the relations of the child models, recursively. */ nested?: boolean; + + /** + * If true, runs a separate query to fetch the associated instances, only supported for hasMany associations + */ + separate?: boolean; } /** @@ -6510,6 +6515,16 @@ declare namespace sequelize { */ logging?: Function; + /** + * Specify the parent transaction so that this transaction is nested or a save point within the parent + */ + transaction?: Transaction; + + /** + * Sets the constraints to be deferred or immediately checked. + */ + deferrable?: Deferrable[keyof Deferrable]; + } // diff --git a/types/serverless/classes/PluginManager.d.ts b/types/serverless/classes/PluginManager.d.ts index 95e01f721a..76f3479c84 100644 --- a/types/serverless/classes/PluginManager.d.ts +++ b/types/serverless/classes/PluginManager.d.ts @@ -14,6 +14,7 @@ declare class PluginManager { loadServicePlugins(servicePlugins: {}): void; loadCommand(pluginName: string, details: {}, key: string): {}; loadCommands(pluginInstance: Plugin): void; + spawn(commandsArray: string | string[], options?: any): Promise; cliOptions: {}; cliCommands: {}; diff --git a/types/serverless/classes/Service.d.ts b/types/serverless/classes/Service.d.ts index 2f05f3b7c0..040a45f825 100644 --- a/types/serverless/classes/Service.d.ts +++ b/types/serverless/classes/Service.d.ts @@ -15,6 +15,11 @@ declare class Service { }; name: string; + stage: string; + region: string; + runtime?: string; + timeout?: number; + versionFunctions: boolean; }; constructor(serverless: Serverless, data: {}); diff --git a/types/serverless/index.d.ts b/types/serverless/index.d.ts index 01f9d7a73e..d720ec2382 100644 --- a/types/serverless/index.d.ts +++ b/types/serverless/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for serverless 1.18 // Project: https://github.com/serverless/serverless#readme // Definitions by: Hassan Khan +// Jonathan M. Wilbur // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import Service = require("./classes/Service"); @@ -12,6 +13,9 @@ import AwsProvider = require("./plugins/aws/provider/awsProvider"); declare namespace Serverless { interface Options { + function?: string; + watch?: boolean; + extraServicePath?: string; stage: string | null; region: string | null; noDeploy?: boolean; @@ -23,11 +27,24 @@ declare namespace Serverless { interface FunctionDefinition { name: string; + package: Package; + runtime?: string; + handler: string; + timeout?: number; + memorySize?: number; + environment?: { [ name: string ]: string }; } interface Event { eventName: string; } + + interface Package { + include: string[]; + exclude: string[]; + artifact?: string; + individually?: boolean; + } } declare class Serverless { diff --git a/types/shipit-utils/index.d.ts b/types/shipit-utils/index.d.ts index 64a62f2d61..6a8582bfad 100644 --- a/types/shipit-utils/index.d.ts +++ b/types/shipit-utils/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Cyril Schumacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import shipit = require("shipit"); +import shipit = require("shipit-cli"); export type GruntOrShipit = typeof shipit | {}; export type EmptyCallback = () => void; diff --git a/types/shipit-utils/shipit-utils-tests.ts b/types/shipit-utils/shipit-utils-tests.ts index 36da5f0073..96bbe2bbdb 100644 --- a/types/shipit-utils/shipit-utils-tests.ts +++ b/types/shipit-utils/shipit-utils-tests.ts @@ -1,4 +1,4 @@ -import shipit = require("shipit"); +import shipit = require("shipit-cli"); import utils = require("shipit-utils"); const originalShipit = utils.getShipit(shipit); diff --git a/types/storybook__addon-info/index.d.ts b/types/storybook__addon-info/index.d.ts index 9e5089d443..6adc628c31 100644 --- a/types/storybook__addon-info/index.d.ts +++ b/types/storybook__addon-info/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for @storybook/addon-info 3.4 +// Type definitions for @storybook/addon-info 4.1 // Project: https://github.com/storybooks/storybook, https://github.com/storybooks/storybook/tree/master/addons/info // Definitions by: Mark Kornblum // Mattias Wikstrom +// Kevin Lee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -22,11 +23,22 @@ export interface Options { propTables?: React.ComponentType[] | false; propTablesExclude?: React.ComponentType[]; styles?: object; + components?: { [key: string]: React.ComponentType }; marksyConf?: object; maxPropsIntoLine?: number; maxPropObjectKeys?: number; maxPropArrayLength?: number; maxPropStringLength?: number; + TableComponent?: React.ComponentType<{ + propDefinitions: Array<{ + property: string; + propType: object | string; // TODO: info about what this object is... + required: boolean; + description: string; + defaultValue: any; + }> + }>; + excludedPropTypes?: string[]; } // TODO: it would be better to use type inference for the parameters diff --git a/types/storybook__addon-info/storybook__addon-info-tests.tsx b/types/storybook__addon-info/storybook__addon-info-tests.tsx index 505780bf7e..0e581c822d 100644 --- a/types/storybook__addon-info/storybook__addon-info-tests.tsx +++ b/types/storybook__addon-info/storybook__addon-info-tests.tsx @@ -6,6 +6,38 @@ import { setDefaults, withInfo } from '@storybook/addon-info'; const { Component } = React; +const TableComponent = ({ propDefinitions }: { propDefinitions: Array<{ + property: string; + propType: { [key: string]: any} | string; + required: boolean; + description: string; + defaultValue: any; +}> }) => ( + + + + + + + + + + + + {propDefinitions.map(row => ( + + + + + + + ))} + +
    propertypropTyperequireddefaultdescription
    {row.property}{row.required ? 'yes' : '-'} + {row.defaultValue === undefined ? '-' : row.defaultValue} + {row.description}
    +); + addDecorator(withInfo); setDefaults({ @@ -31,11 +63,14 @@ storiesOf('Component', module) header: true, source: true, styles: {}, + components: {}, marksyConf: {}, maxPropObjectKeys: 1, maxPropArrayLength: 2, maxPropsIntoLine: 3, maxPropStringLength: 4, + TableComponent, + excludedPropTypes: [], })(() => Click the "?" mark at top-right to view the info. ) diff --git a/types/swagger-node-runner/index.d.ts b/types/swagger-node-runner/index.d.ts index 3e8016a73f..02421cbe08 100644 --- a/types/swagger-node-runner/index.d.ts +++ b/types/swagger-node-runner/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for swagger-node-runner 0.5 +// Type definitions for swagger-node-runner 0.6 // Project: https://github.com/theganyo/swagger-node-runner // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -36,6 +36,7 @@ import { Spec } from "swagger-schema-official"; import { EventEmitter } from "events"; import * as Hapi from "hapi"; import * as Restify from "restify"; +import { OutgoingHttpHeaders } from "http"; /** * Config object for SwaggerNodeRunner @@ -117,12 +118,18 @@ export type SwaggerToolsMiddleware = (req: any, res: any, next: any) => any; /** * @param callback - Error is returned if request is unauthorized. - * The Error may include "message", "state", and "code" fields to be conveyed to the client in the response body and a + * The Error may include "message", and "code" fields to be conveyed to the client in the response body and a * "headers" field containing an object representing headers to be set on the response to the client. * In addition, if the Error has a statusCode field, the response statusCode will be set to match - * otherwise, the statusCode will be set to 403. */ -export type SwaggerToolsSecurityHandler = (request: any, securityDefinition: any, scopes: any, callback: (err: Error) => void) => void; +export interface SwaggerToolsSecurityHandlerCallbackError { + code?: string; + headers?: OutgoingHttpHeaders; + message?: string; + statusCode?: number; +} +export type SwaggerToolsSecurityHandler = (request: any, securityDefinition: any, scopes: any, callback: (err?: Error | SwaggerToolsSecurityHandlerCallbackError, result?: any) => void) => void; /** * The keys match SecurityDefinition names and the associated values are functions that accept the following parameters: diff --git a/types/swagger-node-runner/swagger-node-runner-tests.ts b/types/swagger-node-runner/swagger-node-runner-tests.ts index 1deae28f23..bccbac5d94 100644 --- a/types/swagger-node-runner/swagger-node-runner-tests.ts +++ b/types/swagger-node-runner/swagger-node-runner-tests.ts @@ -84,7 +84,7 @@ SwaggerNodeRunner.create(config, (err, runner) => { app.listen(port); }); -const swaggerSecurityHandlerCb = (err: Error) => { +const swaggerSecurityHandlerCb = (err?: Error) => { // do nothing }; @@ -98,7 +98,34 @@ const configComplex: SwaggerNodeRunner.Config = { swaggerSecurityHandlers: { // did not manage to research the typings of first 3 arguments someHandlerName: ({}, {}, {}, swaggerSecurityHandlerCb) => { - // do nothing + swaggerSecurityHandlerCb(new Error('foo')); + } + }, + validateResponse: true +}; + +const handlerWithoutError: SwaggerNodeRunner.Config = { + appRoot: __dirname, + swaggerSecurityHandlers: { + // did not manage to research the typings of first 3 arguments + someHandlerName: ({}, {}, {}, swaggerSecurityHandlerCb) => { + swaggerSecurityHandlerCb(); + } + }, + validateResponse: true +}; + +const handlerWithHeaders: SwaggerNodeRunner.Config = { + appRoot: __dirname, + swaggerSecurityHandlers: { + // did not manage to research the typings of first 3 arguments + someHandlerName: ({}, {}, {}, swaggerSecurityHandlerCb) => { + swaggerSecurityHandlerCb({ + headers: { + foo: 'bar', + baz: 2, + some: ['a', 'b'], + }}); } }, validateResponse: true diff --git a/types/swagger-schema-official/index.d.ts b/types/swagger-schema-official/index.d.ts index 09d31cc8e7..11cfd05520 100644 --- a/types/swagger-schema-official/index.d.ts +++ b/types/swagger-schema-official/index.d.ts @@ -47,24 +47,29 @@ export interface BaseParameter { } export interface BodyParameter extends BaseParameter { + in: 'body'; schema?: Schema; } export interface QueryParameter extends BaseParameter, BaseSchema { + in: 'query'; type: string; allowEmptyValue?: boolean; } export interface PathParameter extends BaseParameter, BaseSchema { + in: 'path'; type: string; required: boolean; } export interface HeaderParameter extends BaseParameter, BaseSchema { + in: 'header'; type: string; } export interface FormDataParameter extends BaseParameter, BaseSchema { + in: 'formData'; type: string; collectionFormat?: string; allowEmptyValue?: boolean; diff --git a/types/swagger-schema-official/swagger-schema-official-tests.ts b/types/swagger-schema-official/swagger-schema-official-tests.ts index 4fb3e55f07..4d46e4aa86 100644 --- a/types/swagger-schema-official/swagger-schema-official-tests.ts +++ b/types/swagger-schema-official/swagger-schema-official-tests.ts @@ -1373,7 +1373,6 @@ const reference_support: swagger.Spec = { { "in": "body", "name": "bodyParameter", - "type": "string", "description": "The body parameter" } ], diff --git a/types/tern/lib/tern/index.d.ts b/types/tern/lib/tern/index.d.ts index 0e48925914..7ecb4ac73e 100644 --- a/types/tern/lib/tern/index.d.ts +++ b/types/tern/lib/tern/index.d.ts @@ -164,17 +164,20 @@ export interface BaseQuery { docFormat?: "full"; } +export interface BaseQueryWithFile extends BaseQuery { + /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ + file: string; +} + export interface Position { ch: number; line: number; } /** Asks the server for a set of completions at the given point. */ -export interface CompletionsQuery extends BaseQuery { +export interface CompletionsQuery extends BaseQueryWithFile { /** Asks the server for a set of completions at the given point. */ type: "completions"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location to complete at. */ end: number | Position; /** Whether to include the types of the completions in the result data. Default `false` */ @@ -233,11 +236,9 @@ export interface CompletionsQueryResult { } /** Query the type of something. */ -export interface TypeQuery extends BaseQuery { +export interface TypeQuery extends BaseQueryWithFile { /** Query the type of something. */ type: "type"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location of the expression. */ end: number | Position; /** Specify the location of the expression. */ @@ -282,7 +283,7 @@ export interface TypeQueryResult { * type is not an object or function (other types don’t store their definition site), * it will fail to return useful information. */ -export interface DefinitionQuery extends BaseQuery { +export interface DefinitionQuery extends BaseQueryWithFile { /** * Asks for the definition of something. This will try, for a variable or property, * to return the point at which it was defined. If that fails, or the chosen @@ -292,8 +293,6 @@ export interface DefinitionQuery extends BaseQuery { * it will fail to return useful information. */ type: "definition"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location of the expression. */ end: number | Position; /** Specify the location of the expression. */ @@ -320,11 +319,9 @@ export interface DefinitionQueryResult { } /** Get the documentation string and URL for a given expression, if any. */ -export interface DocumentationQuery extends BaseQuery { +export interface DocumentationQuery extends BaseQueryWithFile { /** Get the documentation string and URL for a given expression, if any. */ type: "documentation"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location of the expression. */ end: number | Position; /** Specify the location of the expression. */ @@ -341,11 +338,9 @@ export interface DocumentationQueryResult { } /** Used to find all references to a given variable or property. */ -export interface RefsQuery extends BaseQuery { +export interface RefsQuery extends BaseQueryWithFile { /** Used to find all references to a given variable or property. */ type: "refs"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location of the expression. */ end: number | Position; /** Specify the location of the expression. */ @@ -365,11 +360,9 @@ export interface RefsQueryResult { } /** Rename a variable in a scope-aware way. */ -export interface RenameQuery extends BaseQuery { +export interface RenameQuery extends BaseQueryWithFile { /** Rename a variable in a scope-aware way. */ type: "rename"; - /** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */ - file: string; /** Specify the location of the variable. */ end: number | Position; /** Specify the location of the variable. */ @@ -467,7 +460,7 @@ export function registerPlugin(name: string, init: (server: Server, options?: Co export interface Desc { run(Server: Server, query: QueryRegistry[T]["query"], file?: File): QueryRegistry[T]["result"]; - takesfile?: boolean; + takesFile?: boolean; } /** diff --git a/types/theo/index.d.ts b/types/theo/index.d.ts index d60a797159..de15c0238a 100644 --- a/types/theo/index.d.ts +++ b/types/theo/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for theo 8.1 +// Type definitions for Theo 8.1 // Project: https://github.com/salesforce-ux/theo // Definitions by: Pete Petrash // Niko Laitinen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 import { Collection, Map, List, OrderedMap } from "immutable"; @@ -35,21 +35,16 @@ export type Format = | "android.xml" | "aura.tokens"; -export function convert(options: ConvertOptions): Promise; -export function convertSync(options: ConvertOptions): string; -export function registerFormat( - name: string, - format: FormatResultFn | string -): void; -export function registerTransform( - name: string, - valueTransforms: string[] -): void; -export function registerValueTransform( - name: string, - predicate: (prop: Prop) => boolean, - transform: (prop: Prop) => string | number -): void; +export type Transform = "raw" | "ios" | "android" | "web"; + +export type ValueTransform = + | "color/rgb" + | "color/hex" + | "color/hex8rgba" + | "color/hex8argb" + | "percentage/float" + | "relative/pixel" + | "relative/pixelValue"; export type Prop = Map; export type Props = List; @@ -78,8 +73,8 @@ export interface ConvertOptions { resolveMetaAliases?: boolean; } -export interface TransformOptions { - type?: string; +export interface TransformOptions { + type?: Transform | T; file: string; data?: string; } @@ -91,3 +86,19 @@ export interface FormatOptions { transformPropName?: (name: string) => string ) => void; } + +export function convert(options: ConvertOptions): Promise; +export function convertSync(options: ConvertOptions): string; +export function registerFormat( + name: Format | T, + format: FormatResultFn | string +): void; +export function registerTransform( + name: Transform | T, + valueTransforms: ValueTransform[] | T[] +): void; +export function registerValueTransform( + name: ValueTransform | T, + predicate: (prop: Prop) => boolean, + transform: (prop: Prop) => string | number +): void; diff --git a/types/theo/tslint.json b/types/theo/tslint.json index 3db14f85ea..71ee04c4e1 100644 --- a/types/theo/tslint.json +++ b/types/theo/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-unnecessary-generics": false + } +} diff --git a/types/toastr/index.d.ts b/types/toastr/index.d.ts index 8d5d163f7b..847cb2e7fc 100644 --- a/types/toastr/index.d.ts +++ b/types/toastr/index.d.ts @@ -320,10 +320,19 @@ interface Toastr { (toast: JQuery, clearOptions: {force: boolean}): void; }; /** - * Removes all toasts (without animation) + * Removes toasts (without animation) */ remove: { + /** + * Removes all toasts (without animation) + */ (): void; + /** + * Removes specific toast (without animation) + * + * @param toast Toast to remove + */ + (toast: JQuery): void; }; /** * Create an error toast diff --git a/types/tokenizr/index.d.ts b/types/tokenizr/index.d.ts new file mode 100644 index 0000000000..1b1615e1b8 --- /dev/null +++ b/types/tokenizr/index.d.ts @@ -0,0 +1,268 @@ +// Type definitions for tokenizr 1.5 +// Project: https://github.com/rse/tokenizr +// Definitions by: Nicholas Sorokin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class Tokenizr { + constructor(); + + /** + * Configure a tokenization after-rule callback + */ + after(action: Action): this; + + /** + * Execute multiple alternative callbacks + */ + alternatives(...alternatives: Array<(this: this) => any>): any; + + /** + * Configure a tokenization before-rule callback + */ + before(action: Action): this; + + /** + * Open tokenization transaction + */ + begin(): this; + + /** + * Close (successfully) tokenization transaction + */ + commit(): this; + + /** + * Consume the current token (by expecting it to be a particular symbol) + */ + consume(type: string, value: any): Token; + + /** + * Configure debug operation + */ + debug(enableDebug: boolean): this; + + /** + * Determine depth of still open tokenization transaction + */ + depth(): number; + + /** + * Create an error message for the current position + */ + error(message?: string): ParsingError; + + /** + * Configure a tokenization finish callback + */ + finish(action: (this: ActionContext, ctx: ActionContext) => void): this; + + /** + * Provide (new) input string to tokenize + */ + input(input: string): this; + + /** + * Peek at the next token or token at particular offset + */ + peek(offset?: number): Token; + + /** + * Pop state + */ + pop(): string; + + /** + * Push state + */ + push(state: string): this; + + /** + * Reset the internal state + */ + reset(): this; + + /** + * Close (unsuccessfully) tokenization transaction + */ + rollback(): this; + + /** + * Configure a tokenization rule + */ + rule(pattern: RegExp, action: RuleAction, name?: string): this; + rule( + state: string, + pattern: RegExp, + action: RuleAction, + name: string + ): this; + + /** + * Skip one or more tokens + */ + skip(len?: number): this; + + /** + * Get/set state + */ + state(): string; + /** + * Replaces the current state + */ + state(state: string): this; + + /** + * Set a tag + */ + tag(tag: string): this; + + /** + * Check whether tag is set + */ + tagged(tag: string): boolean; + + /** + * Determine and return next token + */ + token(): Token | null; + + /** + * Determine and return all tokens + */ + tokens(): Token[]; + + /** + * Unset a tag + */ + untag(tag: string): this; + + static readonly ParsingError: typeof ParsingError; + static readonly ActionContext: typeof ActionContext; + static readonly Token: typeof Token; +} + +type Action = ( + this: ActionContext, + ctx: ActionContext, + found: RegExpExecArray, + rule: { + state: string; + pattern: RegExp; + action: RuleAction; + name: string; + } +) => void; + +type RuleAction = ( + this: ActionContext, + ctx: ActionContext, + found: RegExpExecArray +) => void; + +declare class ActionContext { + constructor(e: any); + + /** + * Accept current matching as a new token + */ + accept(type: string, value?: any): this; + + /** + * Store and retrieve user data attached to context + */ + data(key: string, value?: any): any; + + /** + * Mark current matching to be ignored + */ + ignore(): this; + + /** + * Retrieve information of current matching + */ + info(): { line: number; column: number; pos: number; len: number }; + + /** + * Pop state + */ + pop(): string; + + /** + * Push state + */ + push(state: string): this; + + /** + * Rark current matching to be rejected + */ + reject(): this; + + /** + * Mark current matching to be repeated from scratch + */ + repeat(): this; + + /** + * Get/set state + */ + state(): string; + /** + * Replaces the current state + */ + state(state: string): this; + + /** + * Immediately stop tokenization + */ + stop(): this; + + /** + * Set a tag + */ + tag(tag: string): this; + + /** + * Check whether tag is set + */ + tagged(tag: string): boolean; + + /** + * Unset a tag + */ + untag(tag: string): this; +} + +declare class ParsingError extends Error { + constructor( + message: string, + pos: number, + line: number, + column: number, + input: string + ); + + /** + * Render a useful string representation + */ + toString(): string; +} + +declare class Token { + constructor( + type: string, + value: any, + text: string, + pos?: number, + line?: number, + column?: number + ); + + isA(type: string, value?: any): boolean; + + /** + * Render a useful string representation + */ + toString(): string; +} + +export = Tokenizr; diff --git a/types/tokenizr/tokenizr-tests.ts b/types/tokenizr/tokenizr-tests.ts new file mode 100644 index 0000000000..a633a14a75 --- /dev/null +++ b/types/tokenizr/tokenizr-tests.ts @@ -0,0 +1,42 @@ +import Tokenizr = require('tokenizr'); + +const lexer = new Tokenizr(); + +lexer.rule(/[a-zA-Z_][a-zA-Z0-9_]*/, (ctx, match) => { + ctx.accept('id'); +}); + +lexer.rule(/[+-]?[0-9]+/, (ctx, match) => { + ctx.accept('number', parseInt(match[0], 10)); +}); + +lexer.rule(/"((?:\\"|[^\r\n])*)"/, (ctx, match) => { + ctx.accept('string', match[1].replace(/\\"/g, '"')); +}); + +lexer.rule(/\/\/[^\r\n]*\r?\n/, (ctx, match) => { + ctx.ignore(); +}); + +lexer.rule(/[ \t\r\n]+/, (ctx, match) => { + ctx.ignore(); +}); + +lexer.rule(/./, (ctx, match) => { + ctx.accept('char'); +}); + +const cfg = `foo { + baz = 1 // sample comment + bar { + quux = 42 + hello = "hello \"world\"!" + } + quux = 7 +}`; + +lexer.input(cfg); +lexer.debug(true); +lexer.tokens().forEach(token => { + // ... +}); diff --git a/types/tokenizr/tsconfig.json b/types/tokenizr/tsconfig.json new file mode 100644 index 0000000000..7b24906172 --- /dev/null +++ b/types/tokenizr/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "tokenizr-tests.ts"] +} diff --git a/types/tokenizr/tslint.json b/types/tokenizr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/tokenizr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vue-chartkick/index.d.ts b/types/vue-chartkick/index.d.ts new file mode 100644 index 0000000000..79f70d084d --- /dev/null +++ b/types/vue-chartkick/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for vue-chartkick 0.5 +// Project: https://github.com/ankane/vue-chartkick#readme +// Definitions by: CNS Media +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { PluginObject } from "vue"; + +interface VueChartkickPlugin extends PluginObject<{ adapter: any }> { + version: string; + addAdapter: (library: any) => void; +} + +declare const VueChartkick: VueChartkickPlugin; +export default VueChartkick; diff --git a/types/vue-chartkick/package.json b/types/vue-chartkick/package.json new file mode 100644 index 0000000000..1c62b73c5c --- /dev/null +++ b/types/vue-chartkick/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "vue": ">=2.0.0" + } +} diff --git a/types/i18next-browser-languagedetector/tsconfig.json b/types/vue-chartkick/tsconfig.json similarity index 90% rename from types/i18next-browser-languagedetector/tsconfig.json rename to types/vue-chartkick/tsconfig.json index 32755315aa..2d517d3efd 100644 --- a/types/i18next-browser-languagedetector/tsconfig.json +++ b/types/vue-chartkick/tsconfig.json @@ -19,6 +19,6 @@ }, "files": [ "index.d.ts", - "i18next-browser-languagedetector-tests.ts" + "vue-chartkick-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/vue-chartkick/tslint.json b/types/vue-chartkick/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/vue-chartkick/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vue-chartkick/vue-chartkick-tests.ts b/types/vue-chartkick/vue-chartkick-tests.ts new file mode 100644 index 0000000000..4f938eb54e --- /dev/null +++ b/types/vue-chartkick/vue-chartkick-tests.ts @@ -0,0 +1,5 @@ +import VueChartkick from 'vue-chartkick'; +import Vue from "vue"; +import * as Chart from "chart.js"; + +Vue.use(VueChartkick, {adapter: Chart}); diff --git a/types/word-extractor/index.d.ts b/types/word-extractor/index.d.ts new file mode 100644 index 0000000000..c6e6289774 --- /dev/null +++ b/types/word-extractor/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for word-extractor 0.3 +// Project: https://github.com/morungos/node-word-extractor +// Definitions by: Rodrigo Saboya +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class WordExtractor { + extract(documentPath: string): Promise; +} + +export = WordExtractor; + +declare namespace WordExtractor { + class Document { + getBody(): string; + getFootnotes(): string; + getHeaders(): string; + getAnnotations(): string; + getEndNotes(): string; + } +} diff --git a/types/word-extractor/tsconfig.json b/types/word-extractor/tsconfig.json new file mode 100644 index 0000000000..436687e1ff --- /dev/null +++ b/types/word-extractor/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "word-extractor-tests.ts" + ] +} diff --git a/types/word-extractor/tslint.json b/types/word-extractor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/word-extractor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/word-extractor/word-extractor-tests.ts b/types/word-extractor/word-extractor-tests.ts new file mode 100644 index 0000000000..a177b9d5c5 --- /dev/null +++ b/types/word-extractor/word-extractor-tests.ts @@ -0,0 +1,13 @@ +import WordExtractor = require("word-extractor"); + +const extractor = new WordExtractor(); + +let temp: string; + +const doc = extractor.extract('/path/to/file.doc').then(document => { + temp = document.getBody(); + temp = document.getAnnotations(); + temp = document.getEndNotes(); + temp = document.getFootnotes(); + temp = document.getHeaders(); +}); diff --git a/types/yeoman-generator/index.d.ts b/types/yeoman-generator/index.d.ts index 6415ad7957..fe39171825 100644 --- a/types/yeoman-generator/index.d.ts +++ b/types/yeoman-generator/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for yeoman-generator 3.0 +// Type definitions for yeoman-generator 3.1 // Project: https://github.com/yeoman/generator, http://yeoman.io // Definitions by: Kentaro Okuno // Jay Anslow // Ika // Joshua Cherry +// Arthur Corenzan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -71,7 +72,7 @@ declare namespace Generator { writeJSON(filepath: string, contents: {}, replacer?: (key: string, value: any) => any, space?: number): void; extendJSON(filepath: string, contents: {}, replacer?: (key: string, value: any) => any, space?: number): void; delete(filepath: string, options?: {}): void; - copy(from: string, to: string, options?: {}): void; + copy(from: string, to: string, options?: {}, context?: {}, templateOptions?: {}): void; copyTpl(from: string, to: string, context: {}, templateOptions?: {}, copyOptions?: {}): void; move(from: string, to: string, options?: {}): void; exists(filepath: string): boolean;