From 05a2f1a0d16483a1cc90d81903f6adfe8311b1b3 Mon Sep 17 00:00:00 2001 From: Losses Don Date: Wed, 6 Feb 2019 20:57:37 +0800 Subject: [PATCH 001/155] Fix spelling errors. --- types/react-select/lib/components/Option.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-select/lib/components/Option.d.ts b/types/react-select/lib/components/Option.d.ts index 1075e6d069..ab9b4d8297 100644 --- a/types/react-select/lib/components/Option.d.ts +++ b/types/react-select/lib/components/Option.d.ts @@ -8,7 +8,7 @@ interface State { isDisabled: boolean; /** Wether the option is focused. */ isFocused: boolean; - /** Whether the option is selected. */ + /** Wether the option is selected. */ isSelected: boolean; } interface InnerProps { From c43678fed8e152afcdff541e5be240ed4b6a331d Mon Sep 17 00:00:00 2001 From: Robert Sargant Date: Thu, 7 Feb 2019 09:32:36 +0000 Subject: [PATCH 002/155] Fix for Field definition in TypeScript 3.2+ --- types/redux-form/lib/Field.d.ts | 2 +- types/redux-form/redux-form-tests.tsx | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/types/redux-form/lib/Field.d.ts b/types/redux-form/lib/Field.d.ts index 87a8947717..194a322408 100644 --- a/types/redux-form/lib/Field.d.ts +++ b/types/redux-form/lib/Field.d.ts @@ -61,7 +61,7 @@ export type GenericFieldHTMLAttributes = SelectHTMLAttributes | TextareaHTMLAttributes; -export class Field

extends Component & P> { +export class Field

extends Component

{ dirty: boolean; name: string; pristine: boolean; diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index 25f395884c..c41b688f41 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -287,6 +287,12 @@ const Test = reduxForm({ component="select" /> + + Date: Thu, 7 Feb 2019 09:38:19 +0000 Subject: [PATCH 003/155] Bump TS version to 3.3 --- types/redux-form/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts index 6915032138..e165866b49 100644 --- a/types/redux-form/index.d.ts +++ b/types/redux-form/index.d.ts @@ -13,7 +13,7 @@ // Kamil Wojcik // Mohamed Shaaban // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 3.3 import { ComponentClass, StatelessComponent, From d4db884e8b3191eb4612cacf092d8fb3239bb52c Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 8 Feb 2019 19:55:42 -0500 Subject: [PATCH 004/155] Make get/set generic --- types/npm/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/npm/index.d.ts b/types/npm/index.d.ts index 21ee933e59..7c34199262 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): T; + set(setting: string, value: T): void; loadPrefix(cb: ErrorCallback): void; loadCAFile(caFilePath: string, cb: ErrorCallback): void; From b9aef3a9ac9cf0ee9f5f4d18cefbe65725e22af9 Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 8 Feb 2019 20:17:16 -0500 Subject: [PATCH 005/155] Add test for generic setter --- types/npm/npm-tests.ts | 2 ++ 1 file changed, 2 insertions(+) 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); }) From 0b594f46b9af09dac4aa48c2a771174dec2fb4fe Mon Sep 17 00:00:00 2001 From: Nebulis Date: Sat, 9 Feb 2019 01:13:52 +0800 Subject: [PATCH 006/155] fix: make error optional parameter for SwaggerToolsSecurityHandler callback --- types/swagger-node-runner/index.d.ts | 13 ++++++-- .../swagger-node-runner-tests.ts | 31 +++++++++++++++++-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/types/swagger-node-runner/index.d.ts b/types/swagger-node-runner/index.d.ts index 88da16aceb..3b2ef423e5 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://www.npmjs.com/package/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 From 1ec6cdc9d273a95462d636027f63e448e9a766c0 Mon Sep 17 00:00:00 2001 From: Angus Fretwell Date: Sun, 10 Feb 2019 18:11:12 +1100 Subject: [PATCH 007/155] [rebass] extend styled-system interfaces, support html attributes, stricter as and css props --- types/rebass/index.d.ts | 156 ++++++++++++++++++---------------- types/rebass/rebass-tests.tsx | 17 ++-- 2 files changed, 94 insertions(+), 79 deletions(-) diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index 20c73079ad..db40da76ac 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -4,99 +4,107 @@ // ryee-dev // jamesmckenzie // sara f-p +// angusfretwell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from "react"; +import * as StyledComponents from "styled-components"; +import * as StyledSystem from "styled-system"; -export interface BaseProps extends React.ClassAttributes { - className?: string; - as?: any; +type Omit = Pick>; + +export interface BaseProps extends React.Props { + as?: React.ReactType; + css?: StyledComponents.CSSObject; } -export interface SpaceProps extends BaseProps { - m?: number | string | ReadonlyArray; - mt?: number | string | ReadonlyArray; - mr?: number | string | ReadonlyArray; - mb?: number | string | ReadonlyArray; - ml?: number | string | ReadonlyArray; - mx?: number | string | ReadonlyArray; - my?: number | string | ReadonlyArray; - p?: number | string | ReadonlyArray; - pt?: number | string | ReadonlyArray; - pr?: number | string | ReadonlyArray; - pb?: number | string | ReadonlyArray; - pl?: number | string | ReadonlyArray; - px?: number | string | ReadonlyArray; - py?: number | string | ReadonlyArray; -} +interface BoxKnownProps + extends BaseProps, + StyledSystem.SpaceProps, + StyledSystem.WidthProps, + StyledSystem.FontSizeProps, + StyledSystem.ColorProps, + StyledSystem.FlexProps, + StyledSystem.OrderProps, + StyledSystem.AlignSelfProps {} +export interface BoxProps + extends BoxKnownProps, + Omit, keyof BoxKnownProps> {} +export const Box: React.FunctionComponent; -export interface BoxProps extends SpaceProps { - className?: string; - width?: number | string | ReadonlyArray; - fontSize?: number | ReadonlyArray; - css?: object; - color?: string; - bg?: string; -} -// tslint:disable-next-line:strict-export-declare-modifiers -type BoxClass = React.FunctionComponent; -export const Box: BoxClass; - -export interface ButtonProps extends BoxProps { - fontWeight?: string; - border?: number | string; - borderColor?: string; - borderRadius?: number | string; - variant?: string; -} +export interface ButtonKnownProps + extends BoxKnownProps, + StyledSystem.FontWeightProps, + StyledSystem.BorderProps, + StyledSystem.BordersProps, + StyledSystem.BorderColorProps, + StyledSystem.BorderRadiusProps, + StyledSystem.ButtonStyleProps {} +export interface ButtonProps + extends ButtonKnownProps, + Omit, keyof ButtonKnownProps> {} export const Button: React.FunctionComponent; -export interface CardProps extends BoxProps { - border?: number | string; - borderColor?: string; - borderRadius?: number | string; - boxShadow?: string; - backgroundImage?: string; - backgroundSize?: string; - backgroundPosition?: string; - backgroundRepeat?: string; - opacity?: number; - variant?: string; +export interface CardKnownProps + extends BoxKnownProps, + StyledSystem.BorderProps, + StyledSystem.BordersProps, + StyledSystem.BorderColorProps, + StyledSystem.BorderRadiusProps, + StyledSystem.BoxShadowProps, + StyledSystem.BackgroundImageProps, + StyledSystem.BackgroundSizeProps, + StyledSystem.BackgroundPositionProps, + StyledSystem.BackgroundRepeatProps, + StyledSystem.OpacityProps { + variant?: StyledSystem.ResponsiveValue; } +export interface CardProps + extends CardKnownProps, + Omit, keyof CardKnownProps> {} export const Card: React.FunctionComponent; -export interface FlexProps extends BoxProps { - alignItems?: string; - justifyContent?: string; - flexDirection?: string; - flexWrap?: string; -} +export interface FlexKnownProps + extends BoxKnownProps, + StyledSystem.FlexWrapProps, + StyledSystem.FlexDirectionProps, + StyledSystem.AlignItemsProps, + StyledSystem.JustifyContentProps {} +export interface FlexProps + extends FlexKnownProps, + Omit, keyof FlexKnownProps> {} export const Flex: React.FunctionComponent; -export interface ImageProps extends BoxProps { - height?: number | string; - borderRadius?: number | string; - src?: string; - alt?: string; -} +export interface ImageKnownProps + extends BoxKnownProps, + StyledSystem.HeightProps, + StyledSystem.BorderRadiusProps {} +export interface ImageProps + extends ImageKnownProps, + Omit, keyof ImageKnownProps> {} export const Image: React.FunctionComponent; -export interface LinkProps extends BoxProps { - href?: string; -} +export interface LinkKnownProps extends BoxKnownProps {} +export interface LinkProps + extends LinkKnownProps, + Omit, keyof LinkKnownProps> {} export const Link: React.FunctionComponent; -export interface TextProps extends BoxProps { - fontSize?: number | ReadonlyArray; - fontWeight?: string; - color?: string; - fontFamily?: string; - textAlign?: string; - lineHeight?: number | string; - letterSpacing?: number | string; -} +export interface TextKnownProps + extends BoxKnownProps, + StyledSystem.FontFamilyProps, + StyledSystem.FontWeightProps, + StyledSystem.TextAlignProps, + StyledSystem.LineHeightProps, + StyledSystem.LetterSpacingProps {} +export interface TextProps + extends TextKnownProps, + Omit, keyof TextKnownProps> {} export const Text: React.FunctionComponent; -export type HeadingProps = TextProps; +export interface HeadingKnownProps extends TextKnownProps {} +export interface HeadingProps + extends HeadingKnownProps, + Omit, keyof HeadingKnownProps> {} export const Heading: React.FunctionComponent; diff --git a/types/rebass/rebass-tests.tsx b/types/rebass/rebass-tests.tsx index 53735775ff..52e3e7de28 100644 --- a/types/rebass/rebass-tests.tsx +++ b/types/rebass/rebass-tests.tsx @@ -1,13 +1,17 @@ -import * as React from 'react'; -import { Box, Flex, Text, Heading, Button, Link, Image, Card } from 'rebass'; +import * as React from "react"; +import { Box, Flex, Text, Heading, Button, Link, Image, Card } from "rebass"; + +const CustomComponent: React.FunctionComponent = ({ children }) => { + return

{children}
; +}; () => ( - + Hi, I'm a heading. - + Hi, I'm text. - Link + + Link + + CustomComponent From 5ff828d9f07f52fa432b036ffeb6c386016ac67c Mon Sep 17 00:00:00 2001 From: Angus Fretwell Date: Sun, 10 Feb 2019 18:33:28 +1100 Subject: [PATCH 008/155] [rebass] add ExtendedBox to test, add prop to CustomComponent example --- types/rebass/rebass-tests.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/types/rebass/rebass-tests.tsx b/types/rebass/rebass-tests.tsx index 52e3e7de28..87df64f323 100644 --- a/types/rebass/rebass-tests.tsx +++ b/types/rebass/rebass-tests.tsx @@ -1,10 +1,19 @@ import * as React from "react"; +import styled from "styled-components"; import { Box, Flex, Text, Heading, Button, Link, Image, Card } from "rebass"; const CustomComponent: React.FunctionComponent = ({ children }) => { return
{children}
; }; +const ExtendedBox = styled(Box)` + color: red; +`; + +ExtendedBox.defaultProps = { + p: 3 +}; + () => ( @@ -33,10 +42,13 @@ const CustomComponent: React.FunctionComponent = ({ children }) => { Link - CustomComponent + + CustomComponent + + ExtendedBox ); From 5fff1de627a6d17ebc2276b2fb06cb898faf9ab1 Mon Sep 17 00:00:00 2001 From: Angus Fretwell Date: Sun, 10 Feb 2019 18:39:16 +1100 Subject: [PATCH 009/155] [rebass] resolve lint warnings --- types/rebass/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index db40da76ac..8514783713 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -12,6 +12,8 @@ import * as React from "react"; import * as StyledComponents from "styled-components"; import * as StyledSystem from "styled-system"; +export {}; + type Omit = Pick>; export interface BaseProps extends React.Props { @@ -85,6 +87,7 @@ export interface ImageProps Omit, keyof ImageKnownProps> {} export const Image: React.FunctionComponent; +// tslint:disable-next-line no-empty-interface export interface LinkKnownProps extends BoxKnownProps {} export interface LinkProps extends LinkKnownProps, @@ -103,6 +106,7 @@ export interface TextProps Omit, keyof TextKnownProps> {} export const Text: React.FunctionComponent; +// tslint:disable-next-line no-empty-interface export interface HeadingKnownProps extends TextKnownProps {} export interface HeadingProps extends HeadingKnownProps, From d904c8218b11af59baee8a060a739bd64d507c80 Mon Sep 17 00:00:00 2001 From: Angus Fretwell Date: Sun, 10 Feb 2019 18:42:59 +1100 Subject: [PATCH 010/155] [rebass] bump typescript version to match styled-components --- types/rebass/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index 8514783713..fb2634ac2f 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -6,7 +6,7 @@ // sara f-p // angusfretwell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.9 import * as React from "react"; import * as StyledComponents from "styled-components"; From 63b47923b064dacc90a632d4a06d99676dda7c50 Mon Sep 17 00:00:00 2001 From: Angus Fretwell Date: Sun, 10 Feb 2019 18:50:39 +1100 Subject: [PATCH 011/155] [rebass] don't export 'known props' interfaces --- types/rebass/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index fb2634ac2f..d52d032284 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -35,7 +35,7 @@ export interface BoxProps Omit, keyof BoxKnownProps> {} export const Box: React.FunctionComponent; -export interface ButtonKnownProps +interface ButtonKnownProps extends BoxKnownProps, StyledSystem.FontWeightProps, StyledSystem.BorderProps, @@ -48,7 +48,7 @@ export interface ButtonProps Omit, keyof ButtonKnownProps> {} export const Button: React.FunctionComponent; -export interface CardKnownProps +interface CardKnownProps extends BoxKnownProps, StyledSystem.BorderProps, StyledSystem.BordersProps, @@ -67,7 +67,7 @@ export interface CardProps Omit, keyof CardKnownProps> {} export const Card: React.FunctionComponent; -export interface FlexKnownProps +interface FlexKnownProps extends BoxKnownProps, StyledSystem.FlexWrapProps, StyledSystem.FlexDirectionProps, @@ -78,7 +78,7 @@ export interface FlexProps Omit, keyof FlexKnownProps> {} export const Flex: React.FunctionComponent; -export interface ImageKnownProps +interface ImageKnownProps extends BoxKnownProps, StyledSystem.HeightProps, StyledSystem.BorderRadiusProps {} @@ -88,13 +88,13 @@ export interface ImageProps export const Image: React.FunctionComponent; // tslint:disable-next-line no-empty-interface -export interface LinkKnownProps extends BoxKnownProps {} +interface LinkKnownProps extends BoxKnownProps {} export interface LinkProps extends LinkKnownProps, Omit, keyof LinkKnownProps> {} export const Link: React.FunctionComponent; -export interface TextKnownProps +interface TextKnownProps extends BoxKnownProps, StyledSystem.FontFamilyProps, StyledSystem.FontWeightProps, @@ -107,7 +107,7 @@ export interface TextProps export const Text: React.FunctionComponent; // tslint:disable-next-line no-empty-interface -export interface HeadingKnownProps extends TextKnownProps {} +interface HeadingKnownProps extends TextKnownProps {} export interface HeadingProps extends HeadingKnownProps, Omit, keyof HeadingKnownProps> {} From 0a3f9e7dc8121bb5aa0f42521b1823e713b7249a Mon Sep 17 00:00:00 2001 From: Philippe Suter Date: Sun, 10 Feb 2019 21:50:13 -0500 Subject: [PATCH 012/155] Add definition for LineLoop in three Fixes #25294 --- types/three/index.d.ts | 1 + types/three/three-core.d.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/three/index.d.ts b/types/three/index.d.ts index 08b64250c8..420d48fe67 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -25,6 +25,7 @@ // Zhang Hao // Konstantin Lukaschenko // Daniel Yim +// Philippe Suter // Definitions: https://github.com//DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 4866cbfd54..34ac8cc1c5 100755 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -5273,13 +5273,23 @@ export class Line extends Object3D { geometry: Geometry | BufferGeometry; material: Material | Material[]; - type: "Line"; + type: "Line" | "LineLoop"; isLine: true; computeLineDistances(): this; raycast(raycaster: Raycaster, intersects: Intersection[]): void; } +export class LineLoop extends Line { + constructor( + geometry?: Geometry | BufferGeometry, + material?: Material | Material[] + ); + + type: "LineLoop"; + isLineLoop: true; +} + /** * @deprecated */ From 5b1aa827d29ccaeb4af8e20685cb6a84febf655b Mon Sep 17 00:00:00 2001 From: carl-coolblue Date: Mon, 11 Feb 2019 15:49:05 +0100 Subject: [PATCH 013/155] pickaday: add explicit null types to match usage for setStartRange, setDate and setEndRange --- types/pikaday/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/pikaday/index.d.ts b/types/pikaday/index.d.ts index 3adb7fc340..5a956cc504 100644 --- a/types/pikaday/index.d.ts +++ b/types/pikaday/index.d.ts @@ -44,7 +44,7 @@ declare class Pikaday { * can optionally be passed as the second parameter to prevent triggering * of the onSelect callback, allowing the date to be set silently. */ - setDate(date: string | Date, preventOnSelect?: boolean): void; + setDate(date: string | Date | null, preventOnSelect?: boolean): void; /** * Returns a Moment.js object for the selected date (Moment must be @@ -101,13 +101,13 @@ declare class Pikaday { * Update the range start date. For using two Pikaday instances to * select a date range. */ - setStartRange(date: Date): void; + setStartRange(date: Date | null): void; /** * Update the range end date. For using two Pikaday instances to select * a date range. */ - setEndRange(date: Date): void; + setEndRange(date: Date | null): void; /** * Update the HTML. From 766ab98213db96519bf75ab941370b424bc90d2c Mon Sep 17 00:00:00 2001 From: carl-coolblue Date: Mon, 11 Feb 2019 15:59:24 +0100 Subject: [PATCH 014/155] pikaday: Add missing definition for clear --- types/pikaday/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/pikaday/index.d.ts b/types/pikaday/index.d.ts index 5a956cc504..5fc8d0f33e 100644 --- a/types/pikaday/index.d.ts +++ b/types/pikaday/index.d.ts @@ -138,6 +138,11 @@ declare class Pikaday { * Hide the picker and remove all event listeners - no going back! */ destroy(): void; + + /** + * Clear and reset the date + */ + clear(): void; } // merge the Pikaday class declaration with a module From 1b75aeb427c14f093eba6da775df4551fe0e1efa Mon Sep 17 00:00:00 2001 From: jameswilddev Date: Mon, 11 Feb 2019 20:03:55 +0000 Subject: [PATCH 015/155] Added pixel_art to favicons configuration. --- types/favicons/index.d.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/types/favicons/index.d.ts b/types/favicons/index.d.ts index 6bd3a4892e..52cae63088 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 From e88523dd33c76a97b804ba065f7cd238dd07bed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kr=C3=A1l=C3=ADk?= Date: Tue, 12 Feb 2019 10:04:56 +0100 Subject: [PATCH 016/155] Update debugger.log function Definition of `debugger.log` should be less strict because definition of `console.log` is: `log(message?: any, ...optionalParams: any[]): void;` --- types/debug/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/debug/index.d.ts b/types/debug/index.d.ts index 2067b27222..79dc77cb92 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; } From 669fd35ec8e31eb5151de5d5d792a8e28c17a535 Mon Sep 17 00:00:00 2001 From: Sergey Rubanov Date: Tue, 12 Feb 2019 20:28:54 +0300 Subject: [PATCH 017/155] [elliptic] pers option in genKeyPair method is optional --- types/elliptic/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From c4f78e39af302ca01bc984df6ca4b91924a94335 Mon Sep 17 00:00:00 2001 From: Daniel Yule Date: Tue, 12 Feb 2019 11:02:25 -0800 Subject: [PATCH 018/155] Fix the signature for .open --- types/angular-material/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index 19c6dcc9e5..62060c4cd1 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?: JQueryEventObject): void; } interface IColorPalette { From e996a32a0285def3a1e7cc71a679dc0d21c1726c Mon Sep 17 00:00:00 2001 From: Daniel Yule Date: Tue, 12 Feb 2019 11:08:06 -0800 Subject: [PATCH 019/155] Fix the signature for .open --- types/angular-material/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index 62060c4cd1..56ec1474d2 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?: JQueryEventObject): void; + open(event?: MouseEvent | JQueryEventObject): void; } interface IColorPalette { From 17a24edb012e06c05dac9158b7d5266df667ef95 Mon Sep 17 00:00:00 2001 From: antoinebrault Date: Tue, 12 Feb 2019 17:06:30 -0500 Subject: [PATCH 020/155] [jest] add mock result type --- types/jest/index.d.ts | 31 ++++++++++++++++++++----------- types/jest/jest-tests.ts | 13 +++++++++++++ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 526beb2dc7..a09263369e 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -976,20 +976,29 @@ declare namespace jest { } /** - * Represents the result of a single call to a mock function. + * Represents the result of a single call to a mock function with a return value. */ - interface MockResult { - /** - * True if the function threw. - * False if the function returned. - */ - isThrow: boolean; - /** - * The value that was either thrown or returned by the function. - */ + interface MockResultReturn { + type: 'return'; + value: T; + } + /** + * Represents the result of a single incomplete call to a mock function. + */ + interface MockResultIncomplete { + type: 'incomplete'; + value: undefined; + } + /** + * Represents the result of a single call to a mock function with a thrown error. + */ + interface MockResultThrow { + type: 'throw'; value: any; } + type MockResult = MockResultReturn | MockResultThrow | MockResultIncomplete; + interface MockContext { calls: Y[]; instances: T[]; @@ -997,7 +1006,7 @@ declare namespace jest { /** * List of results of calls to the mock function. */ - results: MockResult[]; + results: Array>; } } diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index c643ca6a57..3ac82cda9d 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -480,6 +480,19 @@ mocked.test4.mockRejectedValue(new Error()); // $ExpectError mocked.test4.mockRejectedValueOnce(new Error()); +const mockResult = jest.fn(() => 1).mock.results[0]; +switch (mockResult.type) { + case 'return': + mockResult.value; // $ExpectType number + break; + case 'incomplete': + mockResult.value; // $ExpectType undefined + break; + case 'throw': + mockResult.value; // $ExpectType any + break; +} + /* Snapshot serialization */ const snapshotSerializerPlugin: jest.SnapshotSerializerPlugin = { From 470bc81d42dc259c60432740e310ae6c2eb77428 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 12 Feb 2019 17:10:37 -0500 Subject: [PATCH 021/155] Update index.d.ts --- types/npm/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/npm/index.d.ts b/types/npm/index.d.ts index 7c34199262..a18edb699e 100644 --- a/types/npm/index.d.ts +++ b/types/npm/index.d.ts @@ -167,7 +167,7 @@ declare namespace NPM { Conf: ConfigStatic; defs: ConfigDefs; - get(setting: string): T; + get(setting: string): any; set(setting: string, value: T): void; loadPrefix(cb: ErrorCallback): void; From 04f71b3cdcbb3f1429089de5d132eb77171dff8f Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 4 Feb 2019 16:36:02 -0800 Subject: [PATCH 022/155] Update node-sass typings. This patch adds types for the javascript representation of sass data types. Building on that, there are updates to the definitions of the importer and functions options to be more specific and avoid the use of any for arguments passed to functions from node-sass. The context objects and async APIs are bifurcated so that it is illegal to pass async functions to a synchronous compilation. This patch is a likely breaking change for anyone who's using types with node-sass, especially if they're working with importers or function declarations. Because node-sass is now at 4.11, I recommend a major and minor version bump to match the latest version of node-sass `4.11.0`. This will prevent existing users of @types/node-sass from breaking. --- types/node-sass/index.d.ts | 426 ++++++++++++++++++++++++++--- types/node-sass/node-sass-tests.ts | 300 ++++++++++++++++++-- types/node-sass/tsconfig.json | 2 +- 3 files changed, 658 insertions(+), 70 deletions(-) diff --git a/types/node-sass/index.d.ts b/types/node-sass/index.d.ts index b208b57f19..e6d9ad789e 100644 --- a/types/node-sass/index.d.ts +++ b/types/node-sass/index.d.ts @@ -1,56 +1,398 @@ -// Type definitions for Node Sass v3.10.1 +// Type definitions for node-sass 4.11.0 // Project: https://github.com/sass/node-sass -// Definitions by: Asana +// Definitions by: Asana , Chris Eppstein // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// -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: Array) => types.ReturnValue; + +// ** Sync Sass functions receiving variable # of arguments *** +export type SyncSassVarArgFn1 = (this: SyncContext, $arg1: Array) => types.ReturnValue; +export type SyncSassVarArgFn2 = (this: SyncContext, $arg1: types.Value, $arg2: Array) => types.ReturnValue; +export type SyncSassVarArgFn3 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: Array) => types.ReturnValue; +export type SyncSassVarArgFn4 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: Array) => types.ReturnValue; +export type SyncSassVarArgFn5 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: Array) => types.ReturnValue; +export type SyncSassVarArgFn6 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: Array) => 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: Array, cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn2 = (this: AsyncContext, $arg1: types.Value, $arg2: Array, cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn3 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: Array, cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn4 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: Array, cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn5 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: Array, cb: SassFunctionCallback) => void; +export type AsyncSassVarArgFn6 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: Array, cb: SassFunctionCallback) => void; + +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 | Array; + functions?: FunctionDeclarations; + includePaths?: Array; + 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 | Array; +} + +/** + * 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: Array; + }; +} +export type SassRenderCallback = (err: SassError, result: Result) => unknown; + +export namespace types { + /* eslint-disable @typescript-eslint/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 */ +} + +// *** Top level Constants *** + +export const NULL: types.Null; +export const TRUE: types.Boolean; +export const FALSE: types.Boolean; +export const info: string; +export declare function render(options: Options, callback: SassRenderCallback): void; +export declare 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..bc057f866d 100644 --- a/types/node-sass/node-sass-tests.ts +++ b/types/node-sass/node-sass-tests.ts @@ -1,23 +1,49 @@ 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 = 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) + done(null); + } + // only one of them is required, see section Special Behaviors. + done({ file: result.path }); + done({ contents: result.data }); + }); +} + +const handleAsyncResult: sass.SassRenderCallback = function(error, result) { // node-style callback from v3.0.0 onwards if (error) { console.log(error.status, error.column, error.message, error.line); } @@ -28,21 +54,143 @@ sass.render({ // or better console.log(JSON.stringify(result.map)); // note, JSON.stringify accepts Buffer too } -}); +}; + +const syncFunction: Record = { + "pow($base, $exp)": function ($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...)": function($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"); + } + let unit = $n1.getUnit(); + if ($n2.getUnit() !== unit) { + throw new Error("units don't match"); + } + let accum = $n1.getValue() + $n2.getValue(); + $ns.forEach(function ($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)": function ($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...)": function($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; + } + let unit = $n1.getUnit(); + if ($n2.getUnit() !== unit) { + done(new sass.types.Error("units don't match")); + return; + } + let accum = $n1.getValue() + $n2.getValue(); + for (let i = 0; i < $ns.length; i++) { + let $n = $ns[i]; + 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 +198,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 +let true1 = sass.types.Boolean(true); +true1.getValue(); // true +let true2 = sass.types.Boolean.TRUE; +let true3 = sass.TRUE; +sameType(true2, true3); +true2 === true3 // true +let false1 = sass.types.Boolean(false); +let false2 = sass.types.Boolean.FALSE; +let false3 = sass.FALSE; +false2 === false3 // true +false1.getValue(); // false +let null1 = sass.types.Null(); +let null2 = sass.types.Null.NULL; +let null3 = sass.NULL; +sameType(null2, null3); +null1 === null2; // true +null1 === null3; // true +let ident = sass.types.String("x"); +ident.getValue(); // 'x' +let stringQuoted = sass.types.String("'x'"); +stringQuoted.getValue(); // '\'x\'' +let number = sass.types.Number(5); +number.getUnit(); // "" +number.getValue(); // 5 +let dimension = sass.types.Number(5, "px"); +dimension.getUnit(); // "px" +let redOpaque = sass.types.Color(240, 15, 0); +redOpaque.getR(); // 240 +redOpaque.getG(); // 15 +redOpaque.getB(); // 0 +redOpaque.getA(); // 1 +let redTranslucent = sass.types.Color(240, 15, 0, 0.5); +redTranslucent.getA(); // 0.5 +let redOpaque2 = sass.types.Color(0xF00F00FF); +redOpaque2.getR(); // 240 +redOpaque2.getG(); // 15 +redOpaque2.getB(); // 0 +redOpaque2.getA(); // 1 +let redTranslucent2 = sass.types.Color(0xF00F007F); +redTranslucent.getA(); // 0.5 +let 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 +let spaceList2 = sass.types.List(1, false); +spaceList2.setValue(0, sass.types.String("s")); +let commaList1 = sass.types.List(2, true); +commaList1.getLength(); // 2 +commaList1.getSeparator(); // true (it's a comma) +commaList1.setValue(0, spaceList1); +commaList1.setValue(2, spaceList2); +let 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 +let error = new sass.types.Error("message"); + +function valuesOf(enumerable: sass.types.Enumerable): sass.types.Value[] { + let 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. +// let newTrue = new sass.types.Boolean(true); +// let newFalse = new sass.types.Boolean(false); +// let newNull = new sass.types.Null(); +let newIdent = new sass.types.String("x"); +let newNumber = new sass.types.Number(5); +let newDimension = new sass.types.Number(5, "px"); +let newRedOpaque = new sass.types.Color(240, 15, 0); +let newRedTranslucent = new sass.types.Color(240, 15, 0, 0.5); +let newRedOpaque2 = new sass.types.Color(0xF00F00FF); +let newSpaceList1 = new sass.types.List(1); +let newSpaceList2 = new sass.types.List(1, false); +let newCommaList1 = new sass.types.List(2, true); +let newMap1 = new sass.types.Map(2); +let newError = new sass.types.Error("message"); \ No newline at end of file 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": [ From 269341faadbc78beb31be5525d6a7ac93943c529 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 12 Feb 2019 21:32:51 -0500 Subject: [PATCH 023/155] Change setter to any --- types/npm/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/npm/index.d.ts b/types/npm/index.d.ts index a18edb699e..066a932440 100644 --- a/types/npm/index.d.ts +++ b/types/npm/index.d.ts @@ -168,7 +168,7 @@ declare namespace NPM { defs: ConfigDefs; get(setting: string): any; - set(setting: string, value: T): void; + set(setting: string, value: any): void; loadPrefix(cb: ErrorCallback): void; loadCAFile(caFilePath: string, cb: ErrorCallback): void; From 0a4a5e1f26045b87d0d341b7c830054c934f240a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E7=94=9FPeA?= Date: Wed, 13 Feb 2019 22:15:04 +0800 Subject: [PATCH 024/155] update for moveto v1.8.0 --- types/moveto/index.d.ts | 7 ++++++- types/moveto/moveto-tests.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) 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: () => {} }; From ad1f840706fde09ed2da1ef83f19111b22381223 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 13 Feb 2019 08:04:02 -0800 Subject: [PATCH 025/155] [node-sass] Enable most lint rules and fix linter errors. --- types/node-sass/index.d.ts | 60 +++++++++------- types/node-sass/node-sass-tests.ts | 107 ++++++++++++++--------------- types/node-sass/tslint.json | 78 ++------------------- 3 files changed, 92 insertions(+), 153 deletions(-) diff --git a/types/node-sass/index.d.ts b/types/node-sass/index.d.ts index e6d9ad789e..d5d1933a2b 100644 --- a/types/node-sass/index.d.ts +++ b/types/node-sass/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for node-sass 4.11.0 +// Type definitions for node-sass 4.11 // Project: https://github.com/sass/node-sass -// Definitions by: Asana , Chris Eppstein +// Definitions by: Asana , Chris Eppstein // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 @@ -36,15 +36,16 @@ 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: Array) => types.ReturnValue; +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: Array) => types.ReturnValue; -export type SyncSassVarArgFn2 = (this: SyncContext, $arg1: types.Value, $arg2: Array) => types.ReturnValue; -export type SyncSassVarArgFn3 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: Array) => types.ReturnValue; -export type SyncSassVarArgFn4 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: Array) => types.ReturnValue; -export type SyncSassVarArgFn5 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: Array) => types.ReturnValue; -export type SyncSassVarArgFn6 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: Array) => types.ReturnValue; +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; @@ -58,12 +59,13 @@ export type AsyncSassFn5 = (this: AsyncContext, $arg1: types.Value, $arg2: types 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: Array, cb: SassFunctionCallback) => void; -export type AsyncSassVarArgFn2 = (this: AsyncContext, $arg1: types.Value, $arg2: Array, cb: SassFunctionCallback) => void; -export type AsyncSassVarArgFn3 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: Array, cb: SassFunctionCallback) => void; -export type AsyncSassVarArgFn4 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: Array, cb: SassFunctionCallback) => void; -export type AsyncSassVarArgFn5 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: Array, cb: SassFunctionCallback) => void; -export type AsyncSassVarArgFn6 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: Array, cb: SassFunctionCallback) => void; +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; @@ -77,9 +79,9 @@ export type FunctionDeclarations; + importer?: Importer | Importer[]; functions?: FunctionDeclarations; - includePaths?: Array; + includePaths?: string[]; indentedSyntax?: boolean; indentType?: string; indentWidth?: number; @@ -98,7 +100,7 @@ export interface Options { export interface SyncOptions extends Options { functions?: FunctionDeclarations; - importer?: SyncImporter | Array; + importer?: SyncImporter | SyncImporter[]; } /** @@ -125,13 +127,20 @@ export interface Result { start: number; end: number; duration: number; - includedFiles: Array; + includedFiles: string[]; }; } export type SassRenderCallback = (err: SassError, result: Result) => unknown; +// 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. */ @@ -374,18 +383,21 @@ export namespace types { } interface ErrorConstructor { - /** An error return value for async functions. + /** + * 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. + /** + * 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 + export const Error: ErrorConstructor; /* eslint-enable @typescript-eslint/ban-types */ + /* tslint:enable:ban-types */ } // *** Top level Constants *** @@ -394,5 +406,5 @@ export const NULL: types.Null; export const TRUE: types.Boolean; export const FALSE: types.Boolean; export const info: string; -export declare function render(options: Options, callback: SassRenderCallback): void; -export declare function renderSync(options: SyncOptions): Result; +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 bc057f866d..e8ae73cef7 100644 --- a/types/node-sass/node-sass-tests.ts +++ b/types/node-sass/node-sass-tests.ts @@ -30,8 +30,8 @@ const asyncImporter: sass.AsyncImporter = function(url, prev, done) { } }; -const anotherAsyncImporter: sass.AsyncImporter = function (url, prev, done) { - someAsyncFunction(url, prev, function (result) { +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) @@ -41,13 +41,12 @@ const anotherAsyncImporter: sass.AsyncImporter = function (url, prev, done) { done({ file: result.path }); done({ contents: result.data }); }); -} +}; -const handleAsyncResult: sass.SassRenderCallback = function(error, result) { // node-style callback from v3.0.0 onwards +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()); @@ -57,7 +56,7 @@ const handleAsyncResult: sass.SassRenderCallback = function(error, result) { // }; const syncFunction: Record = { - "pow($base, $exp)": function ($base, $exp) { + "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) { @@ -72,19 +71,19 @@ const syncFunction: Record = { }; const syncVarArg: Record = { - "add-all($n1, $n2, $ns...)": function($n1, $n2, $ns) { + "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"); } - let unit = $n1.getUnit(); + const unit = $n1.getUnit(); if ($n2.getUnit() !== unit) { throw new Error("units don't match"); } let accum = $n1.getValue() + $n2.getValue(); - $ns.forEach(function ($n) { + $ns.forEach(($n) => { if (!($n instanceof sass.types.Number)) { throw new Error("Expected a number"); } @@ -100,7 +99,7 @@ const syncVarArg: Record = { const syncFunctions: Record = {...syncFunction, ...syncVarArg}; const asyncFunction: Record = { - "pow-async($base, $exp)": function ($base, $exp, done) { + "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) { @@ -115,7 +114,7 @@ const asyncFunction: Record = { }; const asyncVarArg: Record = { - "add-all-async($n1, $n2, $ns...)": function($n1, $n2, $ns, done) { + "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; @@ -124,14 +123,13 @@ const asyncVarArg: Record = { done(new sass.types.Error("Expected a number")); return; } - let unit = $n1.getUnit(); + 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 (let i = 0; i < $ns.length; i++) { - let $n = $ns[i]; + for (const $n of $ns) { if (!($n instanceof sass.types.Number)) { done(new sass.types.Error("Expected a number")); return; @@ -141,7 +139,6 @@ const asyncVarArg: Record = { return; } accum = accum + $n.getValue(); - } done(sass.types.Number(accum, unit)); } @@ -204,47 +201,47 @@ function sameType(v1: V, v2: V): boolean { } // function-based Constructors and instance methods for types -let true1 = sass.types.Boolean(true); +const true1 = sass.types.Boolean(true); true1.getValue(); // true -let true2 = sass.types.Boolean.TRUE; -let true3 = sass.TRUE; +const true2 = sass.types.Boolean.TRUE; +const true3 = sass.TRUE; sameType(true2, true3); -true2 === true3 // true -let false1 = sass.types.Boolean(false); -let false2 = sass.types.Boolean.FALSE; -let false3 = sass.FALSE; -false2 === false3 // true +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 -let null1 = sass.types.Null(); -let null2 = sass.types.Null.NULL; -let null3 = sass.NULL; +const null1 = sass.types.Null(); +const null2 = sass.types.Null.NULL; +const null3 = sass.NULL; sameType(null2, null3); null1 === null2; // true null1 === null3; // true -let ident = sass.types.String("x"); +const ident = sass.types.String("x"); ident.getValue(); // 'x' -let stringQuoted = sass.types.String("'x'"); +const stringQuoted = sass.types.String("'x'"); stringQuoted.getValue(); // '\'x\'' -let number = sass.types.Number(5); +const number = sass.types.Number(5); number.getUnit(); // "" number.getValue(); // 5 -let dimension = sass.types.Number(5, "px"); +const dimension = sass.types.Number(5, "px"); dimension.getUnit(); // "px" -let redOpaque = sass.types.Color(240, 15, 0); +const redOpaque = sass.types.Color(240, 15, 0); redOpaque.getR(); // 240 redOpaque.getG(); // 15 redOpaque.getB(); // 0 redOpaque.getA(); // 1 -let redTranslucent = sass.types.Color(240, 15, 0, 0.5); +const redTranslucent = sass.types.Color(240, 15, 0, 0.5); redTranslucent.getA(); // 0.5 -let redOpaque2 = sass.types.Color(0xF00F00FF); +const redOpaque2 = sass.types.Color(0xF00F00FF); redOpaque2.getR(); // 240 redOpaque2.getG(); // 15 redOpaque2.getB(); // 0 redOpaque2.getA(); // 1 -let redTranslucent2 = sass.types.Color(0xF00F007F); +const redTranslucent2 = sass.types.Color(0xF00F007F); redTranslucent.getA(); // 0.5 -let spaceList1 = sass.types.List(1); +const spaceList1 = sass.types.List(1); spaceList1.getLength(); // 1 spaceList1.getSeparator(); // false spaceList1.setValue(0, ident); @@ -254,24 +251,24 @@ spaceList1.setValue(0, null1); spaceList1.setValue(0, dimension); spaceList1.setValue(0, redOpaque); spaceList1.getValue(0) === redOpaque; // true -let spaceList2 = sass.types.List(1, false); +const spaceList2 = sass.types.List(1, false); spaceList2.setValue(0, sass.types.String("s")); -let commaList1 = sass.types.List(2, true); +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); -let map1 = sass.types.Map(2); +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 -let error = new sass.types.Error("message"); +const error = new sass.types.Error("message"); function valuesOf(enumerable: sass.types.Enumerable): sass.types.Value[] { - let values = new Array(); + const values = new Array(); for (let i = 0; i < enumerable.getLength(); i++) { values.push(enumerable.getValue(i)); } @@ -285,17 +282,17 @@ console.dir(arr); // new-based Constructors // boolean and null raise a runtime error if constructed with new. -// let newTrue = new sass.types.Boolean(true); -// let newFalse = new sass.types.Boolean(false); -// let newNull = new sass.types.Null(); -let newIdent = new sass.types.String("x"); -let newNumber = new sass.types.Number(5); -let newDimension = new sass.types.Number(5, "px"); -let newRedOpaque = new sass.types.Color(240, 15, 0); -let newRedTranslucent = new sass.types.Color(240, 15, 0, 0.5); -let newRedOpaque2 = new sass.types.Color(0xF00F00FF); -let newSpaceList1 = new sass.types.List(1); -let newSpaceList2 = new sass.types.List(1, false); -let newCommaList1 = new sass.types.List(2, true); -let newMap1 = new sass.types.Map(2); -let newError = new sass.types.Error("message"); \ No newline at end of file +// 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/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 } } From c80c69a4221c25ac0feace6472a44f466bb95316 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 13 Feb 2019 08:13:16 -0800 Subject: [PATCH 026/155] Lower typescript version requirement to 2.7 for node-sass. Increase to 2.7 for node-sass-middleware and sass-webpack-plugin. --- types/node-sass-middleware/index.d.ts | 2 +- types/node-sass/index.d.ts | 4 ++-- types/sass-webpack-plugin/index.d.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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 d5d1933a2b..f5445689b4 100644 --- a/types/node-sass/index.d.ts +++ b/types/node-sass/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/sass/node-sass // Definitions by: Asana , Chris Eppstein // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.7 /// @@ -130,7 +130,7 @@ export interface Result { includedFiles: string[]; }; } -export type SassRenderCallback = (err: SassError, result: Result) => unknown; +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 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'; From 535257e134f3cab298a7b9e75f7cdba669d7699c Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Wed, 13 Feb 2019 11:34:19 +0100 Subject: [PATCH 027/155] Remove library --- notNeededPackages.json | 6 ++ .../i18next-browser-languagedetector-tests.ts | 61 ------------------- .../tsconfig.json | 24 -------- .../tslint.json | 1 - .../i18next-browser-languagedetector-tests.ts | 42 ------------- .../v0/index.d.ts | 58 ------------------ .../v0/tsconfig.json | 28 --------- .../v0/tslint.json | 11 ---- 8 files changed, 6 insertions(+), 225 deletions(-) delete mode 100644 types/i18next-browser-languagedetector/i18next-browser-languagedetector-tests.ts delete mode 100644 types/i18next-browser-languagedetector/tsconfig.json delete mode 100644 types/i18next-browser-languagedetector/tslint.json delete mode 100644 types/i18next-browser-languagedetector/v0/i18next-browser-languagedetector-tests.ts delete mode 100644 types/i18next-browser-languagedetector/v0/index.d.ts delete mode 100644 types/i18next-browser-languagedetector/v0/tsconfig.json delete mode 100644 types/i18next-browser-languagedetector/v0/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 0fb0529ef4..03a5f1df51 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": "2.0.2" + }, { "libraryName": "i18next-xhr-backend", "typingsPackageName": "i18next-xhr-backend", 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/tsconfig.json b/types/i18next-browser-languagedetector/tsconfig.json deleted file mode 100644 index 32755315aa..0000000000 --- a/types/i18next-browser-languagedetector/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "i18next-browser-languagedetector-tests.ts" - ] -} \ No newline at end of file diff --git a/types/i18next-browser-languagedetector/tslint.json b/types/i18next-browser-languagedetector/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/i18next-browser-languagedetector/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } 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/tsconfig.json b/types/i18next-browser-languagedetector/v0/tsconfig.json deleted file mode 100644 index 9873c74134..0000000000 --- a/types/i18next-browser-languagedetector/v0/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": 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" - ] -} \ No newline at end of file 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 - ] - } -} From ddb1121ab19d224ddd007496f0426229a7244978 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Wed, 13 Feb 2019 19:20:39 +0100 Subject: [PATCH 028/155] Fix --- .../index.d.ts | 65 ------------------- 1 file changed, 65 deletions(-) delete mode 100644 types/i18next-browser-languagedetector/index.d.ts 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; From e97219e062955da01722d18f19cb62384fe9fd30 Mon Sep 17 00:00:00 2001 From: Nadun Indunil Date: Thu, 14 Feb 2019 00:09:14 +0530 Subject: [PATCH 029/155] add: node-jose typings --- types/node-jose/index.d.ts | 342 +++++++++++++++++++++++++++++ types/node-jose/node-jose-tests.ts | 300 +++++++++++++++++++++++++ types/node-jose/tsconfig.json | 23 ++ types/node-jose/tslint.json | 3 + 4 files changed, 668 insertions(+) create mode 100644 types/node-jose/index.d.ts create mode 100644 types/node-jose/node-jose-tests.ts create mode 100644 types/node-jose/tsconfig.json create mode 100644 types/node-jose/tslint.json diff --git a/types/node-jose/index.d.ts b/types/node-jose/index.d.ts new file mode 100644 index 0000000000..b0b3bd0bc8 --- /dev/null +++ b/types/node-jose/index.d.ts @@ -0,0 +1,342 @@ +// Type definitions for node-jose 1.1.1 +// Project: https://github.com/cisco/node-jose +// Definitions by: Nadun Indunil +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export function canYouSee(ks: JWK.Key | JWK.KeyStore, opts: object): JWS.Verifier; + +export namespace JWA { + type decryptEncryptOptions = { + aad?: Buffer; + adata?: Buffer; + iv?: Buffer; + tag?: Buffer; // Not used in encrypt + mac?: Buffer; // Not used in encrypt + epu?: Buffer; // encryption party info + epv?: Buffer; // encryption party info + kdata?: Buffer; + epk?: Buffer; // ephemeral pub key used in ec + enc?: string; // algorithm to use in ec + alg?: string; // variation of enc, probably oversight in lib code + apu?: Buffer; // agreement party info used in ec + apv?: Buffer; // agreement party info used in ec + p2s?: Buffer; // used in pbes + p2c?: number; // used in pbes + }; + + type deriveOptions = { + length?: number; // key length + otherInfo?: Buffer; // info used in concatkdf + public?: Buffer; // public key used in ecdh + hash?: Buffer; // hash used in ecdh + salt?: Buffer; // salt value used in hkdf + info?: Buffer; // app identifier info used in hkdf + }; + + type encryptReturn = { + data: Buffer; // The cipher text + tag?: Buffer; // The tag used in some algorithms + }; + + type signReturn = { + data: Buffer; // the data passed into the sign function + mac: Buffer; // the signature for `data` + }; + + type signVerifyOptions = { loose?: boolean }; + + type verifyReturn = { + data: Buffer; // the data passed into the verify function + mac: Buffer; // the signature for `data` + valid: boolean; // whether the signature matches the data + }; + + function decrypt( + alg: string, + key: string | Buffer, + cdata: string | Buffer, + props?: decryptEncryptOptions + ): Promise; + + function derive(alg: string, key: string | Buffer, props?: deriveOptions): Promise; + + function digest(alg: string, data: string | Buffer, props?: any): Promise; + + function encrypt( + alg: string, + key: string | Buffer, + pdata: string | Buffer, + props?: decryptEncryptOptions + ): Promise; + + function sign( + alg: string, + key: string | Buffer, + pdata: string | Buffer, + props: signVerifyOptions + ): Promise; + + function verify( + alg: string, + key: string | Buffer, + pdata: string | Buffer, + mac: string | Buffer, + props: signVerifyOptions + ): Promise; +} + +export namespace JWE { + function createEncrypt(key: JWK.Key): JWE.Encryptor; + function createEncrypt(keys: JWK.Key[]): JWE.Encryptor; + function createEncrypt( + options: { + format?: 'compact' | 'flattened'; + zip?: boolean; + fields?: object; + }, + key: JWK.Key + ): JWE.Encryptor; + + function createDecrypt(key: JWK.Key | JWK.KeyStore, opts?: any): JWE.Decryptor; + + export interface Encryptor { + update(input: any): this; + final(): Promise; + } + + export interface Decryptor { + decrypt(input: string): Promise; + } + + export interface DecryptResult { + /** + * an array of the member names from the "protected" member + */ + protected: string[]; + /** + * the decrypted content (alternate) + */ + plaintext: Buffer; + } +} + +export namespace JWK { + const MODE_DECRYPT: string; + + const MODE_ENCRYPT: string; + + const MODE_SIGN: string; + + const MODE_UNWRAP: string; + + const MODE_VERIFY: string; + + const MODE_WRAP: string; + + function asKey( + key: string | Buffer | object | RawKey, + form?: 'json' | 'private' | 'pkcs8' | 'public' | 'spki' | 'pkix' | 'x509' | 'pem' + ): Promise; + /** + * To import a JWK-set as a keystore + */ + function asKeyStore(ks: object | string): Promise; + + function createKey(kty: any, size: any, props: any): Promise; + /** + * To create an empty keystore + */ + function createKeyStore(): JWK.KeyStore; + + function isKey(input: any): input is JWK.Key; + + function isKeyStore(input: any): input is JWK.KeyStore; + + export type KeyUse = 'sig' | 'enc' | 'desc'; + + export interface JWEEncryptor { + update(input: any): this; + final(): Promise; + } + + export interface RawKey { + alg: string; + kty: string; + use: KeyUse; + + // e and n make up the public key + e: string; + n: string; + } + + export interface KeyStoreGetFilter { + kty?: string; + use?: KeyUse; + alg?: string; + } + + export interface KeyStoreGetOptions extends KeyStoreGetFilter { + kid: string; + } + + export interface KeyStore { + /** + * To export the public keys of a keystore as a JWK-set + */ + toJSON(exportPrivateKeys?: boolean): object; + /** + * To retrieve a key from a keystore + */ + get(kid: string, filter?: KeyStoreGetFilter): RawKey; + get(options: KeyStoreGetOptions): RawKey; + all(options?: Partial): RawKey[]; + add(key: RawKey): Promise; + /** + * @param key + * String serialization of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER + * Buffer of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER + * @param form + * is either a: + * - "json" for a JSON stringified JWK + * - "private" for a DER encoded 'raw' private key + * - "pkcs8" for a DER encoded (unencrypted!) PKCS8 private key + * - "public" for a DER encoded SPKI public key (alternate to 'spki') + * - "spki" for a DER encoded SPKI public key + * - "pkix" for a DER encoded PKIX X.509 certificate + * - "x509" for a DER encoded PKIX X.509 certificate + * - "pem" for a PEM encoded of PKCS8 / SPKI / PKIX + */ + add( + key: string | Buffer | JWK.Key | object, + form?: 'json' | 'private' | 'pkcs8' | 'public' | 'spki' | 'pkix' | 'x509' | 'pem' + ): Promise; + + generate(kty: string, size?: string | number, props?: any): Promise; + + remove(key: JWK.Key): void; + } + + export interface Key { + keystore: JWK.KeyStore; + length: number; + kty: string; + kid: string; + use: KeyUse; + alg: string; + + toPEM(isPrivate?: boolean): string; + toJSON(isPrivate?: boolean, excluded?: string[]): object; + thumbprint(hash?: string): Promise; + } +} + +export namespace JWS { + function createSign(key: JWK.Key): JWS.Signer; + function createSign(keys: JWK.Key[]): JWS.Signer; + function createSign( + options: { + format?: 'compact' | 'flattened'; + alg?: string; + compact?: boolean; + fields?: object; + }, + key: JWK.Key | JWK.Key[] + ): JWS.Signer; + + /** + * Using a keystore. + */ + function createVerify(keyStore: JWK.KeyStore): JWS.Verifier; + + /** + * To verify using a key embedded in the JWS + */ + function createVerify(): JWS.Verifier; + + function createVerify( + input: string | JWK.Key | object, + opts?: { allowEmbeddedKey?: boolean; algorithms?: string[]; handlers?: any } + ): JWS.Verifier; + + export interface createSignResult { + signResult: object; + } + + export interface Signer { + update(input: Buffer | string, encoding?: string): this; + final(): Promise; + } + + export interface BaseResult { + /** + * the combined 'protected' and 'unprotected' header members + */ + header: object; + /** + * the signed content + */ + payload: Buffer; + /** + * The key used to verify the signature + */ + key: JWK.Key; + protected: string[]; + } + + export interface VerificationResult extends BaseResult { + /** + * the verified signature + */ + signature: Buffer | string; + } + + export interface Verifier { + verify(input: string, opts?: { allowEmbeddedKey?: boolean }): Promise; + } + + export interface exp { + complete(jws: any): any; + } + + export interface verifyOptions { + allowEmbeddedKey?: boolean; + algorithms?: string[]; + handlers: { exp: boolean | exp }; + } +} + +type parseReturn = { + type: 'JWS' | 'JWE'; + format: 'compact' | 'json'; + input: Buffer | string | object; + header: object; + perform: (ks: JWK.KeyStore) => Promise | Promise; +}; + +export function parse(input: Buffer | string | object): parseReturn; + +export namespace parse { + function compact(input: Buffer | string | object): parseReturn; + + function json(input: Buffer | string | object): parseReturn; +} + +export namespace util { + function asBuffer(input: string | Buffer, encoding?: string): Buffer; + + function randomBytes(len: number): Buffer; + + namespace base64url { + function decode(base64url: string): string; + + function encode(buffer: string | Buffer, encoding?: string): string; + } + + namespace utf8 { + function decode(input: string): string; + + function encode(input: string): string; + } +} diff --git a/types/node-jose/node-jose-tests.ts b/types/node-jose/node-jose-tests.ts new file mode 100644 index 0000000000..230a4fc474 --- /dev/null +++ b/types/node-jose/node-jose-tests.ts @@ -0,0 +1,300 @@ +import * as jose from 'node-jose'; + +const keystore = jose.JWK.createKeyStore(); +const output = keystore.toJSON(); +keystore.toJSON(true); + +jose.JWK.asKeyStore('input').then(result => {}); + +let key = keystore.get('kid'); + +key = keystore.get('kid', { kty: 'RSA' }); + +// ... and by 'use' +key = keystore.get('kid', { use: 'enc' }); + +// ... and by 'alg' +key = keystore.get('kid', { alg: 'RSA-OAEP' }); + +// ... and by 'kty' and 'use' +key = keystore.get('kid', { kty: 'RSA', use: 'enc' }); + +// same as above, but with a single {props} argument +key = keystore.get({ kid: 'kid', kty: 'RSA', use: 'enc' }); + +let everything = keystore.all(); + +// filter by 'kid' +everything = keystore.all({ kid: 'kid' }); + +// filter by 'kty' +everything = keystore.all({ kty: 'RSA' }); + +// filter by 'use' +everything = keystore.all({ use: 'enc' }); + +// filter by 'alg' +everything = keystore.all({ alg: 'RSA-OAEP' }); + +// filter by 'kid' + 'kty' + 'alg' +everything = keystore.all({ kid: 'kid', kty: 'RSA', alg: 'RSA-OAEP' }); + +keystore.add('input').then(function(result) {}); + +keystore.add('input', 'json').then(function(result) { + // {result} is a jose.JWK.Key +}); + +keystore.generate('oct', 256).then(function(result) { + // {result} is a jose.JWK.Key +}); + +// ... with properties +var props = { + kid: 'gBdaS-G8RLax2qgObTD94w', + alg: 'A256GCM', + use: 'enc' +}; + +let key2: jose.JWK.Key; +keystore.generate('oct', 256, props).then(function(result) { + // {result} is a jose.JWK.Key + key2 = result; + keystore.remove(key2); + + // where input is either a: + // * jose.JWK.Key instance + // * JSON Object representation of a JWK + + jose.JWK.asKey(key2).then(function(result) { + // {result} is a jose.JWK.Key + // {result.keystore} is a unique jose.JWK.KeyStore + }); + + // where input is either a: + // * String serialization of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER + // * Buffer of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER + // form is either a: + // * "json" for a JSON stringified JWK + // * "pkcs8" for a DER encoded (unencrypted!) PKCS8 private key + // * "spki" for a DER encoded SPKI public key + // * "pkix" for a DER encoded PKIX X.509 certificate + // * "x509" for a DER encoded PKIX X.509 certificate + // * "pem" for a PEM encoded of PKCS8 / SPKI / PKIX + jose.JWK.asKey('input', 'json').then(function(result) { + // {result} is a jose.JWK.Key + // {result.keystore} is a unique jose.JWK.KeyStore + }); +}); + +jose.JWK.createKey('oct', 256, { alg: 'A256GCM' }).then(function(result) { + // {result} is a jose.JWK.Key + // {result.keystore} is a unique jose.JWK.KeyStore + let output4 = result.toJSON(true); + result.thumbprint('hash').then(function(print) { + // {print} is a Buffer containing the thumbprint binary value + }); + + let key = result; + jose.JWS.createSign(key) + .update('input') + .final() + .then(function(result) { + // {result} is a JSON object -- JWS using the JSON General Serialization + }); + + jose.JWS.createSign({ format: 'flattened' }, key) + .update('input') + .final() + .then(function(result) { + // {result} is a JSON object -- JWS using the JSON Flattened Serialization + }); + + jose.JWS.createSign({ format: 'compact' }, key) + .update('input') + .final() + .then(function(result) { + // {result} is a String -- JWS using the Compact Serialization + }); + + jose.JWS.createSign({ alg: 'PS256' }, key) + .update('input') + .final() + .then(function(result) { + // .... + }); + + jose.JWS.createSign({ fields: { cty: 'jwk+json' } }, key) + .update('input') + .final() + .then(function(result) { + // .... + }); + + jose.JWS.createSign(key) + .update('input', 'utf8') + .final() + .then(function(result) { + // .... + }); + + let opts = { + algorithms: ['PS*'] + }; + jose.JWS.createVerify(key, opts) + .verify('input') + .then(function(result) { + // ... + }); + + opts = { + algorithms: ['*', '!HS*'] + }; + jose.JWS.createVerify(key, opts) + .verify('input') + .then(function(result) { + // ... + }); + + const opts2 = { + handlers: { + exp: true + } + }; + + jose.JWS.createVerify(key, opts2) + .verify('input') + .then(function(result) { + // ... + }); + + jose.JWE.createEncrypt(key) + .update('input') + .final() + .then(function(result) { + // {result} is a JSON Object -- JWE using the JSON General Serialization + }); + + jose.JWE.createEncrypt({ format: 'compact' }, key) + .update('input') + .final() + .then(function(result) { + // {result} is a String -- JWE using the Compact Serialization + }); + + jose.JWE.createEncrypt({ format: 'flattened' }, key) + .update('input') + .final() + .then(function(result) { + // {result} is a JSON Object -- JWE using the JSON Flattened Serialization + }); + + jose.JWE.createEncrypt({ zip: true }, key) + .update('input') + .final() + .then(function(result) { + // .... + }); + + jose.JWE.createEncrypt({ fields: { cty: 'jwk+json' } }, key) + .update('input') + .final() + .then(function(result) { + // .... + }); + + jose.JWE.createEncrypt([key, key]) + .update('input') + .final() + .then(function(result) { + // .... + }); + + jose.JWE.createDecrypt(key) + .decrypt('input') + .then(function(result) { + // .... + }); + + const opts3 = { + algorithms: ['dir', 'A*GCM'] + }; + jose.JWE.createDecrypt(key, opts3) + .decrypt('input') + .then(function(result) { + // ... + }); + + const opts4 = { + algorithms: ['*', '!RSA*'] + }; + jose.JWS.createVerify(key, opts4) + .verify('input') + .then(function(result) { + // ... + }); + + const opts5 = { + handlers: { + exp: true + } + }; + jose.JWE.createDecrypt(key, opts5) + .decrypt('input') + .then(function(result) { + // ... + }); +}); + +jose.JWS.createVerify(keystore) + .verify('input') + .then(function(result) { + // {result} is a Object with: + // * header: the combined 'protected' and 'unprotected' header members + // * payload: Buffer of the signed content + // * signature: Buffer of the verified signature + // * key: The key used to verify the signature + }); + +// {key} can be: +// * jose.JWK.Key +// * JSON object representing a JWK +jose.JWS.createVerify(key) + .verify('input') + .then(function(result) { + // ... + }); + +jose.JWS.createVerify() + .verify('input', { allowEmbeddedKey: true }) + .then(function(result) { + // ... + }); + +var verifier = jose.JWS.createVerify({ allowEmbeddedKey: true }); + +verifier.verify('input').then(function(result) { + // ... +}); + +jose.JWE.createDecrypt(keystore) + .decrypt('input') + .then(function(result) { + // {result} is a Object with: + // * header: the combined 'protected' and 'unprotected' header members + // * protected: an array of the member names from the "protected" member + // * key: Key used to decrypt + // * payload: Buffer of the decrypted content + // * plaintext: Buffer of the decrypted content (alternate) + }); + +jose.util.asBuffer('input'); + +jose.util.base64url.encode('input'); +jose.util.base64url.encode('input', 'utf8'); + +jose.util.base64url.encode('input'); + +jose.util.base64url.decode('input'); + +jose.util.randomBytes(32); diff --git a/types/node-jose/tsconfig.json b/types/node-jose/tsconfig.json new file mode 100644 index 0000000000..c01c2b1fb7 --- /dev/null +++ b/types/node-jose/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", + "node-jose-tests.ts" + ] +} \ No newline at end of file diff --git a/types/node-jose/tslint.json b/types/node-jose/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/node-jose/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 69b416ed9e28541db193485a145511a7f3ff71b1 Mon Sep 17 00:00:00 2001 From: Nadun Indunil Date: Thu, 14 Feb 2019 02:54:41 +0530 Subject: [PATCH 030/155] fix: lint in index --- types/node-jose/index.d.ts | 126 +++++++++++++++-------------- types/node-jose/node-jose-tests.ts | 4 +- 2 files changed, 67 insertions(+), 63 deletions(-) diff --git a/types/node-jose/index.d.ts b/types/node-jose/index.d.ts index b0b3bd0bc8..a7b295d464 100644 --- a/types/node-jose/index.d.ts +++ b/types/node-jose/index.d.ts @@ -1,14 +1,15 @@ -// Type definitions for node-jose 1.1.1 +// Type definitions for node-jose 1.1 // Project: https://github.com/cisco/node-jose // Definitions by: Nadun Indunil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// export function canYouSee(ks: JWK.Key | JWK.KeyStore, opts: object): JWS.Verifier; export namespace JWA { - type decryptEncryptOptions = { + interface decryptEncryptOptions { aad?: Buffer; adata?: Buffer; iv?: Buffer; @@ -24,34 +25,36 @@ export namespace JWA { apv?: Buffer; // agreement party info used in ec p2s?: Buffer; // used in pbes p2c?: number; // used in pbes - }; + } - type deriveOptions = { + interface deriveOptions { length?: number; // key length otherInfo?: Buffer; // info used in concatkdf public?: Buffer; // public key used in ecdh hash?: Buffer; // hash used in ecdh salt?: Buffer; // salt value used in hkdf info?: Buffer; // app identifier info used in hkdf - }; + } - type encryptReturn = { + interface encryptReturn { data: Buffer; // The cipher text tag?: Buffer; // The tag used in some algorithms - }; + } - type signReturn = { + interface signReturn { data: Buffer; // the data passed into the sign function mac: Buffer; // the signature for `data` - }; + } - type signVerifyOptions = { loose?: boolean }; + interface signVerifyOptions { + loose?: boolean; + } - type verifyReturn = { + interface verifyReturn { data: Buffer; // the data passed into the verify function mac: Buffer; // the signature for `data` valid: boolean; // whether the signature matches the data - }; + } function decrypt( alg: string, @@ -88,8 +91,7 @@ export namespace JWA { } export namespace JWE { - function createEncrypt(key: JWK.Key): JWE.Encryptor; - function createEncrypt(keys: JWK.Key[]): JWE.Encryptor; + function createEncrypt(keys: JWK.Key | JWK.Key[]): Encryptor; function createEncrypt( options: { format?: 'compact' | 'flattened'; @@ -97,20 +99,20 @@ export namespace JWE { fields?: object; }, key: JWK.Key - ): JWE.Encryptor; + ): Encryptor; - function createDecrypt(key: JWK.Key | JWK.KeyStore, opts?: any): JWE.Decryptor; + function createDecrypt(key: JWK.Key | JWK.KeyStore, opts?: any): Decryptor; - export interface Encryptor { + interface Encryptor { update(input: any): this; final(): Promise; } - export interface Decryptor { - decrypt(input: string): Promise; + interface Decryptor { + decrypt(input: string): Promise; } - export interface DecryptResult { + interface DecryptResult { /** * an array of the member names from the "protected" member */ @@ -138,30 +140,30 @@ export namespace JWK { function asKey( key: string | Buffer | object | RawKey, form?: 'json' | 'private' | 'pkcs8' | 'public' | 'spki' | 'pkix' | 'x509' | 'pem' - ): Promise; + ): Promise; /** * To import a JWK-set as a keystore */ - function asKeyStore(ks: object | string): Promise; + function asKeyStore(ks: object | string): Promise; - function createKey(kty: any, size: any, props: any): Promise; + function createKey(kty: any, size: any, props: any): Promise; /** * To create an empty keystore */ - function createKeyStore(): JWK.KeyStore; - - function isKey(input: any): input is JWK.Key; + function createKeyStore(): KeyStore; - function isKeyStore(input: any): input is JWK.KeyStore; + function isKey(input: any): input is Key; - export type KeyUse = 'sig' | 'enc' | 'desc'; + function isKeyStore(input: any): input is KeyStore; - export interface JWEEncryptor { + type KeyUse = 'sig' | 'enc' | 'desc'; + + interface JWEEncryptor { update(input: any): this; final(): Promise; } - export interface RawKey { + interface RawKey { alg: string; kty: string; use: KeyUse; @@ -171,17 +173,17 @@ export namespace JWK { n: string; } - export interface KeyStoreGetFilter { + interface KeyStoreGetFilter { kty?: string; use?: KeyUse; alg?: string; } - export interface KeyStoreGetOptions extends KeyStoreGetFilter { + interface KeyStoreGetOptions extends KeyStoreGetFilter { kid: string; } - export interface KeyStore { + interface KeyStore { /** * To export the public keys of a keystore as a JWK-set */ @@ -192,7 +194,7 @@ export namespace JWK { get(kid: string, filter?: KeyStoreGetFilter): RawKey; get(options: KeyStoreGetOptions): RawKey; all(options?: Partial): RawKey[]; - add(key: RawKey): Promise; + add(key: RawKey): Promise; /** * @param key * String serialization of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER @@ -209,17 +211,17 @@ export namespace JWK { * - "pem" for a PEM encoded of PKCS8 / SPKI / PKIX */ add( - key: string | Buffer | JWK.Key | object, + key: string | Buffer | Key | object, form?: 'json' | 'private' | 'pkcs8' | 'public' | 'spki' | 'pkix' | 'x509' | 'pem' - ): Promise; + ): Promise; - generate(kty: string, size?: string | number, props?: any): Promise; + generate(kty: string, size?: string | number, props?: any): Promise; - remove(key: JWK.Key): void; + remove(key: Key): void; } - export interface Key { - keystore: JWK.KeyStore; + interface Key { + keystore: KeyStore; length: number; kty: string; kid: string; @@ -233,8 +235,7 @@ export namespace JWK { } export namespace JWS { - function createSign(key: JWK.Key): JWS.Signer; - function createSign(keys: JWK.Key[]): JWS.Signer; + function createSign(keys: JWK.Key | JWK.Key[]): Signer; function createSign( options: { format?: 'compact' | 'flattened'; @@ -243,33 +244,26 @@ export namespace JWS { fields?: object; }, key: JWK.Key | JWK.Key[] - ): JWS.Signer; + ): Signer; /** * Using a keystore. */ - function createVerify(keyStore: JWK.KeyStore): JWS.Verifier; - - /** - * To verify using a key embedded in the JWS - */ - function createVerify(): JWS.Verifier; - function createVerify( - input: string | JWK.Key | object, + input?: string | JWK.Key | JWK.KeyStore | object, opts?: { allowEmbeddedKey?: boolean; algorithms?: string[]; handlers?: any } - ): JWS.Verifier; + ): Verifier; - export interface createSignResult { + interface createSignResult { signResult: object; } - export interface Signer { + interface Signer { update(input: Buffer | string, encoding?: string): this; final(): Promise; } - export interface BaseResult { + interface BaseResult { /** * the combined 'protected' and 'unprotected' header members */ @@ -285,35 +279,35 @@ export namespace JWS { protected: string[]; } - export interface VerificationResult extends BaseResult { + interface VerificationResult extends BaseResult { /** * the verified signature */ signature: Buffer | string; } - export interface Verifier { + interface Verifier { verify(input: string, opts?: { allowEmbeddedKey?: boolean }): Promise; } - export interface exp { + interface exp { complete(jws: any): any; } - export interface verifyOptions { + interface verifyOptions { allowEmbeddedKey?: boolean; algorithms?: string[]; handlers: { exp: boolean | exp }; } } -type parseReturn = { +interface parseReturn { type: 'JWS' | 'JWE'; format: 'compact' | 'json'; input: Buffer | string | object; header: object; perform: (ks: JWK.KeyStore) => Promise | Promise; -}; +} export function parse(input: Buffer | string | object): parseReturn; @@ -340,3 +334,13 @@ export namespace util { function encode(input: string): string; } } + +declare const _default: { + JWA: typeof JWA; + JWE: typeof JWE; + JWS: typeof JWS; + JWK: typeof JWK; + parse: typeof parse; + util: typeof util; +}; +export default _default; diff --git a/types/node-jose/node-jose-tests.ts b/types/node-jose/node-jose-tests.ts index 230a4fc474..9c9866f132 100644 --- a/types/node-jose/node-jose-tests.ts +++ b/types/node-jose/node-jose-tests.ts @@ -50,7 +50,7 @@ keystore.generate('oct', 256).then(function(result) { }); // ... with properties -var props = { +let props = { kid: 'gBdaS-G8RLax2qgObTD94w', alg: 'A256GCM', use: 'enc' @@ -271,7 +271,7 @@ jose.JWS.createVerify() // ... }); -var verifier = jose.JWS.createVerify({ allowEmbeddedKey: true }); +let verifier = jose.JWS.createVerify({ allowEmbeddedKey: true }); verifier.verify('input').then(function(result) { // ... From 13b42bcfd8673e3af44c70713cd82ca3ee41b553 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 31 Jan 2019 15:03:11 +0100 Subject: [PATCH 031/155] [react-dom] Allow maybe instance in findDOMNode --- types/react-dom/index.d.ts | 2 +- types/react-dom/react-dom-tests.tsx | 2 ++ types/react-dom/v15/index.d.ts | 2 +- types/react-dom/v15/react-dom-tests.ts | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/react-dom/index.d.ts b/types/react-dom/index.d.ts index f81bbf4021..19c842f5a2 100644 --- a/types/react-dom/index.d.ts +++ b/types/react-dom/index.d.ts @@ -17,7 +17,7 @@ import { DOMAttributes, DOMElement, ReactNode, ReactPortal } from 'react'; -export function findDOMNode(instance: ReactInstance): Element | null | Text; +export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text; export function unmountComponentAtNode(container: Element): boolean; export function createPortal(children: ReactNode, container: Element, key?: null | string): ReactPortal; diff --git a/types/react-dom/react-dom-tests.tsx b/types/react-dom/react-dom-tests.tsx index 46274e3ffd..20bfda53ea 100644 --- a/types/react-dom/react-dom-tests.tsx +++ b/types/react-dom/react-dom-tests.tsx @@ -30,6 +30,8 @@ describe('ReactDOM', () => { const rootElement = document.createElement('div'); ReactDOM.render(React.createElement('div'), rootElement); ReactDOM.findDOMNode(rootElement); + ReactDOM.findDOMNode(null); + ReactDOM.findDOMNode(undefined); }); it('createPortal', () => { diff --git a/types/react-dom/v15/index.d.ts b/types/react-dom/v15/index.d.ts index 8a22fd9bc2..653469b277 100644 --- a/types/react-dom/v15/index.d.ts +++ b/types/react-dom/v15/index.d.ts @@ -15,7 +15,7 @@ import { DOMAttributes, DOMElement } from 'react'; -export function findDOMNode(instance: ReactInstance): E; +export function findDOMNode(instance: ReactInstance | null | undefined): E; export function findDOMNode(instance: ReactInstance): Element; export function render

, T extends Element>( diff --git a/types/react-dom/v15/react-dom-tests.ts b/types/react-dom/v15/react-dom-tests.ts index 865d74e386..5f5b149594 100644 --- a/types/react-dom/v15/react-dom-tests.ts +++ b/types/react-dom/v15/react-dom-tests.ts @@ -25,6 +25,8 @@ describe('ReactDOM', () => { const rootElement = document.createElement('div'); ReactDOM.render(React.createElement('div'), rootElement); ReactDOM.findDOMNode(rootElement); + ReactDOM.findDOMNode(null); + ReactDOM.findDOMNode(undefined); }); }); From 619748b62cd40af5b19ba67fe1bb2f97e6b1fb3c Mon Sep 17 00:00:00 2001 From: Nadun Indunil Date: Thu, 14 Feb 2019 12:03:45 +0530 Subject: [PATCH 032/155] add: new test and lint fix --- types/node-jose/index.d.ts | 2 +- types/node-jose/node-jose-tests.ts | 98 +++++++++++------------------- 2 files changed, 38 insertions(+), 62 deletions(-) diff --git a/types/node-jose/index.d.ts b/types/node-jose/index.d.ts index a7b295d464..b27ecde774 100644 --- a/types/node-jose/index.d.ts +++ b/types/node-jose/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/cisco/node-jose // Definitions by: Nadun Indunil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 3.3 /// diff --git a/types/node-jose/node-jose-tests.ts b/types/node-jose/node-jose-tests.ts index 9c9866f132..dbeaccc9dc 100644 --- a/types/node-jose/node-jose-tests.ts +++ b/types/node-jose/node-jose-tests.ts @@ -39,102 +39,78 @@ everything = keystore.all({ alg: 'RSA-OAEP' }); // filter by 'kid' + 'kty' + 'alg' everything = keystore.all({ kid: 'kid', kty: 'RSA', alg: 'RSA-OAEP' }); -keystore.add('input').then(function(result) {}); +keystore.add('input').then(result => {}); -keystore.add('input', 'json').then(function(result) { +keystore.add('input', 'json').then(result => { // {result} is a jose.JWK.Key }); -keystore.generate('oct', 256).then(function(result) { +keystore.generate('oct', 256).then(result => { // {result} is a jose.JWK.Key }); // ... with properties -let props = { +const props = { kid: 'gBdaS-G8RLax2qgObTD94w', alg: 'A256GCM', use: 'enc' }; let key2: jose.JWK.Key; -keystore.generate('oct', 256, props).then(function(result) { - // {result} is a jose.JWK.Key +keystore.generate('oct', 256, props).then(result => { key2 = result; keystore.remove(key2); - // where input is either a: - // * jose.JWK.Key instance - // * JSON Object representation of a JWK + jose.JWK.asKey(key2).then(result => {}); - jose.JWK.asKey(key2).then(function(result) { - // {result} is a jose.JWK.Key - // {result.keystore} is a unique jose.JWK.KeyStore - }); - - // where input is either a: - // * String serialization of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER - // * Buffer of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER - // form is either a: - // * "json" for a JSON stringified JWK - // * "pkcs8" for a DER encoded (unencrypted!) PKCS8 private key - // * "spki" for a DER encoded SPKI public key - // * "pkix" for a DER encoded PKIX X.509 certificate - // * "x509" for a DER encoded PKIX X.509 certificate - // * "pem" for a PEM encoded of PKCS8 / SPKI / PKIX - jose.JWK.asKey('input', 'json').then(function(result) { - // {result} is a jose.JWK.Key - // {result.keystore} is a unique jose.JWK.KeyStore - }); + jose.JWK.asKey('input', 'json').then(result => {}); }); -jose.JWK.createKey('oct', 256, { alg: 'A256GCM' }).then(function(result) { - // {result} is a jose.JWK.Key - // {result.keystore} is a unique jose.JWK.KeyStore - let output4 = result.toJSON(true); - result.thumbprint('hash').then(function(print) { - // {print} is a Buffer containing the thumbprint binary value - }); +jose.JWK.createKey('oct', 256, { alg: 'A256GCM' }).then(result => { + const output4 = result.toJSON(true); + result.thumbprint('hash').then(print => {}); + + const key = result; - let key = result; jose.JWS.createSign(key) .update('input') .final() - .then(function(result) { + .then(result => { // {result} is a JSON object -- JWS using the JSON General Serialization }); jose.JWS.createSign({ format: 'flattened' }, key) .update('input') .final() - .then(function(result) { + .then(result => { // {result} is a JSON object -- JWS using the JSON Flattened Serialization }); jose.JWS.createSign({ format: 'compact' }, key) .update('input') .final() - .then(function(result) { + .then(result => { // {result} is a String -- JWS using the Compact Serialization }); jose.JWS.createSign({ alg: 'PS256' }, key) .update('input') .final() - .then(function(result) { + .then(result => { // .... }); jose.JWS.createSign({ fields: { cty: 'jwk+json' } }, key) .update('input') .final() - .then(function(result) { + .then(result => { // .... }); jose.JWS.createSign(key) .update('input', 'utf8') .final() - .then(function(result) { + .then(result => { // .... }); @@ -143,7 +119,7 @@ jose.JWK.createKey('oct', 256, { alg: 'A256GCM' }).then(function(result) { }; jose.JWS.createVerify(key, opts) .verify('input') - .then(function(result) { + .then(result => { // ... }); @@ -152,7 +128,7 @@ jose.JWK.createKey('oct', 256, { alg: 'A256GCM' }).then(function(result) { }; jose.JWS.createVerify(key, opts) .verify('input') - .then(function(result) { + .then(result => { // ... }); @@ -164,55 +140,55 @@ jose.JWK.createKey('oct', 256, { alg: 'A256GCM' }).then(function(result) { jose.JWS.createVerify(key, opts2) .verify('input') - .then(function(result) { + .then(result => { // ... }); jose.JWE.createEncrypt(key) .update('input') .final() - .then(function(result) { + .then(result => { // {result} is a JSON Object -- JWE using the JSON General Serialization }); jose.JWE.createEncrypt({ format: 'compact' }, key) .update('input') .final() - .then(function(result) { + .then(result => { // {result} is a String -- JWE using the Compact Serialization }); jose.JWE.createEncrypt({ format: 'flattened' }, key) .update('input') .final() - .then(function(result) { + .then(result => { // {result} is a JSON Object -- JWE using the JSON Flattened Serialization }); jose.JWE.createEncrypt({ zip: true }, key) .update('input') .final() - .then(function(result) { + .then(result => { // .... }); jose.JWE.createEncrypt({ fields: { cty: 'jwk+json' } }, key) .update('input') .final() - .then(function(result) { + .then(result => { // .... }); jose.JWE.createEncrypt([key, key]) .update('input') .final() - .then(function(result) { + .then(result => { // .... }); jose.JWE.createDecrypt(key) .decrypt('input') - .then(function(result) { + .then(result => { // .... }); @@ -221,7 +197,7 @@ jose.JWK.createKey('oct', 256, { alg: 'A256GCM' }).then(function(result) { }; jose.JWE.createDecrypt(key, opts3) .decrypt('input') - .then(function(result) { + .then(result => { // ... }); @@ -230,7 +206,7 @@ jose.JWK.createKey('oct', 256, { alg: 'A256GCM' }).then(function(result) { }; jose.JWS.createVerify(key, opts4) .verify('input') - .then(function(result) { + .then(result => { // ... }); @@ -241,14 +217,14 @@ jose.JWK.createKey('oct', 256, { alg: 'A256GCM' }).then(function(result) { }; jose.JWE.createDecrypt(key, opts5) .decrypt('input') - .then(function(result) { + .then(result => { // ... }); }); jose.JWS.createVerify(keystore) .verify('input') - .then(function(result) { + .then(result => { // {result} is a Object with: // * header: the combined 'protected' and 'unprotected' header members // * payload: Buffer of the signed content @@ -261,25 +237,25 @@ jose.JWS.createVerify(keystore) // * JSON object representing a JWK jose.JWS.createVerify(key) .verify('input') - .then(function(result) { + .then(result => { // ... }); jose.JWS.createVerify() .verify('input', { allowEmbeddedKey: true }) - .then(function(result) { + .then(result => { // ... }); -let verifier = jose.JWS.createVerify({ allowEmbeddedKey: true }); +const verifier = jose.JWS.createVerify({ allowEmbeddedKey: true }); -verifier.verify('input').then(function(result) { +verifier.verify('input').then(result => { // ... }); jose.JWE.createDecrypt(keystore) .decrypt('input') - .then(function(result) { + .then(result => { // {result} is a Object with: // * header: the combined 'protected' and 'unprotected' header members // * protected: an array of the member names from the "protected" member From 1d48f565ea940f2e2700fad66525625e363349bb Mon Sep 17 00:00:00 2001 From: Nadun Indunil Date: Thu, 14 Feb 2019 12:43:59 +0530 Subject: [PATCH 033/155] add: PascalCase --- types/node-jose/index.d.ts | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/types/node-jose/index.d.ts b/types/node-jose/index.d.ts index b27ecde774..92e312352f 100644 --- a/types/node-jose/index.d.ts +++ b/types/node-jose/index.d.ts @@ -9,7 +9,7 @@ export function canYouSee(ks: JWK.Key | JWK.KeyStore, opts: object): JWS.Verifier; export namespace JWA { - interface decryptEncryptOptions { + interface DecryptEncryptOptions { aad?: Buffer; adata?: Buffer; iv?: Buffer; @@ -27,7 +27,7 @@ export namespace JWA { p2c?: number; // used in pbes } - interface deriveOptions { + interface DeriveOptions { length?: number; // key length otherInfo?: Buffer; // info used in concatkdf public?: Buffer; // public key used in ecdh @@ -36,21 +36,21 @@ export namespace JWA { info?: Buffer; // app identifier info used in hkdf } - interface encryptReturn { + interface EncryptReturn { data: Buffer; // The cipher text tag?: Buffer; // The tag used in some algorithms } - interface signReturn { + interface SignReturn { data: Buffer; // the data passed into the sign function mac: Buffer; // the signature for `data` } - interface signVerifyOptions { + interface SignVerifyOptions { loose?: boolean; } - interface verifyReturn { + interface VerifyReturn { data: Buffer; // the data passed into the verify function mac: Buffer; // the signature for `data` valid: boolean; // whether the signature matches the data @@ -60,10 +60,10 @@ export namespace JWA { alg: string, key: string | Buffer, cdata: string | Buffer, - props?: decryptEncryptOptions + props?: DecryptEncryptOptions ): Promise; - function derive(alg: string, key: string | Buffer, props?: deriveOptions): Promise; + function derive(alg: string, key: string | Buffer, props?: DeriveOptions): Promise; function digest(alg: string, data: string | Buffer, props?: any): Promise; @@ -71,23 +71,23 @@ export namespace JWA { alg: string, key: string | Buffer, pdata: string | Buffer, - props?: decryptEncryptOptions - ): Promise; + props?: DecryptEncryptOptions + ): Promise; function sign( alg: string, key: string | Buffer, pdata: string | Buffer, - props: signVerifyOptions - ): Promise; + props: SignVerifyOptions + ): Promise; function verify( alg: string, key: string | Buffer, pdata: string | Buffer, mac: string | Buffer, - props: signVerifyOptions - ): Promise; + props: SignVerifyOptions + ): Promise; } export namespace JWE { @@ -254,13 +254,13 @@ export namespace JWS { opts?: { allowEmbeddedKey?: boolean; algorithms?: string[]; handlers?: any } ): Verifier; - interface createSignResult { + interface CreateSignResult { signResult: object; } interface Signer { update(input: Buffer | string, encoding?: string): this; - final(): Promise; + final(): Promise; } interface BaseResult { @@ -290,18 +290,18 @@ export namespace JWS { verify(input: string, opts?: { allowEmbeddedKey?: boolean }): Promise; } - interface exp { + interface Exp { complete(jws: any): any; } - interface verifyOptions { + interface VerifyOptions { allowEmbeddedKey?: boolean; algorithms?: string[]; - handlers: { exp: boolean | exp }; + handlers: { exp: boolean | Exp }; } } -interface parseReturn { +interface ParseReturn { type: 'JWS' | 'JWE'; format: 'compact' | 'json'; input: Buffer | string | object; @@ -309,12 +309,12 @@ interface parseReturn { perform: (ks: JWK.KeyStore) => Promise | Promise; } -export function parse(input: Buffer | string | object): parseReturn; +export function parse(input: Buffer | string | object): ParseReturn; export namespace parse { - function compact(input: Buffer | string | object): parseReturn; + function compact(input: Buffer | string | object): ParseReturn; - function json(input: Buffer | string | object): parseReturn; + function json(input: Buffer | string | object): ParseReturn; } export namespace util { From 42a4e004243ed77faaf5931e91594175d1ac8733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kr=C3=A1l=C3=ADk?= Date: Thu, 14 Feb 2019 09:38:38 +0100 Subject: [PATCH 034/155] Fix - update debugger.log function --- types/debug/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/debug/index.d.ts b/types/debug/index.d.ts index 79dc77cb92..350b03f499 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: (args: any[]) => any; + log: (...args: any[]) => any; namespace: string; extend: (namespace: string, delimiter?: string) => Debugger; } From f5f34f814e55ebef2e3940144ad7804d71caecf5 Mon Sep 17 00:00:00 2001 From: lukostry Date: Thu, 14 Feb 2019 11:58:29 +0100 Subject: [PATCH 035/155] Add definitions for ink-text-input --- types/ink-text-input/index.d.ts | 17 +++++++ types/ink-text-input/ink-text-input-tests.tsx | 44 +++++++++++++++++++ types/ink-text-input/tsconfig.json | 24 ++++++++++ types/ink-text-input/tslint.json | 1 + 4 files changed, 86 insertions(+) create mode 100644 types/ink-text-input/index.d.ts create mode 100644 types/ink-text-input/ink-text-input-tests.tsx create mode 100644 types/ink-text-input/tsconfig.json create mode 100644 types/ink-text-input/tslint.json diff --git a/types/ink-text-input/index.d.ts b/types/ink-text-input/index.d.ts new file mode 100644 index 0000000000..1d7192e1dc --- /dev/null +++ b/types/ink-text-input/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for ink-text-input 2.0 +// Project: https://github.com/vadimdemedes/ink-text-input#readme +// Definitions by: Łukasz Ostrowski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { Component } from 'ink'; + +export interface TextInputProps { + focus?: boolean; + onChange?: (value: string) => void; + onSubmit?: (value: string) => void; + placeholder?: string; + value?: string; +} + +export default class TextInput extends Component { } diff --git a/types/ink-text-input/ink-text-input-tests.tsx b/types/ink-text-input/ink-text-input-tests.tsx new file mode 100644 index 0000000000..ada8ab3a83 --- /dev/null +++ b/types/ink-text-input/ink-text-input-tests.tsx @@ -0,0 +1,44 @@ +/** @jsx h */ +import { h, Component } from 'ink'; +import TextInput from 'ink-text-input'; + +interface QueryState { + query: string; +} + +class SearchQuery extends Component { + constructor() { + super(); + + this.state = { + query: '' + }; + + this.handleChange = this.handleChange.bind(this); + this.handleSubmit = this.handleSubmit.bind(this); + } + + render(props: {}, state: QueryState) { + return ( +

+ Enter your query: + + +
+ ); + } + + private handleChange(value: string) { + this.setState({ + query: value, + }); + } + + private handleSubmit(value: string) { + console.log(value); + } +} diff --git a/types/ink-text-input/tsconfig.json b/types/ink-text-input/tsconfig.json new file mode 100644 index 0000000000..f58efc92ff --- /dev/null +++ b/types/ink-text-input/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "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-text-input-tests.tsx" + ] +} diff --git a/types/ink-text-input/tslint.json b/types/ink-text-input/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ink-text-input/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 94127b739b4972c695f2191afdc16161b4df9c4f Mon Sep 17 00:00:00 2001 From: Julian Hundeloh Date: Thu, 14 Feb 2019 13:21:14 +0100 Subject: [PATCH 036/155] fix: update Tinycon types - `setBubble`: also accepts strings or null values - `fallback`: `force` is allowed, see: https://github.com/tommoor/tinycon/blob/83ed386e367d0bb6e27b496ec3b6240ce43f6a27/tinycon.js#L115 --- types/tinycon/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/tinycon/index.d.ts b/types/tinycon/index.d.ts index 3f385603cc..745baa28a8 100644 --- a/types/tinycon/index.d.ts +++ b/types/tinycon/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Daniel Waxweiler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export function setBubble(count: number): void; +export function setBubble(count: number|string|null): void; export function setOptions(options: TinyconOptions): void; @@ -11,7 +11,7 @@ export interface TinyconOptions { abbreviate?: boolean; background?: string; color?: string; - fallback?: boolean; + fallback?: boolean | 'force'; font?: string; height?: number; width?: number; From 11a06978a11739162cb70b1f9c27ad3fd49598d0 Mon Sep 17 00:00:00 2001 From: Steven Bell Date: Thu, 14 Feb 2019 09:38:15 -0800 Subject: [PATCH 037/155] Correct the retryResult method signature. The retryResult method as defined at the link below takes two arguments. The type definition only takes one resulting in a compile time error when calling the method. https://github.com/datastax/nodejs-driver/blob/master/lib/policies/retry.js#L109 --- types/cassandra-driver/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cassandra-driver/index.d.ts b/types/cassandra-driver/index.d.ts index 18527ed8c5..6cedde4342 100644 --- a/types/cassandra-driver/index.d.ts +++ b/types/cassandra-driver/index.d.ts @@ -116,7 +116,7 @@ export namespace policies { onUnavailable(requestInfo: RequestInfo, consistency: types.consistencies, required: number, alive: number): DecisionInfo; onWriteTimeout(requestInfo: RequestInfo, consistency: types.consistencies, received: number, blockFor: number, writeType: string): DecisionInfo; rethrowResult(): { decision: retryDecision }; - retryResult(): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean }; + retryResult(consistency: types.consistencies, useCurrentHost: boolean): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean }; } } From 2a131b5f29a66799e5a9876688d3a7d96648d07f Mon Sep 17 00:00:00 2001 From: Nathan L Smith Date: Thu, 14 Feb 2019 15:40:01 -0600 Subject: [PATCH 038/155] [cytoscape] add cy.mount() and cy.unmount() These were added in 3.3.0, so I bumped the version in the header as well. --- types/cytoscape/index.d.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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 From 32a4039140aa835b73b1faccd454cf4a00ebff6a Mon Sep 17 00:00:00 2001 From: Robert Sargant Date: Thu, 14 Feb 2019 22:18:50 +0000 Subject: [PATCH 039/155] Revert "Bump TS version to 3.3" This reverts commit 342f714478546065d1a8a68398efbe8f61bf00e6. --- types/redux-form/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts index e165866b49..6915032138 100644 --- a/types/redux-form/index.d.ts +++ b/types/redux-form/index.d.ts @@ -13,7 +13,7 @@ // Kamil Wojcik // Mohamed Shaaban // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.3 +// TypeScript Version: 3.0 import { ComponentClass, StatelessComponent, From 8b604c22fb6ba72c32805fb57f01b2a55d9679d2 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Thu, 14 Feb 2019 16:08:44 -0800 Subject: [PATCH 040/155] [office-js] [office-js-preview] Tweaks - formatting, typos --- types/office-js-preview/index.d.ts | 21 +++++++++------------ types/office-js/index.d.ts | 21 +++++++++------------ 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 1049535c12..2d47452bd3 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -13736,7 +13736,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -15574,7 +15574,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -16031,8 +16031,8 @@ declare namespace Office { * {@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. + * 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. @@ -17474,7 +17474,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -18796,10 +18796,6 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * In addition to this signature, this method also has the following signature: - * - * `getAllAsync(callback: (result: Office.AsyncResult) => void): void;` - * * @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. @@ -19045,7 +19041,7 @@ declare namespace Office { * * * - * + * *
{@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.
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
* * @param recipients - The recipients to add to the recipients list. @@ -19524,7 +19520,7 @@ declare namespace Office { attachments?: ReplyFormAttachment[]; /** * 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. + * asyncResult, which is an Office.AsyncResult object. */ callback?: (result: Office.AsyncResult) => void; } @@ -20131,7 +20127,8 @@ declare namespace Office { * @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
+ * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read + * */ interface UserProfile { /** diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 3a82c8e70e..de27fd1ea5 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -13736,7 +13736,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -15574,7 +15574,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -16031,8 +16031,8 @@ declare namespace Office { * {@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. + * 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. @@ -17474,7 +17474,7 @@ declare namespace Office { * * Value of entityType * Type of objects in returned array - * Required Permission Leve + * Required Permission Level * * * Address @@ -18796,10 +18796,6 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * In addition to this signature, this method also has the following signature: - * - * `getAllAsync(callback: (result: Office.AsyncResult) => void): void;` - * * @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. @@ -19045,7 +19041,7 @@ declare namespace Office { * * * - * + * *
{@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.
ErrorsNumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
* * @param recipients - The recipients to add to the recipients list. @@ -19524,7 +19520,7 @@ declare namespace Office { attachments?: ReplyFormAttachment[]; /** * 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. + * asyncResult, which is an Office.AsyncResult object. */ callback?: (result: Office.AsyncResult) => void; } @@ -20131,7 +20127,8 @@ declare namespace Office { * @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
+ * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read + * */ interface UserProfile { /** From 1336cf61f0c5eb51e1aefcb78ab59cc672552492 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 8 Feb 2019 02:47:45 +0100 Subject: [PATCH 041/155] Distinguish Backbone.View EventsHash from Backbone.Events EventMap The Backbone.Events.on eventMap parameter doesn't accept the same type of callback functions as the Backbone.View.events hash. This change rectifies this. Affects backbone, backbone-relational, backbone.marionette, backbone.radio. --- types/backbone-relational/index.d.ts | 4 ++-- types/backbone.marionette/index.d.ts | 3 ++- types/backbone.radio/index.d.ts | 3 ++- types/backbone/backbone-tests.ts | 2 +- types/backbone/index.d.ts | 20 +++++++++++++++++--- 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/types/backbone-relational/index.d.ts b/types/backbone-relational/index.d.ts index f19cfa8daa..a90668828c 100644 --- a/types/backbone-relational/index.d.ts +++ b/types/backbone-relational/index.d.ts @@ -7,7 +7,7 @@ /// -import { Events, EventsHash, Model as BModel, Collection } from 'backbone'; +import { Events, EventMap, Model as BModel, Collection } from 'backbone'; declare module 'backbone-relational' { class Model extends BModel { @@ -125,7 +125,7 @@ declare module 'backbone-relational' { export class Store implements Events { on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; + on(eventMap: EventMap): any; on(eventName: any, callback?: any, context?: any): any; off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 1025940214..e9f54e5569 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -6,6 +6,7 @@ // Volker Nauruhn , // Ard Timmerman , // J. Joe Koullas +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -411,7 +412,7 @@ export class Object implements CommonMixin, RadioMixin, Backbone.Events { constructor(options?: ObjectOptions); on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; + on(eventMap: Backbone.EventMap): any; on(eventName: any, callback?: any, context?: any): any; off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; diff --git a/types/backbone.radio/index.d.ts b/types/backbone.radio/index.d.ts index ac953aa00b..b3d333f586 100644 --- a/types/backbone.radio/index.d.ts +++ b/types/backbone.radio/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Backbone.Radio v0.8.3 // Project: https://github.com/marionettejs/backbone.radio // Definitions by: Peter Palotas +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -73,7 +74,7 @@ declare module "backbone" { class Channel implements Commands, Requests, Backbone.Events { on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; + on(eventMap: EventMap): any; on(eventName: any, callback?: any, context?: any): any; off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; diff --git a/types/backbone/backbone-tests.ts b/types/backbone/backbone-tests.ts index 563c21634c..bdcd94da52 100644 --- a/types/backbone/backbone-tests.ts +++ b/types/backbone/backbone-tests.ts @@ -398,7 +398,7 @@ namespace v1Changes { namespace Collection { function test_fetch() { var collection = new EmployeeCollection; - collection.fetch({ + collection.fetch({ reset: true, remove: false }); diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index a881284c8f..187a2c29a8 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -4,6 +4,7 @@ // Natan Vivo // kenjiru // jjoekoullas +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -91,14 +92,27 @@ declare namespace Backbone { [routePattern: string]: string | {(...urlParts: string[]): void}; } + /** + * DOM events (used in the events property of a View) + */ interface EventsHash { [selector: string]: string | {(eventObject: JQuery.TriggeredEvent): void}; } + /** + * JavaScript events (used in the methods of the Events interface) + */ + interface EventHandler { + (...args: any[]): void; + } + interface EventMap { + [event: string]: EventHandler; + } + export const Events: Events; interface Events { on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; + on(eventMap: EventMap): any; off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; @@ -112,7 +126,7 @@ declare namespace Backbone { class ModelBase implements Events { on(eventName: string, callback?: Function, context?: any): any; - on(eventMap: EventsHash): any; + on(eventMap: EventMap): any; on(eventName: any, callback?: any, context?: any): any off(eventName?: string, callback?: Function, context?: any): any trigger(eventName: string, ...args: any[]): any @@ -492,7 +506,7 @@ declare namespace Backbone { */ declare abstract class EventSignatures implements Backbone.Events { on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: Backbone.EventsHash): any; + on(eventMap: Backbone.EventMap): any; off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; From b5528b7e885f1eb1ae88ee8970f2598b12470ead Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 8 Feb 2019 02:51:59 +0100 Subject: [PATCH 042/155] Add context parameter to the Backbone.Events.on eventMap variant Affects backbone, backbone-relational, backbone.marionette, backbone.radio. --- types/backbone-relational/index.d.ts | 2 +- types/backbone.marionette/index.d.ts | 2 +- types/backbone.radio/index.d.ts | 2 +- types/backbone/index.d.ts | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/backbone-relational/index.d.ts b/types/backbone-relational/index.d.ts index a90668828c..a1a56088d4 100644 --- a/types/backbone-relational/index.d.ts +++ b/types/backbone-relational/index.d.ts @@ -125,7 +125,7 @@ declare module 'backbone-relational' { export class Store implements Events { on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventMap): any; + on(eventMap: EventMap, context?: any): any; on(eventName: any, callback?: any, context?: any): any; off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index e9f54e5569..8b7db7543f 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -412,7 +412,7 @@ export class Object implements CommonMixin, RadioMixin, Backbone.Events { constructor(options?: ObjectOptions); on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: Backbone.EventMap): any; + on(eventMap: Backbone.EventMap, context?: any): any; on(eventName: any, callback?: any, context?: any): any; off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; diff --git a/types/backbone.radio/index.d.ts b/types/backbone.radio/index.d.ts index b3d333f586..d39956cf72 100644 --- a/types/backbone.radio/index.d.ts +++ b/types/backbone.radio/index.d.ts @@ -74,7 +74,7 @@ declare module "backbone" { class Channel implements Commands, Requests, Backbone.Events { on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventMap): any; + on(eventMap: EventMap, context?: any): any; on(eventName: any, callback?: any, context?: any): any; off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index 187a2c29a8..b25c08b62c 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -112,7 +112,7 @@ declare namespace Backbone { export const Events: Events; interface Events { on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventMap): any; + on(eventMap: EventMap, context?: any): any; off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; @@ -126,7 +126,7 @@ declare namespace Backbone { class ModelBase implements Events { on(eventName: string, callback?: Function, context?: any): any; - on(eventMap: EventMap): any; + on(eventMap: EventMap, context?: any): any; on(eventName: any, callback?: any, context?: any): any off(eventName?: string, callback?: Function, context?: any): any trigger(eventName: string, ...args: any[]): any @@ -506,7 +506,7 @@ declare namespace Backbone { */ declare abstract class EventSignatures implements Backbone.Events { on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: Backbone.EventMap): any; + on(eventMap: Backbone.EventMap, context?: any): any; off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; From 754bd43c20a592fc69f434cb7d6eac4fe16378bf Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 8 Feb 2019 02:59:33 +0100 Subject: [PATCH 043/155] Add eventMap variants of Backbone.Events.{once,listenTo,listenToOnce} Fixes #22156. Affects backbone, backbone-relational, backbone.marionette, backbone.radio. --- types/backbone-relational/index.d.ts | 3 +++ types/backbone.marionette/index.d.ts | 4 ++++ types/backbone.radio/index.d.ts | 4 ++++ types/backbone/backbone-tests.ts | 4 ++++ types/backbone/index.d.ts | 9 +++++++++ 5 files changed, 24 insertions(+) diff --git a/types/backbone-relational/index.d.ts b/types/backbone-relational/index.d.ts index a1a56088d4..f237f27ea1 100644 --- a/types/backbone-relational/index.d.ts +++ b/types/backbone-relational/index.d.ts @@ -132,8 +132,11 @@ declare module 'backbone-relational' { bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; once(events: string, callback: (...args: any[]) => void, context?: any): any; + once(eventMap: EventMap, context?: any): any; listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenTo(object: any, eventMap: EventMap): any; listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, eventMap: EventMap): any; stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; initializeRelation(model, relation, options); diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 8b7db7543f..42ab3ecc35 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -418,9 +418,13 @@ export class Object implements CommonMixin, RadioMixin, Backbone.Events { trigger(eventName: string, ...args: any[]): any; bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + once(events: string, callback: (...args: any[]) => void, context?: any): any; + once(eventMap: Backbone.EventMap, context?: any): any; listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenTo(object: any, eventMap: Backbone.EventMap): any; listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, eventMap: Backbone.EventMap): any; stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; /** diff --git a/types/backbone.radio/index.d.ts b/types/backbone.radio/index.d.ts index d39956cf72..a0901b6b49 100644 --- a/types/backbone.radio/index.d.ts +++ b/types/backbone.radio/index.d.ts @@ -80,9 +80,13 @@ declare module "backbone" { trigger(eventName: string, ...args: any[]): any; bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + once(events: string, callback: (...args: any[]) => void, context?: any): any; + once(eventMap: EventMap, context?: any): any; listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenTo(object: any, eventMap: EventMap): any; listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, eventMap: EventMap): any; stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; channelName: string; reset(): Channel; diff --git a/types/backbone/backbone-tests.ts b/types/backbone/backbone-tests.ts index bdcd94da52..96d447c1b3 100644 --- a/types/backbone/backbone-tests.ts +++ b/types/backbone/backbone-tests.ts @@ -272,18 +272,22 @@ namespace v1Changes { var model = new Employee; model.once('invalid', () => { }, this); model.once('invalid', () => { }); + model.once({invalid: () => { }, success: () => { }}, this); + model.once({invalid: () => { }, success: () => { }}); } function test_listenTo() { var model = new Employee; var view = new Backbone.View(); view.listenTo(model, 'invalid', () => { }); + view.listenTo(model, {invalid: () => { }, success: () => { }}); } function test_listenToOnce() { var model = new Employee; var view = new Backbone.View(); view.listenToOnce(model, 'invalid', () => { }); + view.listenToOnce(model, {invalid: () => { }, success: () => { }}); } function test_stopListening() { diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index b25c08b62c..ee469bf9eb 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -119,8 +119,11 @@ declare namespace Backbone { unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; once(events: string, callback: (...args: any[]) => void, context?: any): any; + once(eventMap: EventMap, context?: any): any; listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenTo(object: any, eventMap: EventMap): any; listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, eventMap: EventMap): any; stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; } @@ -133,8 +136,11 @@ declare namespace Backbone { bind(eventName: string, callback: Function, context?: any): any unbind(eventName?: string, callback?: Function, context?: any): any once(events: string, callback: Function, context?: any): any + once(eventMap: EventMap, context?: any): any; listenTo(object: any, events: string, callback: Function):any + listenTo(object: any, eventMap: EventMap): any; listenToOnce(object: any, events: string, callback: Function): any + listenToOnce(object: any, eventMap: EventMap): any; stopListening(object?: any, events?: string, callback?: Function): any parse(response: any, options?: any): any; @@ -513,7 +519,10 @@ declare abstract class EventSignatures implements Backbone.Events { unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; once(events: string, callback: (...args: any[]) => void, context?: any): any; + once(eventMap: Backbone.EventMap, context?: any): any; listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenTo(object: any, eventMap: Backbone.EventMap): any; listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, eventMap: Backbone.EventMap): any; stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; } \ No newline at end of file From 97f4c98b766ff51c607c154a5eb5d3e68bc374b4 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 8 Feb 2019 15:46:13 +0100 Subject: [PATCH 044/155] Update giraffe as well --- types/giraffe/index.d.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/types/giraffe/index.d.ts b/types/giraffe/index.d.ts index abce777c20..5911301460 100644 --- a/types/giraffe/index.d.ts +++ b/types/giraffe/index.d.ts @@ -147,15 +147,19 @@ declare namespace Giraffe { class Controller implements GiraffeObject, Backbone.Events { on(eventName: string, callback?: (...args: any[]) => void, context?: any); - on(eventMap: Backbone.EventsHash); + on(eventMap: Backbone.EventMap, context?: any): any; on(eventName: any, callback?: any, context?: any) - off(eventName?: string, callback?: (...args: any[]) => void, context?: any) - trigger(eventName: string, ...args: any[]) - bind(eventName: string, callback: (...args: any[]) => void, context?: any) - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any) + off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + trigger(eventName: string, ...args: any[]): any; + bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; + unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + once(events: string, callback: (...args: any[]) => void, context?: any): any; + once(eventMap: Backbone.EventMap, context?: any): any; listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenTo(object: any, eventMap: Backbone.EventMap): any; listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, eventMap: Backbone.EventMap): any; stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; app: App; From 21a9d44fca9c9ef47ddd765ac7ecc84b798035d5 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 8 Feb 2019 17:12:21 +0100 Subject: [PATCH 045/155] Use Backbone.EventsMixin to reduce repetition Affects backbone, backbone-relational, backbone.radio, backbone.marionette, giraffe. Respects #1066. --- types/backbone-relational/index.d.ts | 19 +-------- types/backbone.marionette/index.d.ts | 20 +++------ types/backbone.radio/index.d.ts | 20 +++------ types/backbone/index.d.ts | 61 ++++++++-------------------- types/giraffe/index.d.ts | 20 +++------ 5 files changed, 35 insertions(+), 105 deletions(-) diff --git a/types/backbone-relational/index.d.ts b/types/backbone-relational/index.d.ts index f237f27ea1..5d66ebfef9 100644 --- a/types/backbone-relational/index.d.ts +++ b/types/backbone-relational/index.d.ts @@ -7,7 +7,7 @@ /// -import { Events, EventMap, Model as BModel, Collection } from 'backbone'; +import { EventsMixin, Events, Model as BModel, Collection } from 'backbone'; declare module 'backbone-relational' { class Model extends BModel { @@ -123,22 +123,7 @@ declare module 'backbone-relational' { } - export class Store implements Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventMap, context?: any): any; - on(eventName: any, callback?: any, context?: any): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - once(events: string, callback: (...args: any[]) => void, context?: any): any; - once(eventMap: EventMap, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenTo(object: any, eventMap: EventMap): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, eventMap: EventMap): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; - + export class Store extends EventsMixin implements Events { initializeRelation(model, relation, options); addModelScope(scope:any):void; diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 42ab3ecc35..f24d80ff4d 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -408,24 +408,14 @@ export interface ObjectOptions extends RadioMixinOptions { * A base class which other classes can extend from. Object incorporates many * backbone conventions and utilities like initialize and Backbone.Events. */ -export class Object implements CommonMixin, RadioMixin, Backbone.Events { +export class Object extends Backbone.EventsMixin implements CommonMixin, RadioMixin, Backbone.Events { constructor(options?: ObjectOptions); - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: Backbone.EventMap, context?: any): any; + /** + * Faulty overgeneralization of Backbone.Events.on, for historical + * reasons. + */ on(eventName: any, callback?: any, context?: any): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - - once(events: string, callback: (...args: any[]) => void, context?: any): any; - once(eventMap: Backbone.EventMap, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenTo(object: any, eventMap: Backbone.EventMap): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, eventMap: Backbone.EventMap): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; /** * Receives a hash of event names and functions and/or function names, diff --git a/types/backbone.radio/index.d.ts b/types/backbone.radio/index.d.ts index a0901b6b49..e6682bd52e 100644 --- a/types/backbone.radio/index.d.ts +++ b/types/backbone.radio/index.d.ts @@ -72,22 +72,12 @@ declare module "backbone" { stopReplying(commandName?: string, callback?: (...args: any[]) => any, context?: any): Requests; } - class Channel implements Commands, Requests, Backbone.Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventMap, context?: any): any; + class Channel extends Backbone.EventsMixin implements Commands, Requests, Backbone.Events { + /** + * Faulty overgeneralization of Backbone.Events.on, for historical + * reasons. + */ on(eventName: any, callback?: any, context?: any): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - - once(events: string, callback: (...args: any[]) => void, context?: any): any; - once(eventMap: EventMap, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenTo(object: any, eventMap: EventMap): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, eventMap: EventMap): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; channelName: string; reset(): Channel; diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index ee469bf9eb..1171dac918 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -109,8 +109,16 @@ declare namespace Backbone { [event: string]: EventHandler; } - export const Events: Events; - interface Events { + /** + * Helper to avoid code repetition. Backbone.Events cannot be extended, + * hence a separate abstract class with a different name. + * Both classes and interfaces can extend from this helper class to + * reuse the signatures, but only in type declarations. + * Classes that already extend another base class can still + * `implements Events`, but in this case, unfortunately you have to + * repeat all signatures below. + */ + abstract class EventsMixin implements Events { on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; on(eventMap: EventMap, context?: any): any; off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; @@ -127,28 +135,16 @@ declare namespace Backbone { stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; } - class ModelBase implements Events { - on(eventName: string, callback?: Function, context?: any): any; - on(eventMap: EventMap, context?: any): any; - on(eventName: any, callback?: any, context?: any): any - off(eventName?: string, callback?: Function, context?: any): any - trigger(eventName: string, ...args: any[]): any - bind(eventName: string, callback: Function, context?: any): any - unbind(eventName?: string, callback?: Function, context?: any): any - once(events: string, callback: Function, context?: any): any - once(eventMap: EventMap, context?: any): any; - listenTo(object: any, events: string, callback: Function):any - listenTo(object: any, eventMap: EventMap): any; - listenToOnce(object: any, events: string, callback: Function): any - listenToOnce(object: any, eventMap: EventMap): any; - stopListening(object?: any, events?: string, callback?: Function): any + export const Events: Events; + interface Events extends EventsMixin { } + class ModelBase extends EventsMixin { parse(response: any, options?: any): any; toJSON(options?: any): any; sync(...arg: any[]): JQueryXHR; } - class Model extends ModelBase { + class Model extends ModelBase implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -249,7 +245,7 @@ declare namespace Backbone { matches(attrs: any): boolean; } - class Collection extends ModelBase { + class Collection extends ModelBase implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -387,7 +383,7 @@ declare namespace Backbone { without(...values: TModel[]): TModel[]; } - class Router extends EventSignatures { + class Router extends EventsMixin implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -416,7 +412,7 @@ declare namespace Backbone { var history: History; - class History extends EventSignatures { + class History extends EventsMixin implements Events { handlers: any[]; interval: number; @@ -453,7 +449,7 @@ declare namespace Backbone { attributes?: {[id: string]: any}; } - class View extends EventSignatures { + class View extends EventsMixin implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -505,24 +501,3 @@ declare namespace Backbone { function noConflict(): typeof Backbone; var $: JQueryStatic; } - -/** - * This is not for external use and is only here as a convenient way to - * specify signatures for internal implementers of Backbone.Events - */ -declare abstract class EventSignatures implements Backbone.Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: Backbone.EventMap, context?: any): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - - once(events: string, callback: (...args: any[]) => void, context?: any): any; - once(eventMap: Backbone.EventMap, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenTo(object: any, eventMap: Backbone.EventMap): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, eventMap: Backbone.EventMap): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; -} \ No newline at end of file diff --git a/types/giraffe/index.d.ts b/types/giraffe/index.d.ts index 5911301460..1758823c7d 100644 --- a/types/giraffe/index.d.ts +++ b/types/giraffe/index.d.ts @@ -145,22 +145,12 @@ declare namespace Giraffe { namespace Contrib { - class Controller implements GiraffeObject, Backbone.Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any); - on(eventMap: Backbone.EventMap, context?: any): any; + class Controller extends Backbone.EventsMixin implements GiraffeObject, Backbone.Events { + /** + * Faulty overgeneralization of Backbone.Events.on, for historical + * reasons. + */ on(eventName: any, callback?: any, context?: any) - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - - once(events: string, callback: (...args: any[]) => void, context?: any): any; - once(eventMap: Backbone.EventMap, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenTo(object: any, eventMap: Backbone.EventMap): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, eventMap: Backbone.EventMap): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; app: App; } From 54c9125b2f5c9640a676bb696a197e8d799edc25 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 8 Feb 2019 19:25:39 +0100 Subject: [PATCH 046/155] Make Backbone.Events even DRYer --- types/backbone/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index 1171dac918..a32e9ee626 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -119,20 +119,20 @@ declare namespace Backbone { * repeat all signatures below. */ abstract class EventsMixin implements Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; + on(eventName: string, callback?: EventHandler, context?: any): any; on(eventMap: EventMap, context?: any): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + off(eventName?: string, callback?: EventHandler, context?: any): any; trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + bind(eventName: string, callback: EventHandler, context?: any): any; + unbind(eventName?: string, callback?: EventHandler, context?: any): any; - once(events: string, callback: (...args: any[]) => void, context?: any): any; + once(events: string, callback: EventHandler, context?: any): any; once(eventMap: EventMap, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenTo(object: any, events: string, callback: EventHandler): any; listenTo(object: any, eventMap: EventMap): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, events: string, callback: EventHandler): any; listenToOnce(object: any, eventMap: EventMap): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; + stopListening(object?: any, events?: string, callback?: EventHandler): any; } export const Events: Events; From d62916a608393cb1bd7ddf2b76d748cb40137ac2 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 8 Feb 2019 19:41:47 +0100 Subject: [PATCH 047/155] Return polymorphic this from all Backbone.Events methods Since this is what these methods actually do. --- types/backbone/index.d.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index a32e9ee626..000e8f6dcc 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -119,20 +119,20 @@ declare namespace Backbone { * repeat all signatures below. */ abstract class EventsMixin implements Events { - on(eventName: string, callback?: EventHandler, context?: any): any; - on(eventMap: EventMap, context?: any): any; - off(eventName?: string, callback?: EventHandler, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: EventHandler, context?: any): any; - unbind(eventName?: string, callback?: EventHandler, context?: any): any; + on(eventName: string, callback?: EventHandler, context?: any): this; + on(eventMap: EventMap, context?: any): this; + off(eventName?: string, callback?: EventHandler, context?: any): this; + trigger(eventName: string, ...args: any[]): this; + bind(eventName: string, callback: EventHandler, context?: any): this; + unbind(eventName?: string, callback?: EventHandler, context?: any): this; - once(events: string, callback: EventHandler, context?: any): any; - once(eventMap: EventMap, context?: any): any; - listenTo(object: any, events: string, callback: EventHandler): any; - listenTo(object: any, eventMap: EventMap): any; - listenToOnce(object: any, events: string, callback: EventHandler): any; - listenToOnce(object: any, eventMap: EventMap): any; - stopListening(object?: any, events?: string, callback?: EventHandler): any; + once(events: string, callback: EventHandler, context?: any): this; + once(eventMap: EventMap, context?: any): this; + listenTo(object: any, events: string, callback: EventHandler): this; + listenTo(object: any, eventMap: EventMap): this; + listenToOnce(object: any, events: string, callback: EventHandler): this; + listenToOnce(object: any, eventMap: EventMap): this; + stopListening(object?: any, events?: string, callback?: EventHandler): this; } export const Events: Events; From a483095c3b1f446a23702efca2894fd6aaf2c001 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 8 Feb 2019 20:31:37 +0100 Subject: [PATCH 048/155] Add my name to giraffe --- types/giraffe/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/giraffe/index.d.ts b/types/giraffe/index.d.ts index 1758823c7d..2f0223321c 100644 --- a/types/giraffe/index.d.ts +++ b/types/giraffe/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Giraffe // Project: https://github.com/barc/backbone.giraffe // Definitions by: Matt McCray +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 99c51c2457d225903ad59a8b18c5d8718c4d02b8 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 15 Feb 2019 02:06:54 +0100 Subject: [PATCH 049/155] Callback argument to Backbone.Events.on is not optional --- types/backbone/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index 000e8f6dcc..7b20e76a7f 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -119,7 +119,7 @@ declare namespace Backbone { * repeat all signatures below. */ abstract class EventsMixin implements Events { - on(eventName: string, callback?: EventHandler, context?: any): this; + on(eventName: string, callback: EventHandler, context?: any): this; on(eventMap: EventMap, context?: any): this; off(eventName?: string, callback?: EventHandler, context?: any): this; trigger(eventName: string, ...args: any[]): this; From 6202c307db1339e449990b2abfe70be21600aff1 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 15 Feb 2019 02:07:28 +0100 Subject: [PATCH 050/155] Add the missing EventMap overload of Backbone.Events.bind --- types/backbone/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index 7b20e76a7f..dcf4d44c84 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -124,6 +124,7 @@ declare namespace Backbone { off(eventName?: string, callback?: EventHandler, context?: any): this; trigger(eventName: string, ...args: any[]): this; bind(eventName: string, callback: EventHandler, context?: any): this; + bind(eventMap: EventMap, context?: any): this; unbind(eventName?: string, callback?: EventHandler, context?: any): this; once(events: string, callback: EventHandler, context?: any): this; From 342615bd7faaa27c3817bd46321cc457eff33bac Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 15 Feb 2019 02:10:19 +0100 Subject: [PATCH 051/155] Add shorthand interfaces for the Backbone.Events methods --- types/backbone/backbone-tests.ts | 44 +++++++++++++++++++++ types/backbone/index.d.ts | 67 ++++++++++++++++++++++++++++---- 2 files changed, 104 insertions(+), 7 deletions(-) diff --git a/types/backbone/backbone-tests.ts b/types/backbone/backbone-tests.ts index 96d447c1b3..c36b92ff3f 100644 --- a/types/backbone/backbone-tests.ts +++ b/types/backbone/backbone-tests.ts @@ -15,6 +15,50 @@ function test_events() { object.off(); } +class PubSub implements Backbone.Events { + on: Backbone.Events_On; + off: Backbone.Events_Off; + trigger: Backbone.Events_Trigger; + bind: Backbone.Events_On; + unbind: Backbone.Events_Off; + + once: Backbone.Events_On; + listenTo: Backbone.Events_Listen; + listenToOnce: Backbone.Events_Listen; + stopListening: Backbone.Events_Stop; +} + +Object.assign(PubSub.prototype, Backbone.Events); + +function test_events_shorthands() { + let channel1 = new PubSub(); + let channel2 = new PubSub(); + let onChange = () => alert('whatever'); + + channel1.on("alert", (eventName: string) => alert("Triggered " + eventName)); + channel1.trigger("alert", "an event"); + + channel1.once('invalid', () => { }, this); + channel1.once('invalid', () => { }); + channel1.once({invalid: () => { }, success: () => { }}, this); + channel1.once({invalid: () => { }, success: () => { }}); + + channel1.off("change", onChange); + channel1.off("change"); + channel1.off(null, onChange); + channel1.off(null, null, this); + channel1.off(); + + channel2.listenTo(channel1, 'invalid', () => { }); + channel2.listenTo(channel1, {invalid: () => { }, success: () => { }}); + channel2.listenToOnce(channel1, 'invalid', () => { }); + channel2.listenToOnce(channel1, {invalid: () => { }, success: () => { }}); + + channel2.stopListening(channel1, 'invalid', () => { }); + channel2.stopListening(channel1, 'invalid'); + channel2.stopListening(channel1); +} + class SettingDefaults extends Backbone.Model { // 'defaults' could be set in one of the following ways: diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index dcf4d44c84..1fa83dbead 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -110,13 +110,14 @@ declare namespace Backbone { } /** - * Helper to avoid code repetition. Backbone.Events cannot be extended, - * hence a separate abstract class with a different name. - * Both classes and interfaces can extend from this helper class to - * reuse the signatures, but only in type declarations. - * Classes that already extend another base class can still - * `implements Events`, but in this case, unfortunately you have to - * repeat all signatures below. + * Helper to avoid code repetition in type declarations. + * Backbone.Events cannot be extended, hence a separate abstract + * class with a different name. Both classes and interfaces can + * extend from this helper class to reuse the signatures. + * + * For class type declarations that already extend another base + * class, and for actual class definitions, please see the + * EventsMethod* interfaces below. */ abstract class EventsMixin implements Events { on(eventName: string, callback: EventHandler, context?: any): this; @@ -139,6 +140,58 @@ declare namespace Backbone { export const Events: Events; interface Events extends EventsMixin { } + /** + * Helper shorthands for classes that implement the Events interface. + * Define your class like this: + * + * import { + * Events, + * Events_On, + * Events_Off, + * Events_Trigger, + * Events_Listen, + * Events_Stop, + * } from 'backbone'; + * + * class YourClass implements Events { + * on: Events_On; + * off: Events_Off; + * trigger: Events_Trigger; + * bind: Events_On; + * unbind: Events_Off; + * + * once: Events_On; + * listenTo: Events_Listen; + * listenToOnce: Events_Listen; + * stopListening: Events_Stop; + * + * // ... (other methods) + * } + * + * Object.assign(YourClass.prototype, Events); // can also use _.extend + * + * If you are just writing a class type declaration that doesn't already + * extend some other base class, you can use the EventsMixin instead; + * see above. + */ + interface Events_On { + (this: T, eventName: string, callback: EventHandler, context?: any): T; + (this: T, eventMap: EventMap, context?: any): T; + } + interface Events_Off { + (this: T, eventName?: string, callback?: EventHandler, context?: any): T; + } + interface Events_Trigger { + (this: T, eventName: string, ...args: any[]): T; + } + interface Events_Listen { + (this: T, object: any, events: string, callback: EventHandler): T; + (this: T, object: any, eventMap: EventMap): T; + } + interface Events_Stop { + (this: T, object?: any, events?: string, callback?: EventHandler): T; + } + class ModelBase extends EventsMixin { parse(response: any, options?: any): any; toJSON(options?: any): any; From b26dfca0d248f0e0b557fde8ce96e8085b55b51f Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 15 Feb 2019 02:19:11 +0100 Subject: [PATCH 052/155] Move Backbone.EventsMixin after the Backbone.Events_* method shorthands Because the latter can always be used, and the former only corner cases. --- types/backbone/index.d.ts | 58 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index 1fa83dbead..c54bf6309b 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -109,34 +109,6 @@ declare namespace Backbone { [event: string]: EventHandler; } - /** - * Helper to avoid code repetition in type declarations. - * Backbone.Events cannot be extended, hence a separate abstract - * class with a different name. Both classes and interfaces can - * extend from this helper class to reuse the signatures. - * - * For class type declarations that already extend another base - * class, and for actual class definitions, please see the - * EventsMethod* interfaces below. - */ - abstract class EventsMixin implements Events { - on(eventName: string, callback: EventHandler, context?: any): this; - on(eventMap: EventMap, context?: any): this; - off(eventName?: string, callback?: EventHandler, context?: any): this; - trigger(eventName: string, ...args: any[]): this; - bind(eventName: string, callback: EventHandler, context?: any): this; - bind(eventMap: EventMap, context?: any): this; - unbind(eventName?: string, callback?: EventHandler, context?: any): this; - - once(events: string, callback: EventHandler, context?: any): this; - once(eventMap: EventMap, context?: any): this; - listenTo(object: any, events: string, callback: EventHandler): this; - listenTo(object: any, eventMap: EventMap): this; - listenToOnce(object: any, events: string, callback: EventHandler): this; - listenToOnce(object: any, eventMap: EventMap): this; - stopListening(object?: any, events?: string, callback?: EventHandler): this; - } - export const Events: Events; interface Events extends EventsMixin { } @@ -172,7 +144,7 @@ declare namespace Backbone { * * If you are just writing a class type declaration that doesn't already * extend some other base class, you can use the EventsMixin instead; - * see above. + * see below. */ interface Events_On { (this: T, eventName: string, callback: EventHandler, context?: any): T; @@ -192,6 +164,34 @@ declare namespace Backbone { (this: T, object?: any, events?: string, callback?: EventHandler): T; } + /** + * Helper to avoid code repetition in type declarations. + * Backbone.Events cannot be extended, hence a separate abstract + * class with a different name. Both classes and interfaces can + * extend from this helper class to reuse the signatures. + * + * For class type declarations that already extend another base + * class, and for actual class definitions, please see the + * Events_* interfaces above. + */ + abstract class EventsMixin implements Events { + on(eventName: string, callback: EventHandler, context?: any): this; + on(eventMap: EventMap, context?: any): this; + off(eventName?: string, callback?: EventHandler, context?: any): this; + trigger(eventName: string, ...args: any[]): this; + bind(eventName: string, callback: EventHandler, context?: any): this; + bind(eventMap: EventMap, context?: any): this; + unbind(eventName?: string, callback?: EventHandler, context?: any): this; + + once(events: string, callback: EventHandler, context?: any): this; + once(eventMap: EventMap, context?: any): this; + listenTo(object: any, events: string, callback: EventHandler): this; + listenTo(object: any, eventMap: EventMap): this; + listenToOnce(object: any, events: string, callback: EventHandler): this; + listenToOnce(object: any, eventMap: EventMap): this; + stopListening(object?: any, events?: string, callback?: EventHandler): this; + } + class ModelBase extends EventsMixin { parse(response: any, options?: any): any; toJSON(options?: any): any; From 00b5d6b4bf33604d22ba1ff089ef8d681f9eac52 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 15 Feb 2019 02:36:50 +0100 Subject: [PATCH 053/155] Re-enable two linter rules in backbone-relational no-declare-current-package no-single-declare-module --- types/backbone-relational/tslint.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/backbone-relational/tslint.json b/types/backbone-relational/tslint.json index a41bf5d19a..4f5d8a2416 100644 --- a/types/backbone-relational/tslint.json +++ b/types/backbone-relational/tslint.json @@ -22,7 +22,6 @@ "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, @@ -41,7 +40,6 @@ "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, From 878409b6b4db06949016f4e75428b2ad53cd6e48 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 15 Feb 2019 02:37:41 +0100 Subject: [PATCH 054/155] Remove the unnecessary module declaration from backbone-relational --- types/backbone-relational/index.d.ts | 243 +++++++++++++-------------- 1 file changed, 119 insertions(+), 124 deletions(-) diff --git a/types/backbone-relational/index.d.ts b/types/backbone-relational/index.d.ts index 5d66ebfef9..e9cc5e71ff 100644 --- a/types/backbone-relational/index.d.ts +++ b/types/backbone-relational/index.d.ts @@ -9,166 +9,161 @@ import { EventsMixin, Events, Model as BModel, Collection } from 'backbone'; -declare module 'backbone-relational' { - class Model extends BModel { - /** - * Do not use, prefer TypeScript's extend functionality. - **/ - //private static extend(properties:any, classProperties?:any):any; +export class Model extends BModel { + /** + * Do not use, prefer TypeScript's extend functionality. + **/ + //private static extend(properties:any, classProperties?:any):any; - relations:any; - subModelTypes:any; - subModelTypeAttribute:any; + relations:any; + subModelTypes:any; + subModelTypeAttribute:any; - initializeRelations(options:any):void; + initializeRelations(options:any):void; - updateRelations(options:any):void; + updateRelations(options:any):void; - queue(func:any):void; + queue(func:any):void; - processQueue():void; + processQueue():void; - getRelation(name:string):Relation; + getRelation(name:string):Relation; - getRelations():Relation[]; + getRelations():Relation[]; - fetchRelated(key:string, options?:any, update?:boolean):any; + fetchRelated(key:string, options?:any, update?:boolean):any; - toJSON(options?: any):any; + toJSON(options?: any):any; - static setup(); + static setup(); - static build(attributes:any, options?:any); + static build(attributes:any, options?:any); - static findOrCreate(attributes:string, options?:any); + static findOrCreate(attributes:string, options?:any); - static findOrCreate(attributes:number, options?:any); + static findOrCreate(attributes:number, options?:any); - static findOrCreate(attributes:any, options?:any); - } + static findOrCreate(attributes:any, options?:any); +} - export class Relation extends BModel { +export class Relation extends BModel { - options:any; - instance:any; - key:any; - keyContents:any; - relatedModel:any; - relatedCollection:any; - reverseRelation:any; - related:any; + options:any; + instance:any; + key:any; + keyContents:any; + relatedModel:any; + relatedCollection:any; + reverseRelation:any; + related:any; - checkPreconditions():boolean; + checkPreconditions():boolean; - setRelated(related:BModel):void; + setRelated(related:BModel):void; - setRelated(related:Collection):void; + setRelated(related:Collection):void; - getReverseRelations(model:Model):Relation; + getReverseRelations(model:Model):Relation; - destroy():void; - } + destroy():void; +} - export class HasOne extends Relation { - collectionType:any; +export class HasOne extends Relation { + collectionType:any; - findRelated(options:any):BModel; + findRelated(options:any):BModel; - setKeyContents(keyContents:string):void; + setKeyContents(keyContents:string):void; - setKeyContents(keyContents:string[]):void; + setKeyContents(keyContents:string[]):void; - setKeyContents(keyContents:number):void; + setKeyContents(keyContents:number):void; - setKeyContents(keyContents:number[]):void; + setKeyContents(keyContents:number[]):void; - setKeyContents(keyContents:Collection):void; + setKeyContents(keyContents:Collection):void; - onChange(model:BModel, attr:any, options:any):void; + onChange(model:BModel, attr:any, options:any):void; - handleAddition(model:BModel, coll:Collection, options:any):void; + handleAddition(model:BModel, coll:Collection, options:any):void; - handleRemoval(model:BModel, coll:Collection, options:any):void; + handleRemoval(model:BModel, coll:Collection, options:any):void; - handleReset(coll:Collection, options:any):void; + handleReset(coll:Collection, options:any):void; - tryAddRelated(model:BModel, coll:any, options:any):void; + tryAddRelated(model:BModel, coll:any, options:any):void; - addRelated(model:BModel, options:any):void; + addRelated(model:BModel, options:any):void; - removeRelated(model:BModel, coll:any, options:any):void; - - } - - - export class HasMany extends Relation { - collectionType:any; - - findRelated(options:any):BModel; - - setKeyContents(keyContents:string):void; - - setKeyContents(keyContents:number):void; - - setKeyContents(keyContents:BModel):void; - - onChange(model:BModel, attr:any, options:any):void; - - tryAddRelated(model:BModel, coll:any, options:any):void; - - addRelated(model:BModel, options:any):void; - - removeRelated(model:BModel, coll:any, options:any):void; - - } - - export class Store extends EventsMixin implements Events { - initializeRelation(model, relation, options); - - addModelScope(scope:any):void; - - removeModelScope(scope):void; - - addSubModels(subModelTypes:Model, superModelType:Model):void; - - setupSuperModel(modelType:Model):void; - - addReverseRelation(relation:any):void; - - addOrphanRelation(relation:any):void; - - processOrphanRelations():void; - - retroFitRelation(relation:Model, create:boolean):Collection; - - getCollection(type:Model, create:boolean):Collection; - - getObjectByName(name:string):any; - - - resolveIdForItem(type:any, item:any):any; - - static find(type:any, item:string):Model; - - static find(type:any, item:number):Model; - - static find(type:any, item:Model):Model; - - static find(type:any, item:any):Model; - - register(model:Model):void; - - checkId(model:Model, id:any):void; - - update(model:Model):void; - - unregister(model:Model, collection:Collection, options:any):void; - - reset():void; - - - } + removeRelated(model:BModel, coll:any, options:any):void; } + +export class HasMany extends Relation { + collectionType:any; + + findRelated(options:any):BModel; + + setKeyContents(keyContents:string):void; + + setKeyContents(keyContents:number):void; + + setKeyContents(keyContents:BModel):void; + + onChange(model:BModel, attr:any, options:any):void; + + tryAddRelated(model:BModel, coll:any, options:any):void; + + addRelated(model:BModel, options:any):void; + + removeRelated(model:BModel, coll:any, options:any):void; + +} + +export class Store extends EventsMixin implements Events { + initializeRelation(model, relation, options); + + addModelScope(scope:any):void; + + removeModelScope(scope):void; + + addSubModels(subModelTypes:Model, superModelType:Model):void; + + setupSuperModel(modelType:Model):void; + + addReverseRelation(relation:any):void; + + addOrphanRelation(relation:any):void; + + processOrphanRelations():void; + + retroFitRelation(relation:Model, create:boolean):Collection; + + getCollection(type:Model, create:boolean):Collection; + + getObjectByName(name:string):any; + + + resolveIdForItem(type:any, item:any):any; + + static find(type:any, item:string):Model; + + static find(type:any, item:number):Model; + + static find(type:any, item:Model):Model; + + static find(type:any, item:any):Model; + + register(model:Model):void; + + checkId(model:Model, id:any):void; + + update(model:Model):void; + + unregister(model:Model, collection:Collection, options:any):void; + + reset():void; + +} From 6fecba5a3632dcc1715a6c2a852a5d784462f910 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 15 Feb 2019 02:49:13 +0100 Subject: [PATCH 055/155] Re-enable all linter rules in backbone-relational that are not violated --- types/backbone-relational/tslint.json | 53 --------------------------- 1 file changed, 53 deletions(-) diff --git a/types/backbone-relational/tslint.json b/types/backbone-relational/tslint.json index 4f5d8a2416..65e27fce52 100644 --- a/types/backbone-relational/tslint.json +++ b/types/backbone-relational/tslint.json @@ -1,77 +1,24 @@ { "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-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-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 } } From 6b964fe60df13153fe0543b25ad2b58d6bde4a13 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 15 Feb 2019 02:58:56 +0100 Subject: [PATCH 056/155] Re-enable all linter rules in backbone that are not violated --- types/backbone/tslint.json | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/types/backbone/tslint.json b/types/backbone/tslint.json index d67ffb3a73..f5ae3a6788 100644 --- a/types/backbone/tslint.json +++ b/types/backbone/tslint.json @@ -8,73 +8,35 @@ "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-angle-bracket-type-assertion": 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 } } From 56683cefb04ce87f7d267148aaa75562168c3770 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 15 Feb 2019 03:29:39 +0100 Subject: [PATCH 057/155] Fix some project URLs --- types/backbone-associations/index.d.ts | 2 +- types/backbone/index.d.ts | 1 + types/knockback/index.d.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/backbone-associations/index.d.ts b/types/backbone-associations/index.d.ts index d0681c6651..3cf8937b40 100644 --- a/types/backbone-associations/index.d.ts +++ b/types/backbone-associations/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Backbone-associations 0.6.4 -// Project: https://github.com/dhruvaray/backbone-associations/ +// Project: https://github.com/dhruvaray/backbone-associations // Definitions by: Craig Brett // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index c54bf6309b..58e3735f2b 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -1,5 +1,6 @@ // Type definitions for Backbone 1.3.3 // Project: http://backbonejs.org/ +// https://github.com/jashkenas/backbone // Definitions by: Boris Yankov // Natan Vivo // kenjiru diff --git a/types/knockback/index.d.ts b/types/knockback/index.d.ts index 68b9dc9e0b..6788b4b652 100644 --- a/types/knockback/index.d.ts +++ b/types/knockback/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Knockback.js -// Project: http://kmalakoff.github.io/knockback/ +// Project: http://kmalakoff.github.io/knockback // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 4a12e746f2a4a9cd39d0563a50b3c1b8705dda35 Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Fri, 15 Feb 2019 03:38:31 +0100 Subject: [PATCH 058/155] Really fix the project URLs for knockback and backbone-assocations --- types/backbone-associations/index.d.ts | 2 +- types/knockback/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/backbone-associations/index.d.ts b/types/backbone-associations/index.d.ts index 3cf8937b40..c93eb965e8 100644 --- a/types/backbone-associations/index.d.ts +++ b/types/backbone-associations/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Backbone-associations 0.6.4 -// Project: https://github.com/dhruvaray/backbone-associations +// Project: http://dhruvaray.github.io/backbone-associations // Definitions by: Craig Brett // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/knockback/index.d.ts b/types/knockback/index.d.ts index 6788b4b652..59f3e3fa93 100644 --- a/types/knockback/index.d.ts +++ b/types/knockback/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Knockback.js -// Project: http://kmalakoff.github.io/knockback +// Project: http://kmalakoff.github.com/knockback // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 1cde5fd4bed85380a1fcf88d5bfced87e82c5622 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 14 Feb 2019 21:59:35 -0800 Subject: [PATCH 059/155] Allow arbitrary strings in string literal union types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Restore `Transform` and `ValueTransform` string union literal types • Use generics to allow arbitrary strings for parameters with the previously listed types • Move exported functions to the bottom of the file --- types/theo/index.d.ts | 133 +++++++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 61 deletions(-) diff --git a/types/theo/index.d.ts b/types/theo/index.d.ts index d60a797159..27ee6c51c0 100644 --- a/types/theo/index.d.ts +++ b/types/theo/index.d.ts @@ -5,51 +5,46 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -import { Collection, Map, List, OrderedMap } from "immutable"; +import { Collection, Map, List, OrderedMap } from 'immutable' export type StyleProperty = - | "name" - | "value" - | "type" - | "originalValue" - | "category" - | "comment" - | "meta"; + | 'name' + | 'value' + | 'type' + | 'originalValue' + | 'category' + | 'comment' + | 'meta'; export type Format = - | "custom-properties.css" - | "cssmodules.css" - | "scss" - | "sass" - | "less" - | "styl" - | "map.css" - | "map.variable.scss" - | "list.scss" - | "module.js" - | "common.js" - | "html" - | "json" - | "raw.json" - | "ios.json" - | "android.xml" - | "aura.tokens"; + | 'custom-properties.css' + | 'cssmodules.css' + | 'scss' + | 'sass' + | 'less' + | 'styl' + | 'map.css' + | 'map.variable.scss' + | 'list.scss' + | 'module.js' + | 'common.js' + | 'html' + | 'json' + | 'raw.json' + | 'ios.json' + | '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; @@ -58,36 +53,52 @@ export type Meta = Map; export type FormatResultFn = (result: ImmutableStyleMap) => string; export interface StyleMap { - aliases: Aliases; - global?: Props; - imports?: string[]; - props: Props; - meta: Meta; - options: object; + aliases: Aliases; + global?: Props; + imports?: string[]; + props: Props; + meta: Meta; + options: object; } export interface ImmutableStyleMap extends Map { - toJS(): StyleMap; - get(key: K): StyleMap[K]; + toJS(): StyleMap; + get(key: K): StyleMap[K]; } export interface ConvertOptions { - transform: TransformOptions; - format: FormatOptions; - resolveAliases?: boolean; - resolveMetaAliases?: boolean; + transform: TransformOptions; + format: FormatOptions; + resolveAliases?: boolean; + resolveMetaAliases?: boolean; } -export interface TransformOptions { - type?: string; - file: string; - data?: string; +export interface TransformOptions { + type?: Transform | T; + file: string; + data?: string; } export interface FormatOptions { - type: Format; - options?: ( - options: object, - transformPropName?: (name: string) => string - ) => void; + type: Format; + options?: ( + options: object, + 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; From b9c1d04fefc27a7e2d433a9739b0e2b355c58316 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 14 Feb 2019 22:05:14 -0800 Subject: [PATCH 060/155] Undo prettier formatting and fix type argument error --- types/theo/index.d.ts | 128 +++++++++++++++++++++--------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/types/theo/index.d.ts b/types/theo/index.d.ts index 27ee6c51c0..3735da3e0c 100644 --- a/types/theo/index.d.ts +++ b/types/theo/index.d.ts @@ -5,46 +5,46 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -import { Collection, Map, List, OrderedMap } from 'immutable' +import { Collection, Map, List, OrderedMap } from "immutable"; export type StyleProperty = - | 'name' - | 'value' - | 'type' - | 'originalValue' - | 'category' - | 'comment' - | 'meta'; + | "name" + | "value" + | "type" + | "originalValue" + | "category" + | "comment" + | "meta"; export type Format = - | 'custom-properties.css' - | 'cssmodules.css' - | 'scss' - | 'sass' - | 'less' - | 'styl' - | 'map.css' - | 'map.variable.scss' - | 'list.scss' - | 'module.js' - | 'common.js' - | 'html' - | 'json' - | 'raw.json' - | 'ios.json' - | 'android.xml' - | 'aura.tokens'; + | "custom-properties.css" + | "cssmodules.css" + | "scss" + | "sass" + | "less" + | "styl" + | "map.css" + | "map.variable.scss" + | "list.scss" + | "module.js" + | "common.js" + | "html" + | "json" + | "raw.json" + | "ios.json" + | "android.xml" + | "aura.tokens"; -export type Transform = 'raw' | 'ios' | 'android' | 'web'; +export type Transform = "raw" | "ios" | "android" | "web"; export type ValueTransform = - | 'color/rgb' - | 'color/hex' - | 'color/hex8rgba' - | 'color/hex8argb' - | 'percentage/float' - | 'relative/pixel' - | 'relative/pixelValue'; + | "color/rgb" + | "color/hex" + | "color/hex8rgba" + | "color/hex8argb" + | "percentage/float" + | "relative/pixel" + | "relative/pixelValue"; export type Prop = Map; export type Props = List; @@ -53,52 +53,52 @@ export type Meta = Map; export type FormatResultFn = (result: ImmutableStyleMap) => string; export interface StyleMap { - aliases: Aliases; - global?: Props; - imports?: string[]; - props: Props; - meta: Meta; - options: object; + aliases: Aliases; + global?: Props; + imports?: string[]; + props: Props; + meta: Meta; + options: object; } export interface ImmutableStyleMap extends Map { - toJS(): StyleMap; - get(key: K): StyleMap[K]; + toJS(): StyleMap; + get(key: K): StyleMap[K]; } export interface ConvertOptions { - transform: TransformOptions; - format: FormatOptions; - resolveAliases?: boolean; - resolveMetaAliases?: boolean; + transform: TransformOptions; + format: FormatOptions; + resolveAliases?: boolean; + resolveMetaAliases?: boolean; } -export interface TransformOptions { - type?: Transform | T; - file: string; - data?: string; +export interface TransformOptions { + type?: Transform | T; + file: string; + data?: string; } export interface FormatOptions { - type: Format; - options?: ( - options: object, - transformPropName?: (name: string) => string - ) => void; + type: Format; + options?: ( + options: object, + 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 +export function registerFormat( + name: Format | T, + format: FormatResultFn | string ): void; -export function registerTransform( - name: Transform | T, - valueTransforms: ValueTransform[] | T[] +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 +export function registerValueTransform( + name: ValueTransform | T, + predicate: (prop: Prop) => boolean, + transform: (prop: Prop) => string | number ): void; From 35b155efcc4d873a38a43936cc14f02b580c8a20 Mon Sep 17 00:00:00 2001 From: Daniel Friesen Date: Thu, 14 Feb 2019 22:09:26 -0800 Subject: [PATCH 061/155] Partial implementation of pkgcloud types This includes the storage API with config for amazon and azure. --- types/pkgcloud/README.md | 7 ++ types/pkgcloud/index.d.ts | 131 +++++++++++++++++++++++++++++++ types/pkgcloud/pkgcloud-tests.ts | 64 +++++++++++++++ types/pkgcloud/tsconfig.json | 23 ++++++ types/pkgcloud/tslint.json | 1 + 5 files changed, 226 insertions(+) create mode 100644 types/pkgcloud/README.md create mode 100644 types/pkgcloud/index.d.ts create mode 100644 types/pkgcloud/pkgcloud-tests.ts create mode 100644 types/pkgcloud/tsconfig.json create mode 100644 types/pkgcloud/tslint.json diff --git a/types/pkgcloud/README.md b/types/pkgcloud/README.md new file mode 100644 index 0000000000..20815adfb4 --- /dev/null +++ b/types/pkgcloud/README.md @@ -0,0 +1,7 @@ +This file exists for reminding contributors that this definition is **WIP**. + +### Note + +pkgcloud has a large number of client types and providers. Only some clients and providers have types defined. + +You are welcome to contribute definitions for other clients and providers and add provider specific properties. diff --git a/types/pkgcloud/index.d.ts b/types/pkgcloud/index.d.ts new file mode 100644 index 0000000000..7a0a55a773 --- /dev/null +++ b/types/pkgcloud/index.d.ts @@ -0,0 +1,131 @@ +// Type definitions for pkgcloud 1.7 +// Project: https://github.com/pkgcloud/pkgcloud#readme +// Definitions by: Daniel Friesen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +export const version: string; + +export interface ClientError extends Error { + provider?: Providers; + method?: string; + failCode?: string; + statusCode?: number; + href?: string; + headers?: { [headerName: string]: string }; + result?: any; +} + +export type Providers = + | 'amazon' + | 'azure' + | 'digitalocean' + | 'google' + | 'hp' + | 'iriscouch' + | 'joyent' + | 'mongohq' + | 'mongolab' + | 'oneandone' + | 'openstack' + | 'rackspace' + | 'redistogo' + | 'telefonic'; + +export interface BaseProviderOptions { + provider: Providers; +} + +export interface AmazonProviderOptions { + provider: 'amazon'; + keyId: string; + key: string; + region?: string; +} + +export interface AzureProviderOptions { + provider: 'azure'; + storageAccount: string; + storageAccessKey: string; + location?: string; +} + +export type ProviderOptions = BaseProviderOptions & Partial< + | AmazonProviderOptions + | AzureProviderOptions +>; + +/** + * Storage + */ + +export namespace storage { + interface StorageUploadOptions { + container: string; + remote: string; + } + + interface StorageDownloadOptions { + container: string; + remote: string; + } + + interface Client { + provider: string; + config: ProviderOptions; + protocol: string; + + getContainers( + callback: (err: ClientError, containers: Container[]) => any, + ): void; + createContainer( + options: any, + callback: (err: ClientError, container: Container) => any, + ): void; + destroyContainer( + containerName: string, + callback: (err: ClientError) => any, + ): void; + getContainer( + containerName: string, + callback: (err: ClientError, container: Container) => any, + ): void; + upload(options: StorageUploadOptions): NodeJS.WriteStream; + download(options: StorageDownloadOptions): NodeJS.ReadStream; + getFiles( + containerName: string, + callback: (err: ClientError, files: File[]) => any, + ): void; + getFile( + containerName: string, + file: string, + callback: (err: ClientError, file: File) => any, + ): void; + removeFile( + containerName: string, + file: string, + callback: (err: ClientError) => any, + ): void; + // Logs + on( + eventName: string, + callback: (message: string, object?: any) => any, + ): void; + } + + interface Container { + // files: ? + client: Client; + } + + interface File { + container: string; + name: string; + size: number; + client: Client; + } + + function createClient(options: ProviderOptions): Client; +} diff --git a/types/pkgcloud/pkgcloud-tests.ts b/types/pkgcloud/pkgcloud-tests.ts new file mode 100644 index 0000000000..62846b6b55 --- /dev/null +++ b/types/pkgcloud/pkgcloud-tests.ts @@ -0,0 +1,64 @@ +import { createReadStream, createWriteStream } from "fs"; +import * as pkgcloud from "pkgcloud"; + +/** + * Storage + */ + +// Amazon +pkgcloud.storage.createClient({ + provider: 'amazon', + keyId: 'ABDEFGHI', + key: 'AABDEF==', +}); + +// Azure +pkgcloud.storage.createClient({ + provider: 'azure', + storageAccount: 'abcdefg', + storageAccessKey: 'AABDEF==', +}); + +// Upload a File +{ + const client = pkgcloud.storage.createClient({ + provider: 'amazon' + }); + + const readStream = createReadStream('a-file.txt'); + const writeStream = client.upload({ + container: 'a-container', + remote: 'remote-file-name.txt' + }); + + writeStream.on('error', (err: pkgcloud.ClientError) => {}); + writeStream.on('success', (file: pkgcloud.storage.File) => {}); + readStream.pipe(writeStream); +} + +// Download a File +{ + const client = pkgcloud.storage.createClient({ + provider: 'amazon' + }); + + const readStream = client.download({ + container: 'a-container', + remote: 'remote-file-name.txt' + }); + readStream.pipe(createWriteStream('a-file.txt')); +} + +// Logs +{ + const client = pkgcloud.storage.createClient({ + provider: 'amazon' + }); + + client.on('log::*', (message, object) => { + console.log(message); + if (object) { + console.dir(object); + } + }); +} diff --git a/types/pkgcloud/tsconfig.json b/types/pkgcloud/tsconfig.json new file mode 100644 index 0000000000..f36ed5e952 --- /dev/null +++ b/types/pkgcloud/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", + "pkgcloud-tests.ts" + ] +} diff --git a/types/pkgcloud/tslint.json b/types/pkgcloud/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pkgcloud/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 088506cb1f4598467fd03167c7d187719edd7210 Mon Sep 17 00:00:00 2001 From: Julian Hundeloh Date: Fri, 15 Feb 2019 07:32:56 +0100 Subject: [PATCH 062/155] fix: add spaces and contributor --- types/tinycon/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/tinycon/index.d.ts b/types/tinycon/index.d.ts index 745baa28a8..03d1ce4dc8 100644 --- a/types/tinycon/index.d.ts +++ b/types/tinycon/index.d.ts @@ -1,9 +1,10 @@ // Type definitions for tinycon 0.6 // Project: https://github.com/tommoor/tinycon // Definitions by: Daniel Waxweiler +// Julian Hundeloh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export function setBubble(count: number|string|null): void; +export function setBubble(count: number | string | null): void; export function setOptions(options: TinyconOptions): void; From 976d022800f8459f6b42d529a192fed297bb6eda Mon Sep 17 00:00:00 2001 From: Julian Hundeloh Date: Fri, 15 Feb 2019 07:40:16 +0100 Subject: [PATCH 063/155] fix: update test --- types/tinycon/tinycon-tests.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/types/tinycon/tinycon-tests.ts b/types/tinycon/tinycon-tests.ts index b4bcc304ac..fb898630e7 100644 --- a/types/tinycon/tinycon-tests.ts +++ b/types/tinycon/tinycon-tests.ts @@ -10,4 +10,16 @@ Tinycon.setOptions({ width: 7 }); +Tinycon.setOptions({ + abbreviate: false, + background: '#549A2F', + color: '#ffffff', + fallback: 'force', + font: '10px arial', + height: 9, + width: 7 +}); + Tinycon.setBubble(7); + +Tinycon.setBubble(null); From 9beda1efac5d277b370a77b7c7c16bac706af2cf Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Fri, 15 Feb 2019 11:47:32 +0500 Subject: [PATCH 064/155] Added type definition for natural-compare --- types/natural-compare-lite/index.d.ts | 14 +++++++++++ .../natural-compare-lite-tests.ts | 10 ++++++++ types/natural-compare-lite/tsconfig.json | 23 +++++++++++++++++++ types/natural-compare-lite/tslint.json | 3 +++ types/natural-compare/index.d.ts | 14 +++++++++++ .../natural-compare/natural-compare-tests.ts | 10 ++++++++ types/natural-compare/tsconfig.json | 23 +++++++++++++++++++ types/natural-compare/tslint.json | 3 +++ 8 files changed, 100 insertions(+) create mode 100644 types/natural-compare-lite/index.d.ts create mode 100644 types/natural-compare-lite/natural-compare-lite-tests.ts create mode 100644 types/natural-compare-lite/tsconfig.json create mode 100644 types/natural-compare-lite/tslint.json create mode 100644 types/natural-compare/index.d.ts create mode 100644 types/natural-compare/natural-compare-tests.ts create mode 100644 types/natural-compare/tsconfig.json create mode 100644 types/natural-compare/tslint.json diff --git a/types/natural-compare-lite/index.d.ts b/types/natural-compare-lite/index.d.ts new file mode 100644 index 0000000000..5e1a10bbdb --- /dev/null +++ b/types/natural-compare-lite/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for natural-compare-lite 1.4.0 +// Project: https://github.com/litejs/natural-compare-lite +// Definitions by: Doniyor Aliyev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function naturalCompare(a: string, b: string): number; + +declare global { + interface StringConstructor { + naturalCompare: typeof naturalCompare; + } +} + +export = naturalCompare; diff --git a/types/natural-compare-lite/natural-compare-lite-tests.ts b/types/natural-compare-lite/natural-compare-lite-tests.ts new file mode 100644 index 0000000000..dc483b4bcd --- /dev/null +++ b/types/natural-compare-lite/natural-compare-lite-tests.ts @@ -0,0 +1,10 @@ +// Type definitions for natural-compare-lite 1.4.0 +// Project: https://github.com/litejs/natural-compare-lite +// Definitions by: Doniyor Aliyev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import compare = require("natural-compare-lite"); + +['a', 's', 'd'].sort(compare); + +['a', 's', 'd'].sort(String.naturalCompare); diff --git a/types/natural-compare-lite/tsconfig.json b/types/natural-compare-lite/tsconfig.json new file mode 100644 index 0000000000..e3ed3ac1e0 --- /dev/null +++ b/types/natural-compare-lite/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "natural-compare-lite-tests.ts" + ] +} diff --git a/types/natural-compare-lite/tslint.json b/types/natural-compare-lite/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/natural-compare-lite/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/natural-compare/index.d.ts b/types/natural-compare/index.d.ts new file mode 100644 index 0000000000..57e0999157 --- /dev/null +++ b/types/natural-compare/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for natural-compare 1.4.0 +// Project: https://github.com/litejs/natural-compare-lite +// Definitions by: Doniyor Aliyev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function naturalCompare(a: string, b: string): number; + +declare global { + interface StringConstructor { + naturalCompare: typeof naturalCompare; + } +} + +export = naturalCompare; diff --git a/types/natural-compare/natural-compare-tests.ts b/types/natural-compare/natural-compare-tests.ts new file mode 100644 index 0000000000..59e7d53163 --- /dev/null +++ b/types/natural-compare/natural-compare-tests.ts @@ -0,0 +1,10 @@ +// Type definitions for natural-compare 1.4.0 +// Project: https://github.com/litejs/natural-compare-lite +// Definitions by: Doniyor Aliyev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import compare = require("natural-compare"); + +['a', 's', 'd'].sort(compare); + +['a', 's', 'd'].sort(String.naturalCompare); diff --git a/types/natural-compare/tsconfig.json b/types/natural-compare/tsconfig.json new file mode 100644 index 0000000000..81322d5590 --- /dev/null +++ b/types/natural-compare/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "natural-compare-tests.ts" + ] +} diff --git a/types/natural-compare/tslint.json b/types/natural-compare/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/natural-compare/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From b2373af1a29c1ffa9b7c5b902aced1360159f0bb Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Fri, 15 Feb 2019 11:56:37 +0500 Subject: [PATCH 065/155] Fix headers --- types/natural-compare-lite/index.d.ts | 2 +- types/natural-compare-lite/natural-compare-lite-tests.ts | 2 +- types/natural-compare/index.d.ts | 2 +- types/natural-compare/natural-compare-tests.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/natural-compare-lite/index.d.ts b/types/natural-compare-lite/index.d.ts index 5e1a10bbdb..414dcf9233 100644 --- a/types/natural-compare-lite/index.d.ts +++ b/types/natural-compare-lite/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for natural-compare-lite 1.4.0 +// Type definitions for natural-compare-lite 1.4 // Project: https://github.com/litejs/natural-compare-lite // Definitions by: Doniyor Aliyev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/natural-compare-lite/natural-compare-lite-tests.ts b/types/natural-compare-lite/natural-compare-lite-tests.ts index dc483b4bcd..c073f4b46f 100644 --- a/types/natural-compare-lite/natural-compare-lite-tests.ts +++ b/types/natural-compare-lite/natural-compare-lite-tests.ts @@ -1,4 +1,4 @@ -// Type definitions for natural-compare-lite 1.4.0 +// Type definitions for natural-compare-lite 1.4 // Project: https://github.com/litejs/natural-compare-lite // Definitions by: Doniyor Aliyev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/natural-compare/index.d.ts b/types/natural-compare/index.d.ts index 57e0999157..d5bd9a6ee5 100644 --- a/types/natural-compare/index.d.ts +++ b/types/natural-compare/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for natural-compare 1.4.0 +// Type definitions for natural-compare 1.4 // Project: https://github.com/litejs/natural-compare-lite // Definitions by: Doniyor Aliyev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/natural-compare/natural-compare-tests.ts b/types/natural-compare/natural-compare-tests.ts index 59e7d53163..994788570c 100644 --- a/types/natural-compare/natural-compare-tests.ts +++ b/types/natural-compare/natural-compare-tests.ts @@ -1,4 +1,4 @@ -// Type definitions for natural-compare 1.4.0 +// Type definitions for natural-compare 1.4 // Project: https://github.com/litejs/natural-compare-lite // Definitions by: Doniyor Aliyev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 2e60bca3febc046b6a477d1d4081832baa346a83 Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Fri, 15 Feb 2019 12:03:48 +0500 Subject: [PATCH 066/155] Remove headers other than index.d.ts --- types/natural-compare-lite/natural-compare-lite-tests.ts | 5 ----- types/natural-compare/natural-compare-tests.ts | 5 ----- 2 files changed, 10 deletions(-) diff --git a/types/natural-compare-lite/natural-compare-lite-tests.ts b/types/natural-compare-lite/natural-compare-lite-tests.ts index c073f4b46f..dd823544fb 100644 --- a/types/natural-compare-lite/natural-compare-lite-tests.ts +++ b/types/natural-compare-lite/natural-compare-lite-tests.ts @@ -1,8 +1,3 @@ -// Type definitions for natural-compare-lite 1.4 -// Project: https://github.com/litejs/natural-compare-lite -// Definitions by: Doniyor Aliyev -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - import compare = require("natural-compare-lite"); ['a', 's', 'd'].sort(compare); diff --git a/types/natural-compare/natural-compare-tests.ts b/types/natural-compare/natural-compare-tests.ts index 994788570c..91a4710c15 100644 --- a/types/natural-compare/natural-compare-tests.ts +++ b/types/natural-compare/natural-compare-tests.ts @@ -1,8 +1,3 @@ -// Type definitions for natural-compare 1.4 -// Project: https://github.com/litejs/natural-compare-lite -// Definitions by: Doniyor Aliyev -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - import compare = require("natural-compare"); ['a', 's', 'd'].sort(compare); From 01365d6d2f9b88db76e288c77a1a9ea72218cf43 Mon Sep 17 00:00:00 2001 From: carl-coolblue Date: Fri, 15 Feb 2019 08:33:58 +0100 Subject: [PATCH 067/155] pikaday: Add tests for updated typings of setStartRange, setDate, setEndRange and clear --- types/pikaday/pikaday-tests.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/pikaday/pikaday-tests.ts b/types/pikaday/pikaday-tests.ts index 7a532efb6f..230104daf7 100644 --- a/types/pikaday/pikaday-tests.ts +++ b/types/pikaday/pikaday-tests.ts @@ -31,6 +31,8 @@ new Pikaday({field: $('#datepicker')[0]}); picker.getDate(); picker.setDate('2015-01-01'); picker.setDate('2015-01-01', true); + picker.setDate(null); + picker.setDate(null, true); picker.getMoment(); picker.setMoment(moment('14th February 2014', 'DDo MMMM YYYY')); picker.setMoment(moment('14th February 2014', 'DDo MMMM YYYY'), true); @@ -45,11 +47,14 @@ new Pikaday({field: $('#datepicker')[0]}); picker.setMinDate(null); picker.setMaxDate(null); picker.setStartRange(new Date()); + picker.setStartRange(null); picker.setEndRange(new Date()); + picker.setEndRange(null); picker.isVisible(); picker.show(); picker.adjustPosition(); picker.hide(); + picker.clear(); picker.destroy(); })(); From 88e0310558e7c1a73f84b7b349a0434bc43b3024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jur=C4=8Da?= Date: Fri, 15 Feb 2019 09:25:10 +0100 Subject: [PATCH 068/155] added type declarations for youtube-player --- .../youtube-player/dist/FunctionStateMap.d.ts | 31 ++++ types/youtube-player/dist/YouTubePlayer.d.ts | 12 ++ .../dist/constants/PlayerStates.d.ts | 10 ++ types/youtube-player/dist/eventNames.d.ts | 20 +++ types/youtube-player/dist/functionNames.d.ts | 46 ++++++ types/youtube-player/dist/index.d.ts | 9 ++ .../dist/loadYouTubeIframeApi.d.ts | 4 + types/youtube-player/dist/types.d.ts | 140 ++++++++++++++++++ types/youtube-player/index.d.ts | 9 ++ types/youtube-player/package.json | 5 + types/youtube-player/tsconfig.json | 25 ++++ types/youtube-player/tslint.json | 3 + 12 files changed, 314 insertions(+) create mode 100644 types/youtube-player/dist/FunctionStateMap.d.ts create mode 100644 types/youtube-player/dist/YouTubePlayer.d.ts create mode 100644 types/youtube-player/dist/constants/PlayerStates.d.ts create mode 100644 types/youtube-player/dist/eventNames.d.ts create mode 100644 types/youtube-player/dist/functionNames.d.ts create mode 100644 types/youtube-player/dist/index.d.ts create mode 100644 types/youtube-player/dist/loadYouTubeIframeApi.d.ts create mode 100644 types/youtube-player/dist/types.d.ts create mode 100644 types/youtube-player/index.d.ts create mode 100644 types/youtube-player/package.json create mode 100644 types/youtube-player/tsconfig.json create mode 100644 types/youtube-player/tslint.json diff --git a/types/youtube-player/dist/FunctionStateMap.d.ts b/types/youtube-player/dist/FunctionStateMap.d.ts new file mode 100644 index 0000000000..b45a35d145 --- /dev/null +++ b/types/youtube-player/dist/FunctionStateMap.d.ts @@ -0,0 +1,31 @@ +import PlayerStates from './constants/PlayerStates.js'; + +declare const FUNCTION_STATE_MAP: { + pauseVideo: { + acceptableStates: [ + PlayerStates.ENDED, + PlayerStates.PAUSED + ], + stateChangeRequired: false, + }, + playVideo: { + acceptableStates: [ + PlayerStates.ENDED, + PlayerStates.PLAYING + ], + stateChangeRequired: false, + }, + seekTo: { + acceptableStates: [ + PlayerStates.ENDED, + PlayerStates.PLAYING, + PlayerStates.PAUSED + ], + stateChangeRequired: true, + + // TRICKY: `seekTo` may not cause a state change if no buffering is required. + timeout: 3000, + }, +}; + +export default FUNCTION_STATE_MAP; diff --git a/types/youtube-player/dist/YouTubePlayer.d.ts b/types/youtube-player/dist/YouTubePlayer.d.ts new file mode 100644 index 0000000000..7716ca739c --- /dev/null +++ b/types/youtube-player/dist/YouTubePlayer.d.ts @@ -0,0 +1,12 @@ +import { EmitterType, YouTubePlayer } from './types'; + +export interface EventHandlerMapType { + [key: string]: (event: object) => void; +} + +declare const YouTubePlayerHelpers: { + proxyEvents(emitter: EmitterType): EventHandlerMapType, + promisifyPlayer(playerAPIReady: Promise, strictState?: boolean): YouTubePlayer, +}; + +export default YouTubePlayerHelpers; diff --git a/types/youtube-player/dist/constants/PlayerStates.d.ts b/types/youtube-player/dist/constants/PlayerStates.d.ts new file mode 100644 index 0000000000..a5beac4fa7 --- /dev/null +++ b/types/youtube-player/dist/constants/PlayerStates.d.ts @@ -0,0 +1,10 @@ +declare enum PlayerStates { + BUFFERING = 3, + ENDED = 0, + PAUSED = 2, + PLAYING = 1, + UNSTARTED = -1, + VIDEO_CUED = 5, +} + +export default PlayerStates; diff --git a/types/youtube-player/dist/eventNames.d.ts b/types/youtube-player/dist/eventNames.d.ts new file mode 100644 index 0000000000..a86d3b5625 --- /dev/null +++ b/types/youtube-player/dist/eventNames.d.ts @@ -0,0 +1,20 @@ +declare const EVENT_NAMES: [ + 'ready', + 'stateChange', + 'playbackQualityChange', + 'playbackRateChange', + 'error', + 'apiChange', + 'volumeChange' +]; + +export default EVENT_NAMES; + +export type EventType = + 'ready' | + 'stateChange' | + 'playbackQualityChange' | + 'playbackRateChange' | + 'error' | + 'apiChange' | + 'volumeChange'; diff --git a/types/youtube-player/dist/functionNames.d.ts b/types/youtube-player/dist/functionNames.d.ts new file mode 100644 index 0000000000..1e317d7391 --- /dev/null +++ b/types/youtube-player/dist/functionNames.d.ts @@ -0,0 +1,46 @@ +declare const FUNCTION_NAMES: [ + 'cueVideoById', + 'loadVideoById', + 'cueVideoByUrl', + 'loadVideoByUrl', + 'playVideo', + 'pauseVideo', + 'stopVideo', + 'getVideoLoadedFraction', + 'cuePlaylist', + 'loadPlaylist', + 'nextVideo', + 'previousVideo', + 'playVideoAt', + 'setShuffle', + 'setLoop', + 'getPlaylist', + 'getPlaylistIndex', + 'setOption', + 'mute', + 'unMute', + 'isMuted', + 'setVolume', + 'getVolume', + 'seekTo', + 'getPlayerState', + 'getPlaybackRate', + 'setPlaybackRate', + 'getAvailablePlaybackRates', + 'getPlaybackQuality', + 'setPlaybackQuality', + 'getAvailableQualityLevels', + 'getCurrentTime', + 'getDuration', + 'removeEventListener', + 'getVideoUrl', + 'getVideoEmbedCode', + 'getOptions', + 'getOption', + 'addEventListener', + 'destroy', + 'setSize', + 'getIframe' +]; + +export default FUNCTION_NAMES; diff --git a/types/youtube-player/dist/index.d.ts b/types/youtube-player/dist/index.d.ts new file mode 100644 index 0000000000..09f07ff9c8 --- /dev/null +++ b/types/youtube-player/dist/index.d.ts @@ -0,0 +1,9 @@ +import { Options, YouTubePlayer } from './types'; + +declare function PlayerFactory( + maybeElementId: YouTubePlayer | HTMLElement | string, + options?: Options, + strictState?: boolean, +): YouTubePlayer; + +export default PlayerFactory; diff --git a/types/youtube-player/dist/loadYouTubeIframeApi.d.ts b/types/youtube-player/dist/loadYouTubeIframeApi.d.ts new file mode 100644 index 0000000000..7faddafbb9 --- /dev/null +++ b/types/youtube-player/dist/loadYouTubeIframeApi.d.ts @@ -0,0 +1,4 @@ +import { EmitterType, IframeApiType } from './types'; + +declare function Loader(emitter: EmitterType): Promise; +export default Loader; diff --git a/types/youtube-player/dist/types.d.ts b/types/youtube-player/dist/types.d.ts new file mode 100644 index 0000000000..340c7b7854 --- /dev/null +++ b/types/youtube-player/dist/types.d.ts @@ -0,0 +1,140 @@ +import PlayerState from './constants/PlayerStates'; +import { EventType } from './eventNames'; + +export interface EmitterType { + trigger: (eventName: string, event: object) => void; +} + +export interface Options { + width?: number; + height?: number; + videoId?: string; + playerVars?: { + autoplay?: 0 | 1, + cc_lang_pref?: string, + cc_load_policy?: 1, + color?: 'red' | 'white', + controls?: 0 | 1, + disablekb?: 0 | 1, + enablejsapi?: 0 | 1, + end?: number, + fs?: 0 | 1, + hl?: string, + iv_load_policy?: 1 | 3, + list?: string, + listType?: 'playlist' | 'search' | 'user_uploads', + loop?: 0 | 1, + modestbranding?: 1, + origin?: string, + playlist: string, + playsinline?: 0 | 1, + rel?: 0 | 1, + start?: number, + widget_referrer?: string, + }; + events?: { + [eventType in EventType]: (event: CustomEvent) => void + }; +} + +export interface IframeApiType { + Player: {new(elementId: string, options: Options): YouTubePlayer}; +} + +/** + * @see https://developers.google.com/youtube/iframe_api_reference + */ +export interface YouTubePlayer { + addEventListener(event: string, listener: (event: CustomEvent) => void): void; + destroy(): void; + getAvailablePlaybackRates(): ReadonlyArray; + getAvailableQualityLevels(): ReadonlyArray; + getCurrentTime(): number; + getDuration(): number; + getIframe(): HTMLIFrameElement; + getOption(module: string, option: string): any; + getOptions(): string[]; + getOptions(module: string): object; + setOption(module: string, option: string, value: any): void; + setOptions(): void; + cuePlaylist( + playlist: string | ReadonlyArray, + index?: number, + startSeconds?: number, + suggestedQuality?: string, + ): void; + cuePlaylist(playlist: { + listType: string, + list?: string, + index?: number, + startSeconds?: number, + suggestedQuality?: string, + }): void; + loadPlaylist( + playlist: string | ReadonlyArray, + index?: number, + startSeconds?: number, + suggestedQuality?: string, + ): void; + loadPlaylist(playlist: { + listType: string, + list?: string, + index?: number, + startSeconds?: number, + suggestedQuality?: string, + }): void; + getPlaylist(): ReadonlyArray; + getPlaylistIndex(): number; + getPlaybackQuality(): string; + getPlaybackRate(): number; + getPlayerState(): PlayerState; + getVideoEmbedCode(): string; + getVideoLoadedFraction(): number; + getVideoUrl(): string; + getVolume(): number; + cueVideoById(videoId: string, startSeconds?: number, suggestedQuality?: string): void; + cueVideoById(video: { + videoId: string, + startSeconds?: number, + endSeconds?: number, + suggestedQuality?: string, + }): void; + cueVideoByUrl(mediaContentUrl: string, startSeconds?: number, suggestedQuality?: string): void; + cueVideoByUrl(video: { + mediaContentUrl: string, + startSeconds?: number, + endSeconds?: number, + suggestedQuality?: string, + }): void; + loadVideoByUrl(mediaContentUrl: string, startSeconds?: number, suggestedQuality?: string): void; + loadVideoByUrl(video: { + mediaContentUrl: string, + startSeconds?: number, + endSeconds?: number, + suggestedQuality?: string, + }): void; + loadVideoById(videoId: string, startSeconds?: number, suggestedQuality?: string): void; + loadVideoById(video: { + videoId: string, + startSeconds?: number, + endSeconds?: number, + suggestedQuality?: string, + }): void; + isMuted(): boolean; + mute(): void; + nextVideo(): void; + pauseVideo(): void; + playVideo(): void; + playVideoAt(index: number): void; + previousVideo(): void; + removeEventListener(event: string, listener: (event: CustomEvent) => void): void; + seekTo(seconds: number, allowSeekAhead: boolean): void; + setLoop(loopPlaylists: boolean): void; + setPlaybackQuality(suggestedQuality: string): void; + setPlaybackRate(suggestedRate: number): void; + setShuffle(shufflePlaylist: boolean): void; + setSize(width: number, height: number): object; + setVolume(volume: number): void; + stopVideo(): void; + unMute(): void; +} diff --git a/types/youtube-player/index.d.ts b/types/youtube-player/index.d.ts new file mode 100644 index 0000000000..1cdab56427 --- /dev/null +++ b/types/youtube-player/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for youtube-player 5.5 +// Project: https://github.com/gajus/youtube-player +// Definitions by: Martin Jurča +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +import PlayerFactory from './dist/index'; + +export default PlayerFactory; diff --git a/types/youtube-player/package.json b/types/youtube-player/package.json new file mode 100644 index 0000000000..d0224c9efb --- /dev/null +++ b/types/youtube-player/package.json @@ -0,0 +1,5 @@ +{ + "private": true, + "dependencies": { + } +} diff --git a/types/youtube-player/tsconfig.json b/types/youtube-player/tsconfig.json new file mode 100644 index 0000000000..b447d9cac9 --- /dev/null +++ b/types/youtube-player/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts" + ] +} diff --git a/types/youtube-player/tslint.json b/types/youtube-player/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/youtube-player/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From d7c9e8cfbf149039f549b9552a379f499f787655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jur=C4=8Da?= Date: Fri, 15 Feb 2019 09:26:55 +0100 Subject: [PATCH 069/155] fixed file list for youtube-player --- types/youtube-player/tsconfig.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/types/youtube-player/tsconfig.json b/types/youtube-player/tsconfig.json index b447d9cac9..0abbd24356 100644 --- a/types/youtube-player/tsconfig.json +++ b/types/youtube-player/tsconfig.json @@ -20,6 +20,14 @@ "esModuleInterop": true }, "files": [ - "index.d.ts" + "index.d.ts", + "dist/constants/PlayerStates.d.ts", + "dist/eventNames.d.ts", + "dist/functionNames.d.ts", + "dist/FunctionStateMap.d.ts", + "dist/index.d.ts", + "dist/loadYouTubeIframeApi.d.ts", + "dist/types.d.ts", + "dist/YouTubePlayer.d.ts" ] } From 84eb0b5fad4d8498df4e7d77bbe2a92bfd05a134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jur=C4=8Da?= Date: Fri, 15 Feb 2019 09:28:44 +0100 Subject: [PATCH 070/155] fixed import paths --- types/youtube-player/dist/FunctionStateMap.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/youtube-player/dist/FunctionStateMap.d.ts b/types/youtube-player/dist/FunctionStateMap.d.ts index b45a35d145..5ee7b07081 100644 --- a/types/youtube-player/dist/FunctionStateMap.d.ts +++ b/types/youtube-player/dist/FunctionStateMap.d.ts @@ -1,4 +1,4 @@ -import PlayerStates from './constants/PlayerStates.js'; +import PlayerStates from './constants/PlayerStates'; declare const FUNCTION_STATE_MAP: { pauseVideo: { From 3299334d24c0e9dbcbeb3af03978b23936a41bd2 Mon Sep 17 00:00:00 2001 From: Losses Don Date: Fri, 15 Feb 2019 17:02:48 +0800 Subject: [PATCH 071/155] Update Option.d.ts --- types/react-select/lib/components/Option.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/react-select/lib/components/Option.d.ts b/types/react-select/lib/components/Option.d.ts index ab9b4d8297..d7d20ec325 100644 --- a/types/react-select/lib/components/Option.d.ts +++ b/types/react-select/lib/components/Option.d.ts @@ -4,11 +4,11 @@ import { colors, spacing } from '../theme'; import { CommonProps, PropsWithStyles, InnerRef } from '../types'; interface State { - /** Wether the option is disabled. */ + /** Whether the option is disabled. */ isDisabled: boolean; - /** Wether the option is focused. */ + /** Whether the option is focused. */ isFocused: boolean; - /** Wether the option is selected. */ + /** Whether the option is selected. */ isSelected: boolean; } interface InnerProps { From 0db8baf72a30e88860a85bd4f1f34ab1a44e3cb2 Mon Sep 17 00:00:00 2001 From: Jeroen Claassens Date: Fri, 15 Feb 2019 10:13:35 +0100 Subject: [PATCH 072/155] Improve tests and type definitions - Exported an extra interface to make typing all the translation text labels much easier - Improved tests to make use of React class props, now the test also represents usage for creating a variable Mui-datatable using React classes Signed-off-by: Jeroen Claassens --- types/mui-datatables/index.d.ts | 2 +- types/mui-datatables/mui-datatables-tests.tsx | 138 ++++++++---------- types/mui-datatables/tsconfig.json | 4 +- 3 files changed, 67 insertions(+), 77 deletions(-) diff --git a/types/mui-datatables/index.d.ts b/types/mui-datatables/index.d.ts index aa5ad83e5e..2dffabbc53 100644 --- a/types/mui-datatables/index.d.ts +++ b/types/mui-datatables/index.d.ts @@ -85,7 +85,7 @@ interface MUIDataTableTextLabelsSelectedRows { deleteAria: string; } -interface MUIDataTableTextLabels { +export interface MUIDataTableTextLabels { body: MUIDataTableTextLabelsBody; pagination: MUIDataTableTextLabelsPagination; toolbar: MUIDataTableTextLabelsToolbar; diff --git a/types/mui-datatables/mui-datatables-tests.tsx b/types/mui-datatables/mui-datatables-tests.tsx index 47eb181389..fe2a104f5a 100644 --- a/types/mui-datatables/mui-datatables-tests.tsx +++ b/types/mui-datatables/mui-datatables-tests.tsx @@ -1,84 +1,72 @@ -import MUIDataTable, { MUIDataTableColumnDef, MUIDataTableOptions } from 'mui-datatables'; +import MUIDataTable, { MUIDataTableOptions, MUIDataTableTextLabels } from 'mui-datatables'; import * as React from 'react'; -const dataSimple: string[][] = [ - ['Joe James', 'Test Corp', 'Yonkers', 'NY'], - ['John Walsh', 'Test Corp', 'Hartford', 'CT'], - ['Bob Herm', 'Test Corp', 'Tampa', 'FL'], - ['James Houston', 'Test Corp', 'Dallas', 'TX'] -]; +interface Props extends MUIDataTableOptions { + data: any; + title: string; + textLabels?: MUIDataTableTextLabels; +} -const columnWithOptions: MUIDataTableColumnDef[] = [ - { - name: 'Name', - label: 'New Name', - options: { - display: 'true', - filter: true, - sort: true, - sortDirection: 'asc', - download: true, +class MuiCustomTable extends React.Component { + private readonly data: string[][] = this.props.data.map((asset: any) => Object.values(asset)); + private readonly columns = [...new Set(this.props.data.map((entry: any) => Object.keys(entry)).flat().map((title: string) => title.toUpperCase()))] as string[]; + private readonly TableOptions: MUIDataTableOptions = { + filterType: 'checkbox', + responsive: 'scroll', + selectableRows: false, + elevation: 0, + rowsPerPageOptions: [5, 10, 20, 25, 50, 100], + downloadOptions: { + filename: 'filename.csv', + separator: ',' + }, + sortFilterList: false, + textLabels: { + body: { + noMatch: 'Sorry, no matching records found', + toolTip: 'Sort', + }, + pagination: { + next: 'Next Page', + previous: 'Previous Page', + rowsPerPage: 'Rows per page:', + displayRows: 'of', + }, + toolbar: { + search: 'Search', + downloadCsv: 'Download CSV', + print: 'Print', + viewColumns: 'View Columns', + filterTable: 'Filter Table', + }, + filter: { + all: 'All', + title: 'FILTERS', + reset: 'RESET', + }, + viewColumns: { + title: 'Show Columns', + titleAria: 'Show/Hide Table Columns', + }, + selectedRows: { + text: 'rows(s) selected', + delete: 'Delete', + deleteAria: 'Delete Selected Rows', + } } - } -]; + }; -const options: MUIDataTableOptions = { - filterType: 'checkbox', - responsive: 'scroll', - selectableRows: false, - elevation: 0, - rowsPerPageOptions: [5, 10, 20, 25, 50, 100], - downloadOptions: { - filename: 'filename.csv', - separator: ',' - }, - sortFilterList: false, - textLabels: { - body: { - noMatch: 'Sorry, no matching records found', - toolTip: 'Sort', - }, - pagination: { - next: 'Next Page', - previous: 'Previous Page', - rowsPerPage: 'Rows per page:', - displayRows: 'of', - }, - toolbar: { - search: 'Search', - downloadCsv: 'Download CSV', - print: 'Print', - viewColumns: 'View Columns', - filterTable: 'Filter Table', - }, - filter: { - all: 'All', - title: 'FILTERS', - reset: 'RESET', - }, - viewColumns: { - title: 'Show Columns', - titleAria: 'Show/Hide Table Columns', - }, - selectedRows: { - text: 'rows(s) selected', - delete: 'Delete', - deleteAria: 'Delete Selected Rows', - } - } -}; - -class MuiDataTable extends React.Component { render() { - return ( - - ); + return (); } } -; +const TableFruits = [ + {id: 1, name: "Apple", amount: 1}, + {id: 2, name: "Pear", amount: 2}, + {id: 3, name: "Strawberry", amount: 5}, + {id: 4, name: "Banana", amount: 7}, + {id: 5, name: "Orange", amount: 9}, +]; + +; diff --git a/types/mui-datatables/tsconfig.json b/types/mui-datatables/tsconfig.json index 280efbb284..6383549b94 100644 --- a/types/mui-datatables/tsconfig.json +++ b/types/mui-datatables/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ + "es2017.object", "es6", "dom" ], @@ -16,7 +17,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "downlevelIteration": true, }, "files": [ "index.d.ts", From fde56252644719de54697f672132d1389e37d7df Mon Sep 17 00:00:00 2001 From: Martin Artola Date: Fri, 15 Feb 2019 10:17:10 +0100 Subject: [PATCH 073/155] relax typings (roolback) --- types/relay-runtime/index.d.ts | 35 +++------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 4b3f5af8c8..d5ce247a49 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -42,38 +42,9 @@ export type RelayContainer = any; // ~~~~~~~~~~~~~~~~~~~~~ // File: https://github.com/facebook/relay/blob/fe0e70f10bbcba1fff89911313ea69f24569464b/packages/relay-runtime/util/RelayConcreteNode.js -export interface ConcreteFragment { - kind: string; - name: string; - type: string; - metadata: {[key: string]: any} | null; - argumentDefinitions: any[]; - selections: any[]; -} -export interface ConcreteRequest { - kind: string; - operationKind: string; - name: string; - id: string | null; - text: string | null; - metadata: {[key: string]: any}; - fragment: ConcreteFragment; - operation: any; -} -export interface ConcreteBatchRequest { - kind: string; - operationKind: string; - name: string; - metadata: {[key: string]: any}; - fragment: ConcreteFragment; - requests: Array<{ - name: string; - id: string | null; - text: string | null; - argumentDependencies: any[] | null; - operation: any; - }>; -} +export type ConcreteFragment = any; +export type ConcreteRequest = any; +export type ConcreteBatchRequest = any; export function getRequest(taggedNode: GraphQLTaggedNode): ConcreteRequest; From 58453de820d37220d872ad3d309c2e5d86def5a6 Mon Sep 17 00:00:00 2001 From: Jeroen Claassens Date: Fri, 15 Feb 2019 10:19:49 +0100 Subject: [PATCH 074/155] Fix tests and lint --- types/mui-datatables/mui-datatables-tests.tsx | 6 +++++- types/mui-datatables/tsconfig.json | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/mui-datatables/mui-datatables-tests.tsx b/types/mui-datatables/mui-datatables-tests.tsx index fe2a104f5a..c6a477ea08 100644 --- a/types/mui-datatables/mui-datatables-tests.tsx +++ b/types/mui-datatables/mui-datatables-tests.tsx @@ -9,7 +9,11 @@ interface Props extends MUIDataTableOptions { class MuiCustomTable extends React.Component { private readonly data: string[][] = this.props.data.map((asset: any) => Object.values(asset)); - private readonly columns = [...new Set(this.props.data.map((entry: any) => Object.keys(entry)).flat().map((title: string) => title.toUpperCase()))] as string[]; + private readonly columns = this.props.data + .map((entry: any) => Object.keys(entry)) + .flat() + .map((title: string) => title.toUpperCase()) + .filter((element: string, index: number, array: string[]) => array.indexOf(element) === index); private readonly TableOptions: MUIDataTableOptions = { filterType: 'checkbox', responsive: 'scroll', diff --git a/types/mui-datatables/tsconfig.json b/types/mui-datatables/tsconfig.json index 6383549b94..a4d6f99b77 100644 --- a/types/mui-datatables/tsconfig.json +++ b/types/mui-datatables/tsconfig.json @@ -17,8 +17,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "downlevelIteration": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", From 1eceff4d693e1c0ff3d6feb9984be20742542f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jur=C4=8Da?= Date: Fri, 15 Feb 2019 10:34:08 +0100 Subject: [PATCH 075/155] added a simple test code --- types/youtube-player/tsconfig.json | 1 - types/youtube-player/youtube-player-tests.ts | 48 ++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 types/youtube-player/youtube-player-tests.ts diff --git a/types/youtube-player/tsconfig.json b/types/youtube-player/tsconfig.json index 0abbd24356..9718e040d9 100644 --- a/types/youtube-player/tsconfig.json +++ b/types/youtube-player/tsconfig.json @@ -5,7 +5,6 @@ "es6", "dom" ], - "jsx": "react", "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/youtube-player/youtube-player-tests.ts b/types/youtube-player/youtube-player-tests.ts new file mode 100644 index 0000000000..ae23bc84de --- /dev/null +++ b/types/youtube-player/youtube-player-tests.ts @@ -0,0 +1,48 @@ +import youTubePlayerFactory from 'youtube-player'; +import PlayerStates from 'youtube-player/dist/constants/PlayerStates'; +import { YouTubePlayer } from 'youtube-player/dist/types'; + +youTubePlayerFactory('foo'); +const player: YouTubePlayer = youTubePlayerFactory( + document.getElementById('bar'), + { + width: 640, + height: 300, + videoId: 'aaaaaaaaaa', + playerVars: { + autoplay: 1, + cc_lang_pref: 'en_US', + cc_load_policy: 1, + color: 'white', + controls: 1, + disablekb: 0, + enablejsapi: 1, + end: 60, + fs: 0, + hl: 'fooBar', + iv_load_policy: 3, + list: 'bbbbbbbbbb', + listType: 'search', + loop: 0, + modestbranding: 1, + origin: 'https://definitelytyped.org/', + playlist: 'cccccccccc', + playsinline: 0, + rel: 1, + start: 3, + widget_referrer: 'nothing', + }, + events: { + ready: (event: CustomEvent): void => {}, + stateChange: (event: CustomEvent): void => { + console.log(player.getPlayerState() === PlayerStates.PLAYING); + }, + playbackQualityChange: (event: CustomEvent): void => {}, + playbackRateChange: (event: CustomEvent): void => {}, + error: (event: CustomEvent): void => {}, + apiChange: (event: CustomEvent): void => {}, + volumeChange: (event: CustomEvent): void => {}, + }, + }, + true, +); From 0751c2cc2628088769a5a4f2054137a3c74e9007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jur=C4=8Da?= Date: Fri, 15 Feb 2019 10:42:11 +0100 Subject: [PATCH 076/155] added tests to the file list --- types/youtube-player/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/youtube-player/tsconfig.json b/types/youtube-player/tsconfig.json index 9718e040d9..a9e32d2b61 100644 --- a/types/youtube-player/tsconfig.json +++ b/types/youtube-player/tsconfig.json @@ -27,6 +27,7 @@ "dist/index.d.ts", "dist/loadYouTubeIframeApi.d.ts", "dist/types.d.ts", - "dist/YouTubePlayer.d.ts" + "dist/YouTubePlayer.d.ts", + "youtube-player-tests.ts" ] } From 84836f19357bfaac01749304c4cae0a1c2efe4c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jur=C4=8Da?= Date: Fri, 15 Feb 2019 10:43:57 +0100 Subject: [PATCH 077/155] fixed null issue in tests --- types/youtube-player/youtube-player-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/youtube-player/youtube-player-tests.ts b/types/youtube-player/youtube-player-tests.ts index ae23bc84de..df622b36aa 100644 --- a/types/youtube-player/youtube-player-tests.ts +++ b/types/youtube-player/youtube-player-tests.ts @@ -4,7 +4,7 @@ import { YouTubePlayer } from 'youtube-player/dist/types'; youTubePlayerFactory('foo'); const player: YouTubePlayer = youTubePlayerFactory( - document.getElementById('bar'), + document.getElementById('bar')!, { width: 640, height: 300, From c21085db2a9d6b7f8e7e86fff4cace0f70c83664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jur=C4=8Da?= Date: Fri, 15 Feb 2019 10:55:21 +0100 Subject: [PATCH 078/155] extended the tests, added missing API --- types/youtube-player/dist/types.d.ts | 2 ++ types/youtube-player/youtube-player-tests.ts | 33 ++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/types/youtube-player/dist/types.d.ts b/types/youtube-player/dist/types.d.ts index 340c7b7854..fa64feda04 100644 --- a/types/youtube-player/dist/types.d.ts +++ b/types/youtube-player/dist/types.d.ts @@ -137,4 +137,6 @@ export interface YouTubePlayer { setVolume(volume: number): void; stopVideo(): void; unMute(): void; + on(eventType: 'stateChange', listener: (event: CustomEvent & {data: number}) => void): void; + on(eventType: EventType, listener: (event: CustomEvent) => void): void; } diff --git a/types/youtube-player/youtube-player-tests.ts b/types/youtube-player/youtube-player-tests.ts index df622b36aa..cb60168cea 100644 --- a/types/youtube-player/youtube-player-tests.ts +++ b/types/youtube-player/youtube-player-tests.ts @@ -46,3 +46,36 @@ const player: YouTubePlayer = youTubePlayerFactory( }, true, ); + +player.cueVideoById('xyzabc123'); +player.loadVideoById('doesNotExist'); +player.playVideo(); +player.pauseVideo(); +player.setSize(320, 200); +if (player.isMuted()) { + player.unMute(); +} else { + player.mute(); +} +player.setVolume(player.getVolume() / 2); + +player.on('stateChange', (event: CustomEvent & {data: number}) => { + switch (event.data) { + case PlayerStates.PLAYING: + console.log('playing'); + break; + case PlayerStates.PAUSED: + console.log('paused'); + break; + case PlayerStates.ENDED: + console.log('ended'); + break; + default: + break; + } +}); +player.on('error', (event: CustomEvent) => { + console.error('player error', event.detail); +}); + +player.destroy(); From 9dbc92e9e905cd9c5cc8baad450583a991565d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jur=C4=8Da?= Date: Fri, 15 Feb 2019 11:04:06 +0100 Subject: [PATCH 079/155] generated the meta-files using dts-gen --dt --- types/youtube-player/index.d.ts | 3 +-- types/youtube-player/package.json | 5 ----- types/youtube-player/tsconfig.json | 6 ++---- types/youtube-player/tslint.json | 4 +--- 4 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 types/youtube-player/package.json diff --git a/types/youtube-player/index.d.ts b/types/youtube-player/index.d.ts index 1cdab56427..ecf606bce9 100644 --- a/types/youtube-player/index.d.ts +++ b/types/youtube-player/index.d.ts @@ -1,8 +1,7 @@ // Type definitions for youtube-player 5.5 -// Project: https://github.com/gajus/youtube-player +// Project: https://github.com/gajus/youtube-player#readme // Definitions by: Martin Jurča // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 import PlayerFactory from './dist/index'; diff --git a/types/youtube-player/package.json b/types/youtube-player/package.json deleted file mode 100644 index d0224c9efb..0000000000 --- a/types/youtube-player/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "private": true, - "dependencies": { - } -} diff --git a/types/youtube-player/tsconfig.json b/types/youtube-player/tsconfig.json index a9e32d2b61..a13a7ebc76 100644 --- a/types/youtube-player/tsconfig.json +++ b/types/youtube-player/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, @@ -15,8 +14,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "esModuleInterop": true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/types/youtube-player/tslint.json b/types/youtube-player/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/youtube-player/tslint.json +++ b/types/youtube-player/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } From 3b534be4d099d334b905d7be25dc27b4f7bab964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jur=C4=8Da?= Date: Fri, 15 Feb 2019 11:05:29 +0100 Subject: [PATCH 080/155] fixed configuration --- types/youtube-player/index.d.ts | 1 + types/youtube-player/tsconfig.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/youtube-player/index.d.ts b/types/youtube-player/index.d.ts index ecf606bce9..3e05adde80 100644 --- a/types/youtube-player/index.d.ts +++ b/types/youtube-player/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gajus/youtube-player#readme // Definitions by: Martin Jurča // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import PlayerFactory from './dist/index'; diff --git a/types/youtube-player/tsconfig.json b/types/youtube-player/tsconfig.json index a13a7ebc76..1abbcc804c 100644 --- a/types/youtube-player/tsconfig.json +++ b/types/youtube-player/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From 5fa4537382146a0f14642a86f28d2c3ede51ba30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jur=C4=8Da?= Date: Fri, 15 Feb 2019 11:06:32 +0100 Subject: [PATCH 081/155] updated typescript version requirement from 2.2 to 2.7 --- types/youtube-player/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/youtube-player/index.d.ts b/types/youtube-player/index.d.ts index 3e05adde80..f34f8e3505 100644 --- a/types/youtube-player/index.d.ts +++ b/types/youtube-player/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gajus/youtube-player#readme // Definitions by: Martin Jurča // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.7 import PlayerFactory from './dist/index'; From a6133c9cadf5697a985fe3510a7e40d5f7c5851f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Moln=C3=A1r?= Date: Fri, 15 Feb 2019 12:49:26 +0100 Subject: [PATCH 082/155] Update index.d.ts fix(Options): fix type of preserveAspectRatio --- types/react-lottie/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 */ From 040acad4340896be2dbfa5faac0a79cf170cfb4f Mon Sep 17 00:00:00 2001 From: lukostry Date: Fri, 15 Feb 2019 13:00:37 +0100 Subject: [PATCH 083/155] Do not use default export --- types/ink-text-input/index.d.ts | 6 ++++-- types/ink-text-input/ink-text-input-tests.tsx | 3 +++ types/ink-text-input/tsconfig.json | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/types/ink-text-input/index.d.ts b/types/ink-text-input/index.d.ts index 1d7192e1dc..9aaadd330e 100644 --- a/types/ink-text-input/index.d.ts +++ b/types/ink-text-input/index.d.ts @@ -6,7 +6,7 @@ import { Component } from 'ink'; -export interface TextInputProps { +interface TextInputProps { focus?: boolean; onChange?: (value: string) => void; onSubmit?: (value: string) => void; @@ -14,4 +14,6 @@ export interface TextInputProps { value?: string; } -export default class TextInput extends Component { } +declare class TextInput extends Component { } + +export = TextInput; diff --git a/types/ink-text-input/ink-text-input-tests.tsx b/types/ink-text-input/ink-text-input-tests.tsx index ada8ab3a83..82b63854a2 100644 --- a/types/ink-text-input/ink-text-input-tests.tsx +++ b/types/ink-text-input/ink-text-input-tests.tsx @@ -1,6 +1,9 @@ /** @jsx h */ import { h, Component } from 'ink'; import TextInput from 'ink-text-input'; +// NOTE: `import TextInput = require('ink-text-input');` will work as well +// For importing using ES6 default import as above, +// `allowSyntheticDefaultImports` flag in compiler options needs to be set to `true` interface QueryState { query: string; diff --git a/types/ink-text-input/tsconfig.json b/types/ink-text-input/tsconfig.json index f58efc92ff..2582b4325e 100644 --- a/types/ink-text-input/tsconfig.json +++ b/types/ink-text-input/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "allowSyntheticDefaultImports": true, "jsx": "react", "module": "commonjs", "lib": [ From e44ef37846ec95510ea3de1d804e72a6efae28be Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Fri, 15 Feb 2019 17:27:46 +0500 Subject: [PATCH 084/155] Small tweaks --- types/natural-compare-lite/tsconfig.json | 2 +- types/natural-compare/tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/natural-compare-lite/tsconfig.json b/types/natural-compare-lite/tsconfig.json index e3ed3ac1e0..ddfcb244cb 100644 --- a/types/natural-compare-lite/tsconfig.json +++ b/types/natural-compare-lite/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/natural-compare/tsconfig.json b/types/natural-compare/tsconfig.json index 81322d5590..c8af37bb22 100644 --- a/types/natural-compare/tsconfig.json +++ b/types/natural-compare/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ From d53f2f0a8e095ab1a925b02b23e76b2135c248aa Mon Sep 17 00:00:00 2001 From: Ulf Jaenicke-Roessler Date: Fri, 15 Feb 2019 13:34:30 +0100 Subject: [PATCH 085/155] Server property 'greeting' added --- types/ssh2/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/ssh2/index.d.ts b/types/ssh2/index.d.ts index cf88fff5f1..8e03805817 100644 --- a/types/ssh2/index.d.ts +++ b/types/ssh2/index.d.ts @@ -729,6 +729,8 @@ export interface ServerConfig { /** Explicit overrides for the default transport layer algorithms used for the connection. */ algorithms?: Algorithms; /** A message that is sent to clients immediately upon connection, before handshaking begins. */ + greeting?: string + /** A message that is sent to clients once, right before authentication begins. */ banner?: string; /** A custom server software name/version identifier. */ ident?: string; From 9d911851318f13bc76eb15a03a8712493a6c42bc Mon Sep 17 00:00:00 2001 From: Kyle Buzby Date: Fri, 15 Feb 2019 08:15:19 -0600 Subject: [PATCH 086/155] Add failing test for correct type --- types/postman-collection/postman-collection-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/postman-collection/postman-collection-tests.ts b/types/postman-collection/postman-collection-tests.ts index d203ed68f0..6b00083e74 100644 --- a/types/postman-collection/postman-collection-tests.ts +++ b/types/postman-collection/postman-collection-tests.ts @@ -137,7 +137,7 @@ igDef.event; // $ExpectType EventDefinition[] | undefined // ItemGroup Tests const ig = new pmCollection.ItemGroup(); ig.auth; // $ExpectType RequestAuth | undefined -ig.items; // $ExpectType PropertyList +ig.items; // $ExpectType PropertyList> ig.events; // $ExpectType EventList ig.authorizeRequestsUsing("string"); // $ExpectType void From cd0ba3d1a2a24f958a3508ca46a7b30f0122d130 Mon Sep 17 00:00:00 2001 From: Kyle Buzby Date: Fri, 15 Feb 2019 08:15:27 -0600 Subject: [PATCH 087/155] Fix type on items --- types/postman-collection/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/postman-collection/index.d.ts b/types/postman-collection/index.d.ts index 7a05c39128..0b32209b4f 100644 --- a/types/postman-collection/index.d.ts +++ b/types/postman-collection/index.d.ts @@ -154,7 +154,7 @@ export interface ItemGroupDefinition extends PropertyDefinition { export class ItemGroup extends Property { auth?: RequestAuth; - items: PropertyList; + items: PropertyList>; events: EventList; constructor(definition?: ItemGroupDefinition); From faf67489b44a73fcf8da71c04fbb6e17f97c5f72 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 15 Feb 2019 21:02:09 +0500 Subject: [PATCH 088/155] Improve return types Co-Authored-By: doniyor2109 --- types/natural-compare-lite/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/natural-compare-lite/index.d.ts b/types/natural-compare-lite/index.d.ts index 414dcf9233..9811d4baa8 100644 --- a/types/natural-compare-lite/index.d.ts +++ b/types/natural-compare-lite/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Doniyor Aliyev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function naturalCompare(a: string, b: string): number; +declare function naturalCompare(a: string, b: string): -1 | 0 | 1; declare global { interface StringConstructor { From 557883080b6c4aec5c8df5b1660a2796e38ae13b Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Fri, 15 Feb 2019 21:05:24 +0500 Subject: [PATCH 089/155] Improve return type --- types/natural-compare/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/natural-compare/index.d.ts b/types/natural-compare/index.d.ts index d5bd9a6ee5..fb4fdecfe0 100644 --- a/types/natural-compare/index.d.ts +++ b/types/natural-compare/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Doniyor Aliyev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function naturalCompare(a: string, b: string): number; +declare function naturalCompare(a: string, b: string): -1 | 0 | 1; declare global { interface StringConstructor { From 5bf8b8f9edf8474fad3e937cccb8d990ff2a9c38 Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Fri, 15 Feb 2019 21:06:08 +0500 Subject: [PATCH 090/155] Remove String.naturalCompare --- types/natural-compare-lite/index.d.ts | 6 ------ types/natural-compare-lite/natural-compare-lite-tests.ts | 2 -- types/natural-compare/index.d.ts | 6 ------ types/natural-compare/natural-compare-tests.ts | 2 -- 4 files changed, 16 deletions(-) diff --git a/types/natural-compare-lite/index.d.ts b/types/natural-compare-lite/index.d.ts index 9811d4baa8..d9dd5f3e6d 100644 --- a/types/natural-compare-lite/index.d.ts +++ b/types/natural-compare-lite/index.d.ts @@ -5,10 +5,4 @@ declare function naturalCompare(a: string, b: string): -1 | 0 | 1; -declare global { - interface StringConstructor { - naturalCompare: typeof naturalCompare; - } -} - export = naturalCompare; diff --git a/types/natural-compare-lite/natural-compare-lite-tests.ts b/types/natural-compare-lite/natural-compare-lite-tests.ts index dd823544fb..c82a695344 100644 --- a/types/natural-compare-lite/natural-compare-lite-tests.ts +++ b/types/natural-compare-lite/natural-compare-lite-tests.ts @@ -1,5 +1,3 @@ import compare = require("natural-compare-lite"); ['a', 's', 'd'].sort(compare); - -['a', 's', 'd'].sort(String.naturalCompare); diff --git a/types/natural-compare/index.d.ts b/types/natural-compare/index.d.ts index fb4fdecfe0..bb26b925f7 100644 --- a/types/natural-compare/index.d.ts +++ b/types/natural-compare/index.d.ts @@ -5,10 +5,4 @@ declare function naturalCompare(a: string, b: string): -1 | 0 | 1; -declare global { - interface StringConstructor { - naturalCompare: typeof naturalCompare; - } -} - export = naturalCompare; diff --git a/types/natural-compare/natural-compare-tests.ts b/types/natural-compare/natural-compare-tests.ts index 91a4710c15..d006905f47 100644 --- a/types/natural-compare/natural-compare-tests.ts +++ b/types/natural-compare/natural-compare-tests.ts @@ -1,5 +1,3 @@ import compare = require("natural-compare"); ['a', 's', 'd'].sort(compare); - -['a', 's', 'd'].sort(String.naturalCompare); From ac4cae1d50f4c974b26d74f4a5a5b8e43a3c057e Mon Sep 17 00:00:00 2001 From: Pete Date: Fri, 15 Feb 2019 08:24:46 -0800 Subject: [PATCH 091/155] Bump TS to 2.3 --- types/theo/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/theo/index.d.ts b/types/theo/index.d.ts index 3735da3e0c..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"; From 13e5adb7316608652482a795d0b01585b195a046 Mon Sep 17 00:00:00 2001 From: Steven Bell Date: Fri, 15 Feb 2019 08:33:41 -0800 Subject: [PATCH 092/155] Make parameters optional in accordance with spec. --- types/cassandra-driver/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/cassandra-driver/index.d.ts b/types/cassandra-driver/index.d.ts index 6cedde4342..86073ec888 100644 --- a/types/cassandra-driver/index.d.ts +++ b/types/cassandra-driver/index.d.ts @@ -116,7 +116,7 @@ export namespace policies { onUnavailable(requestInfo: RequestInfo, consistency: types.consistencies, required: number, alive: number): DecisionInfo; onWriteTimeout(requestInfo: RequestInfo, consistency: types.consistencies, received: number, blockFor: number, writeType: string): DecisionInfo; rethrowResult(): { decision: retryDecision }; - retryResult(consistency: types.consistencies, useCurrentHost: boolean): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean }; + retryResult(consistency?: types.consistencies, useCurrentHost?: boolean): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean }; } } From 2e848e713fd20321efa645e8b55d79d631591864 Mon Sep 17 00:00:00 2001 From: Nadun Indunil Date: Fri, 15 Feb 2019 23:06:17 +0530 Subject: [PATCH 093/155] fix: default export --- types/node-jose/index.d.ts | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/types/node-jose/index.d.ts b/types/node-jose/index.d.ts index 92e312352f..dc4caaeca5 100644 --- a/types/node-jose/index.d.ts +++ b/types/node-jose/index.d.ts @@ -301,17 +301,16 @@ export namespace JWS { } } -interface ParseReturn { - type: 'JWS' | 'JWE'; - format: 'compact' | 'json'; - input: Buffer | string | object; - header: object; - perform: (ks: JWK.KeyStore) => Promise | Promise; -} - -export function parse(input: Buffer | string | object): ParseReturn; +export function parse(input: Buffer | string | object): parse.ParseReturn; export namespace parse { + interface ParseReturn { + type: 'JWS' | 'JWE'; + format: 'compact' | 'json'; + input: Buffer | string | object; + header: object; + perform: (ks: JWK.KeyStore) => Promise | Promise; + } function compact(input: Buffer | string | object): ParseReturn; function json(input: Buffer | string | object): ParseReturn; @@ -334,13 +333,3 @@ export namespace util { function encode(input: string): string; } } - -declare const _default: { - JWA: typeof JWA; - JWE: typeof JWE; - JWS: typeof JWS; - JWK: typeof JWK; - parse: typeof parse; - util: typeof util; -}; -export default _default; From f3e63b2691452497c99b213e84e20eb43803f849 Mon Sep 17 00:00:00 2001 From: Pete Date: Fri, 15 Feb 2019 10:57:30 -0800 Subject: [PATCH 094/155] Disable 'no-unnecessary-generics' rule --- types/theo/tslint.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 + } +} From 4059f8e4f9417d51a161b1c3d5887ccca9d3d2ab Mon Sep 17 00:00:00 2001 From: Adam Vigneaux Date: Fri, 15 Feb 2019 13:44:08 -0500 Subject: [PATCH 095/155] Update jsoneditor types to match version 5.28.2 --- types/jsoneditor/index.d.ts | 177 ++++++++++++++++++++++++--- types/jsoneditor/jsoneditor-tests.ts | 10 +- types/jsoneditor/package.json | 6 + 3 files changed, 173 insertions(+), 20 deletions(-) create mode 100644 types/jsoneditor/package.json 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": "*" + } +} From 2cc88d04eecc2dd35f7b6d16d12cf1a8ebee36f4 Mon Sep 17 00:00:00 2001 From: Aaron Rosen Date: Fri, 15 Feb 2019 14:50:46 -0500 Subject: [PATCH 096/155] ReactNavigation: Exposes NavigationContext type. --- types/react-navigation/index.d.ts | 5 ++++- types/react-navigation/react-navigation-tests.tsx | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) 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 => ( + + ) + } + +); From 2ba42e115c8e0c31c1347f2edd7e36e5c4a07526 Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Fri, 15 Feb 2019 15:55:40 -0800 Subject: [PATCH 097/155] Adding note about Worksheet.delete behavior --- types/office-js-preview/index.d.ts | 2 +- types/office-js/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 2d47452bd3..45e991646f 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -22712,7 +22712,7 @@ declare namespace Excel { copy(positionType?: "None" | "Before" | "After" | "Beginning" | "End", relativeTo?: Excel.Worksheet): Excel.Worksheet; /** * - * Deletes the worksheet from the workbook. + * Deletes the worksheet from the workbook. Note that if the worksheet's visibility is set to "VeryHidden", the delete operation will fail with a GeneralException. * * [Api set: ExcelApi 1.1] */ diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index de27fd1ea5..d6aef3d1c9 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -21968,7 +21968,7 @@ declare namespace Excel { copy(positionType?: "None" | "Before" | "After" | "Beginning" | "End", relativeTo?: Excel.Worksheet): Excel.Worksheet; /** * - * Deletes the worksheet from the workbook. + * Deletes the worksheet from the workbook. Note that if the worksheet's visibility is set to "VeryHidden", the delete operation will fail with a GeneralException. * * [Api set: ExcelApi 1.1] */ From c0d2eaeb4e6a704e6e9ba5c22e3378bddaddaf52 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Fri, 15 Feb 2019 16:24:59 -0800 Subject: [PATCH 098/155] [office-js] [office-js-preview] (Outlook) Add missing options overloads --- types/office-js-preview/index.d.ts | 353 ++++++++++++++++++++++++++++- types/office-js/index.d.ts | 353 ++++++++++++++++++++++++++++- 2 files changed, 694 insertions(+), 12 deletions(-) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 2d47452bd3..47943e34b6 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -10928,6 +10928,32 @@ declare namespace Office { * @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; + /** + * 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. + * @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. + * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. + * @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?: CoercionTypeOptions): void; /** * Replaces the entire body with the specified text. * @@ -11004,6 +11030,34 @@ declare namespace Office { * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. */ setAsync(data: string): 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. + * @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. + * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. + * @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?: CoercionTypeOptions): void; /** * Replaces the selection in the body with the specified text. @@ -11081,6 +11135,31 @@ declare namespace Office { * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. */ setSelectedDataAsync(data: string): 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. + * @param options - Optional. An object literal that contains one or more of the following properties. + * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. + */ + setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; } /** * Represents a contact stored on the server. Read mode only. @@ -12267,7 +12346,7 @@ declare namespace Office { * 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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12315,6 +12394,30 @@ declare namespace Office { * 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; + /** + * 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 options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12344,7 +12447,7 @@ declare namespace Office { * * @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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12396,6 +12499,32 @@ declare namespace Office { * @beta */ addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): 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. + * @param options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. + * + * @beta + */ + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): void; /** * Adds an event handler for a supported event. * @@ -13108,6 +13237,35 @@ declare namespace Office { * type Office.AsyncResult. */ setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): 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 options - Optional. An object literal that contains one or more of the following properties. + * 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. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the + * default style is 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. + */ + setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; } /** @@ -14531,7 +14689,7 @@ declare namespace Office { * 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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14580,6 +14738,31 @@ declare namespace Office { * the error. */ addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): 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 options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the + * attachment list. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }, callback?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. @@ -14610,7 +14793,7 @@ declare namespace Office { * * @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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14662,6 +14845,32 @@ declare namespace Office { * @beta */ addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): 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. + * @param options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. + * + * @beta + */ + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. @@ -15237,6 +15446,35 @@ declare namespace Office { * type Office.AsyncResult. */ setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): 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 options - Optional. An object literal that contains one or more of the following properties. + * 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. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is + * 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. + */ + setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; } /** * The read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -15994,7 +16232,7 @@ declare namespace Office { * 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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16043,6 +16281,31 @@ declare namespace Office { * the error. */ addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): 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 options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the + * attachment list. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16072,7 +16335,7 @@ declare namespace Office { * * @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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16100,6 +16363,56 @@ declare namespace Office { * @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}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 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; + /** + * 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}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 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 options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. + * + * @beta + */ + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): void; /** * Adds an event handler for a supported event. * @@ -16825,6 +17138,34 @@ declare namespace Office { * type Office.AsyncResult. */ setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): 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 options - Optional. An object literal that contains one or more of the following properties. + * 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. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is + * 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. + */ + setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; } /** * The message read mode of {@link Office.Item | Office.context.mailbox.item}. diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index de27fd1ea5..6c38874334 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -10928,6 +10928,32 @@ declare namespace Office { * @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; + /** + * 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. + * @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. + * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. + * @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?: CoercionTypeOptions): void; /** * Replaces the entire body with the specified text. * @@ -11004,6 +11030,34 @@ declare namespace Office { * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. */ setAsync(data: string): 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. + * @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. + * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. + * @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?: CoercionTypeOptions): void; /** * Replaces the selection in the body with the specified text. @@ -11081,6 +11135,31 @@ declare namespace Office { * @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters. */ setSelectedDataAsync(data: string): 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. + * @param options - Optional. An object literal that contains one or more of the following properties. + * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. + */ + setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; } /** * Represents a contact stored on the server. Read mode only. @@ -12267,7 +12346,7 @@ declare namespace Office { * 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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12315,6 +12394,30 @@ declare namespace Office { * 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; + /** + * 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 options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12344,7 +12447,7 @@ declare namespace Office { * * @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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12396,6 +12499,32 @@ declare namespace Office { * @beta */ addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): 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. + * @param options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. + * + * @beta + */ + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): void; /** * Adds an event handler for a supported event. * @@ -13108,6 +13237,35 @@ declare namespace Office { * type Office.AsyncResult. */ setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): 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 options - Optional. An object literal that contains one or more of the following properties. + * 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. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the + * default style is 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. + */ + setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; } /** @@ -14531,7 +14689,7 @@ declare namespace Office { * 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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14580,6 +14738,31 @@ declare namespace Office { * the error. */ addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): 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 options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the + * attachment list. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }, callback?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. @@ -14610,7 +14793,7 @@ declare namespace Office { * * @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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -14662,6 +14845,32 @@ declare namespace Office { * @beta */ addFileAttachmentFromBase64Async(base64File: string, attachmentName: string): 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. + * @param options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. + * + * @beta + */ + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): void; /** * Adds an Exchange item, such as a message, as an attachment to the message or appointment. @@ -15237,6 +15446,35 @@ declare namespace Office { * type Office.AsyncResult. */ setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): 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 options - Optional. An object literal that contains one or more of the following properties. + * 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. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is + * 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. + */ + setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; } /** * The read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -15994,7 +16232,7 @@ declare namespace Office { * 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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16043,6 +16281,31 @@ declare namespace Office { * the error. */ addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: Office.AsyncResult) => void): 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 options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the + * attachment list. + */ + addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16072,7 +16335,7 @@ declare namespace Office { * * @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?: (result: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16100,6 +16363,56 @@ declare namespace Office { * @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}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 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; + /** + * 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}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 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 options - Optional. An object literal that contains one or more of the following properties. + * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. + * + * @beta + */ + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): void; /** * Adds an event handler for a supported event. * @@ -16825,6 +17138,34 @@ declare namespace Office { * type Office.AsyncResult. */ setSelectedDataAsync(data: string, callback: (result: Office.AsyncResult) => void): 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 options - Optional. An object literal that contains one or more of the following properties. + * 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. + * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is + * 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. + */ + setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; } /** * The message read mode of {@link Office.Item | Office.context.mailbox.item}. From cfc6453c4b625b7d9ecacb992812adf591884955 Mon Sep 17 00:00:00 2001 From: neryortez Date: Fri, 15 Feb 2019 22:13:03 -0600 Subject: [PATCH 099/155] Search Response made generic Response made generic to allow better linting on the items of the `Reponse` --- types/algoliasearch/index.d.ts | 23 ++++++++++++----------- types/algoliasearch/lite/index.d.ts | 23 ++++++++++++----------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 5478fedbac..87eb319f67 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 @@ -1778,12 +1779,12 @@ declare namespace algoliasearch { camelCaseAttributes?: string[]; } - 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 +1843,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..20cfae4a05 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/ @@ -552,12 +553,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 +617,8 @@ declare namespace algoliasearch { cursor?: string; } - interface MultiResponse { - results: Response[]; + interface MultiResponse { + results: Response[]; } } From e80d3467c533ca24cfddd3c1217ed3d8af2d7cda Mon Sep 17 00:00:00 2001 From: "Jonathan M. Wilbur" Date: Sat, 16 Feb 2019 05:46:29 -0500 Subject: [PATCH 100/155] Improved Serverless types --- types/serverless/classes/PluginManager.d.ts | 1 + types/serverless/classes/Service.d.ts | 5 +++++ types/serverless/index.d.ts | 17 +++++++++++++++++ 3 files changed, 23 insertions(+) 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 { From 50cd191181c49bcf9948e5b76a22a11d810b72cb Mon Sep 17 00:00:00 2001 From: antoinebrault Date: Sat, 16 Feb 2019 10:40:10 -0500 Subject: [PATCH 101/155] [jest] fix test --- types/jest/jest-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 11b3752a0a..b442e6825b 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -316,7 +316,7 @@ interface TestApi { test(x: number): string; } // $ExpectType Mock -const mock12 = jest.fn, ArgsType>(); +const mock12 = jest.fn, jest.ArgsType>(); // $ExpectType number mock1('test'); From 926c4af83592650bf775195a52b8f3d954c6a3fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sat, 16 Feb 2019 17:20:53 +0100 Subject: [PATCH 102/155] fix(mongoose): fix sslValidate type --- types/mongoose/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 267163ac80..2a01b58a95 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) */ From 743fc6f72c1eff0159021588bf23c60c5ad8b480 Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Sat, 16 Feb 2019 21:30:24 +0500 Subject: [PATCH 103/155] Added co --- types/co/co-tests.ts | 21 +++++++++++++++++++++ types/co/index.d.ts | 17 +++++++++++++++++ types/co/tsconfig.json | 22 ++++++++++++++++++++++ types/co/tslint.json | 1 + 4 files changed, 61 insertions(+) create mode 100644 types/co/co-tests.ts create mode 100644 types/co/index.d.ts create mode 100644 types/co/tsconfig.json create mode 100644 types/co/tslint.json diff --git a/types/co/co-tests.ts b/types/co/co-tests.ts new file mode 100644 index 0000000000..b610b280aa --- /dev/null +++ b/types/co/co-tests.ts @@ -0,0 +1,21 @@ +import co = require('co'); + +function* gen(num: number, str: string, arr: number[], obj: object, fun: () => void){ + return num; +} + +co(gen, 42, 'forty-two', [42], { value: 42 }, function () {}) + .then((num: number) => {}, (err: Error) => {}) + .catch((err: Error) => {}); + +co.default(gen, 42, 'forty-two', [42], { value: 42 }, function () {}) + .then((num: number) => {}, (err: Error) => {}) + .catch((err: Error) => {}); + +co.co(gen, 42, 'forty-two', [42], { value: 42 }, function () {}) + .then((num: number) => {}, (err: Error) => {}) + .catch((err: Error) => {}); + +co.wrap(gen)(42, 'forty-two', [42], { value: 42 }, function () {}) + .then((num: number) => {}, (err: Error) => {}) + .catch((err: Error) => {}); diff --git a/types/co/index.d.ts b/types/co/index.d.ts new file mode 100644 index 0000000000..0be8976a5f --- /dev/null +++ b/types/co/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for co 4.6 +// Project: https://github.com/tj/co#readme +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type ExtractType = T extends IterableIterator ? R : never; + +interface Co { + Generator>(fn: F, ...args: Parameters): Promise>>; + default: Co; + co: Co; + wrap: Generator>(fn: F) => (...args: Parameters) => Promise>>; +} + +declare const co: Co; + +export = co; diff --git a/types/co/tsconfig.json b/types/co/tsconfig.json new file mode 100644 index 0000000000..dd6af28a07 --- /dev/null +++ b/types/co/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "co-tests.ts" + ] +} diff --git a/types/co/tslint.json b/types/co/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/co/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From fb4d0a9066e2dbd1730657f46173432ea1168f1c Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Sat, 16 Feb 2019 21:37:09 +0500 Subject: [PATCH 104/155] Linter fixes --- types/co/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/co/tsconfig.json b/types/co/tsconfig.json index dd6af28a07..bc5a88eb32 100644 --- a/types/co/tsconfig.json +++ b/types/co/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 3316c2a06c9309219e710daa6f72e1476eee1681 Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Sat, 16 Feb 2019 21:41:45 +0500 Subject: [PATCH 105/155] Linter fixes --- types/co/co-tests.ts | 10 +++++----- types/co/index.d.ts | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/types/co/co-tests.ts b/types/co/co-tests.ts index b610b280aa..7348f77394 100644 --- a/types/co/co-tests.ts +++ b/types/co/co-tests.ts @@ -1,21 +1,21 @@ import co = require('co'); -function* gen(num: number, str: string, arr: number[], obj: object, fun: () => void){ +function* gen(num: number, str: string, arr: number[], obj: object, fun: () => void) { return num; } -co(gen, 42, 'forty-two', [42], { value: 42 }, function () {}) +co(gen, 42, 'forty-two', [42], { value: 42 }, () => {}) .then((num: number) => {}, (err: Error) => {}) .catch((err: Error) => {}); -co.default(gen, 42, 'forty-two', [42], { value: 42 }, function () {}) +co.default(gen, 42, 'forty-two', [42], { value: 42 }, () => {}) .then((num: number) => {}, (err: Error) => {}) .catch((err: Error) => {}); -co.co(gen, 42, 'forty-two', [42], { value: 42 }, function () {}) +co.co(gen, 42, 'forty-two', [42], { value: 42 }, () => {}) .then((num: number) => {}, (err: Error) => {}) .catch((err: Error) => {}); -co.wrap(gen)(42, 'forty-two', [42], { value: 42 }, function () {}) +co.wrap(gen)(42, 'forty-two', [42], { value: 42 }, () => {}) .then((num: number) => {}, (err: Error) => {}) .catch((err: Error) => {}); diff --git a/types/co/index.d.ts b/types/co/index.d.ts index 0be8976a5f..59fafd2495 100644 --- a/types/co/index.d.ts +++ b/types/co/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/tj/co#readme // Definitions by: My Self // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.1 type ExtractType = T extends IterableIterator ? R : never; From 932ca670c23e5c64675197f909e53833539bc930 Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Sat, 16 Feb 2019 21:44:01 +0500 Subject: [PATCH 106/155] Set author name --- types/co/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/co/index.d.ts b/types/co/index.d.ts index 59fafd2495..958c222a14 100644 --- a/types/co/index.d.ts +++ b/types/co/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for co 4.6 // Project: https://github.com/tj/co#readme -// Definitions by: My Self +// Definitions by: Doniyor Aliyev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.1 From f756a4887d5c87fe0e7019e55cce4320b02a2c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20D=C3=BCfel?= Date: Sat, 16 Feb 2019 17:46:55 +0100 Subject: [PATCH 107/155] [bull] Queue extends EventEmitter --- types/bull/bull-tests.tsx | 2 ++ types/bull/index.d.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) 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 */ From 7413c61ef88abd5ac80280e1909d1dcd0a5f6725 Mon Sep 17 00:00:00 2001 From: Jessica Franco Date: Sun, 17 Feb 2019 02:17:42 +0900 Subject: [PATCH 108/155] Also add equivalent declaration to LineSegments --- types/three/three-core.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 34ac8cc1c5..a2bcd4e60a 100755 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -5273,7 +5273,7 @@ export class Line extends Object3D { geometry: Geometry | BufferGeometry; material: Material | Material[]; - type: "Line" | "LineLoop"; + type: "Line" | "LineLoop" | "LineSegments"; isLine: true; computeLineDistances(): this; @@ -5305,6 +5305,9 @@ export class LineSegments extends Line { material?: Material | Material[], mode?: number ); + + type: "LineSegments"; + isLineSegments: true; } export class Mesh extends Object3D { From 9104726fb6496af489492deda3d5f054c08a29ae Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Sat, 16 Feb 2019 22:34:51 +0500 Subject: [PATCH 109/155] Added error tests --- types/co/co-tests.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/types/co/co-tests.ts b/types/co/co-tests.ts index 7348f77394..b4459a1df2 100644 --- a/types/co/co-tests.ts +++ b/types/co/co-tests.ts @@ -19,3 +19,12 @@ co.co(gen, 42, 'forty-two', [42], { value: 42 }, () => {}) co.wrap(gen)(42, 'forty-two', [42], { value: 42 }, () => {}) .then((num: number) => {}, (err: Error) => {}) .catch((err: Error) => {}); + +// $ExpectError +co(gen, 42, 'forty-two', [42], { value: 42 }, () => {}).then((str: string) => {}) + +// $ExpectError +co.wrap(gen)(); + +// $ExpectError +co.wrap(gen)('forty-two'); From 05bf4abb6d526f509dad16505a9bdf058a4867c4 Mon Sep 17 00:00:00 2001 From: doniyor2109 Date: Sat, 16 Feb 2019 22:37:37 +0500 Subject: [PATCH 110/155] Fixes --- types/co/co-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/co/co-tests.ts b/types/co/co-tests.ts index b4459a1df2..159a2e90fb 100644 --- a/types/co/co-tests.ts +++ b/types/co/co-tests.ts @@ -21,7 +21,7 @@ co.wrap(gen)(42, 'forty-two', [42], { value: 42 }, () => {}) .catch((err: Error) => {}); // $ExpectError -co(gen, 42, 'forty-two', [42], { value: 42 }, () => {}).then((str: string) => {}) +co(gen, 42, 'forty-two', [42], { value: 42 }, () => {}).then((str: string) => {}); // $ExpectError co.wrap(gen)(); From 8209fca1342587edd536c44d99056f31a4bf61d3 Mon Sep 17 00:00:00 2001 From: Seth Kingsley Date: Sat, 16 Feb 2019 14:17:47 -0800 Subject: [PATCH 111/155] Remove myself from the contributor list Sorry, trying to cut down on notifications... --- types/three/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/three/index.d.ts b/types/three/index.d.ts index 420d48fe67..f929ef2383 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -17,7 +17,6 @@ // Daniel Hritzkiv , // Apurva Ojas , // Tiger Oakes , -// Seth Kingsley , // Ethan Kay , // Methuselah96 // Dilip Ramirez From 0c02ca4f738975b2d1d28965d593083e4c9ecc61 Mon Sep 17 00:00:00 2001 From: Ting-Wai To Date: Sun, 17 Feb 2019 01:13:42 -0800 Subject: [PATCH 112/155] [ioredis] Add xadd definitions to support MAXLEN argument --- types/ioredis/index.d.ts | 2 ++ types/ioredis/ioredis-tests.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index d5f829c8fe..743c3c061a 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -489,6 +489,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; diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index 9950a8543f..89e4120f0e 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -177,6 +177,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', '$'); From e8a4ac87c40a19385f181a22baec5fb1887238b1 Mon Sep 17 00:00:00 2001 From: Shireesha Bongarala Date: Sun, 17 Feb 2019 18:55:48 +0530 Subject: [PATCH 113/155] Add missing definition for "sortFacetValuesBy" in QueryParameters. Fixes https://github.com/DefinitelyTyped/DefinitelyTyped/issues/32761 --- types/algoliasearch/algoliasearch-tests.ts | 1 + types/algoliasearch/index.d.ts | 5 +++++ types/algoliasearch/lite/index.d.ts | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 92c090d179..e650013a06 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -150,6 +150,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..b56ca9872f 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1451,6 +1451,11 @@ declare namespace algoliasearch { nbShards?: number; userData?: string | object; + + /** + * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ + */ + sortFacetValuesBy: 'count' | 'alpha' } namespace SearchForFacetValues { diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index ce58d6a428..29c22ad0e3 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -531,6 +531,11 @@ declare namespace algoliasearch { nbShards?: number; userData?: string | object; + + /** + * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ + */ + sortFacetValuesBy: 'count' | 'alpha' } namespace SearchForFacetValues { From 99e6d86abb0fb705a0016300ebe0a689c0f861a7 Mon Sep 17 00:00:00 2001 From: Shireesha Bongarala Date: Sun, 17 Feb 2019 20:43:29 +0530 Subject: [PATCH 114/155] Add missing semi-colons --- types/algoliasearch/index.d.ts | 2 +- types/algoliasearch/lite/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index b56ca9872f..2baf12c0e8 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1455,7 +1455,7 @@ declare namespace algoliasearch { /** * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ */ - sortFacetValuesBy: 'count' | 'alpha' + sortFacetValuesBy: 'count' | 'alpha'; } namespace SearchForFacetValues { diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index 29c22ad0e3..3617ae91a0 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -535,7 +535,7 @@ declare namespace algoliasearch { /** * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ */ - sortFacetValuesBy: 'count' | 'alpha' + sortFacetValuesBy: 'count' | 'alpha'; } namespace SearchForFacetValues { From b0aeee8dbd380eedca7462082928b0f0ca70d068 Mon Sep 17 00:00:00 2001 From: Shireesha Bongarala Date: Sun, 17 Feb 2019 20:53:10 +0530 Subject: [PATCH 115/155] Make query param non-mandatory --- types/algoliasearch/index.d.ts | 2 +- types/algoliasearch/lite/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 2baf12c0e8..e799ee1832 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1455,7 +1455,7 @@ declare namespace algoliasearch { /** * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ */ - sortFacetValuesBy: 'count' | 'alpha'; + sortFacetValuesBy?: "count"|"alpha"; } namespace SearchForFacetValues { diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index 3617ae91a0..a3babc339b 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -535,7 +535,7 @@ declare namespace algoliasearch { /** * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ */ - sortFacetValuesBy: 'count' | 'alpha'; + sortFacetValuesBy?: "count"|"alpha"; } namespace SearchForFacetValues { From a00dd21472918ead56cd419b20dc4d20de20421a Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Sun, 17 Feb 2019 16:48:40 +0100 Subject: [PATCH 116/155] Allow to pass numbers to parse-unit --- types/parse-unit/index.d.ts | 2 +- types/parse-unit/parse-unit-tests.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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] === ''; From ffcc092765c3735e1e63be5d58233ef79e0dd97d Mon Sep 17 00:00:00 2001 From: Erik Beuschau Date: Sun, 17 Feb 2019 21:04:26 +0100 Subject: [PATCH 117/155] Allow any for value prop on MenuItem --- types/react-aria-menubutton/index.d.ts | 2 +- .../react-aria-menubutton-tests.tsx | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/types/react-aria-menubutton/index.d.ts b/types/react-aria-menubutton/index.d.ts index 157fdff642..0d03c392e8 100644 --- a/types/react-aria-menubutton/index.d.ts +++ b/types/react-aria-menubutton/index.d.ts @@ -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..7237872d62 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); \ No newline at end of file From 989ead7dfe53f135004309167f14d723aab17bdb Mon Sep 17 00:00:00 2001 From: Erik Beuschau Date: Sun, 17 Feb 2019 21:12:11 +0100 Subject: [PATCH 118/155] Increase version and fix linter issues --- types/react-aria-menubutton/index.d.ts | 2 +- types/react-aria-menubutton/react-aria-menubutton-tests.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/react-aria-menubutton/index.d.ts b/types/react-aria-menubutton/index.d.ts index 0d03c392e8..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 diff --git a/types/react-aria-menubutton/react-aria-menubutton-tests.tsx b/types/react-aria-menubutton/react-aria-menubutton-tests.tsx index 7237872d62..e3b543103a 100644 --- a/types/react-aria-menubutton/react-aria-menubutton-tests.tsx +++ b/types/react-aria-menubutton/react-aria-menubutton-tests.tsx @@ -124,15 +124,15 @@ openMenu("", { focusMenu: true }); class ObjectMenuItem extends React.Component { render() { - const itemValue = { name: "Test name", label: "Only item to select" } + const itemValue = { name: "Test name", label: "Only item to select" }; return ( console.log(value.name)}>
  • {itemValue.label}
  • - ) + ); } } -ReactDOM.render(, document.body); \ No newline at end of file +ReactDOM.render(, document.body); From 61f90800242951f50e0ad5f2d0d4adfe9681651e Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Mon, 18 Feb 2019 11:06:25 +0100 Subject: [PATCH 119/155] Allow async methods as adapter event handlers --- types/iobroker/index.d.ts | 10 +++++----- types/iobroker/iobroker-tests.ts | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/types/iobroker/index.d.ts b/types/iobroker/index.d.ts index 0075f8a273..9f18c77e80 100644 --- a/types/iobroker/index.d.ts +++ b/types/iobroker/index.d.ts @@ -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; diff --git a/types/iobroker/iobroker-tests.ts b/types/iobroker/iobroker-tests.ts index a2c89cb893..4126f172c2 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) { From 7be1cdad6de6b71ff107d70aa85beb727c959677 Mon Sep 17 00:00:00 2001 From: Laurin Quast Date: Mon, 18 Feb 2019 11:54:11 +0100 Subject: [PATCH 120/155] fix(react-native): add missing properties to type Rationale Add missing types as documented here: https://facebook.github.io/react-native/docs/permissionsandroid --- types/react-native/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 99865ac3be..0cee14dfd2 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -7662,6 +7662,9 @@ export interface PanResponderStatic { export interface Rationale { title: string; message: string; + buttonPositive: string; + buttonNegative?: string; + buttonNeutral?: string; } export type Permission = From 915c23637e1927d2c95a1c3d32e6aacf6427fa3e Mon Sep 17 00:00:00 2001 From: Kevin Montag Date: Mon, 18 Feb 2019 11:49:18 +0100 Subject: [PATCH 121/155] Add null to possible return types of interval intersection --- types/luxon/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From 88a3b15d7970375349d23796b2c6ec8b09cb8090 Mon Sep 17 00:00:00 2001 From: Kevin Montag Date: Mon, 18 Feb 2019 12:08:20 +0100 Subject: [PATCH 122/155] Add tests for intersection --- types/luxon/luxon-tests.ts | 1 + 1 file changed, 1 insertion(+) 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 From 85df9ca5470c3ed5d67650269e75036dcd64b31c Mon Sep 17 00:00:00 2001 From: massimonewsuk <35228622+massimonewsuk@users.noreply.github.com> Date: Mon, 18 Feb 2019 11:41:24 +0000 Subject: [PATCH 123/155] Sequelize - add missing `separate` option on IncludeOptions As per http://docs.sequelizejs.com/class/lib/model.js~Model.html --- types/sequelize/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 5d1131684c..46da146939 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; } /** From 7d1bb67c83f9faf77bf199245307de3777295a76 Mon Sep 17 00:00:00 2001 From: massimonewsuk <35228622+massimonewsuk@users.noreply.github.com> Date: Mon, 18 Feb 2019 12:13:59 +0000 Subject: [PATCH 124/155] Update index.d.ts --- types/sequelize/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 46da146939..ee9b9ad629 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -6515,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; + } // From 0e9b6e6a4a4de3b3115d73346b00002d2fba129a Mon Sep 17 00:00:00 2001 From: massimonewsuk <35228622+massimonewsuk@users.noreply.github.com> Date: Mon, 18 Feb 2019 12:16:58 +0000 Subject: [PATCH 125/155] Update index.d.ts --- types/sequelize/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index ee9b9ad629..725eea73e4 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -5774,7 +5774,7 @@ declare namespace sequelize { /** * A reference to the deferrable collection. Use this to access the different deferrable options. */ - Deferrable: Deferrable; + deferrable?: Deferrable[keyof Deferrable]; /** * A reference to the sequelize instance class. From 261231ba7b5725b4513619987f146eec32f1cff7 Mon Sep 17 00:00:00 2001 From: massimonewsuk <35228622+massimonewsuk@users.noreply.github.com> Date: Mon, 18 Feb 2019 12:18:01 +0000 Subject: [PATCH 126/155] Update index.d.ts --- types/sequelize/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 725eea73e4..d89dac0d4a 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -5774,7 +5774,7 @@ declare namespace sequelize { /** * A reference to the deferrable collection. Use this to access the different deferrable options. */ - deferrable?: Deferrable[keyof Deferrable]; + Deferrable: Deferrable; /** * A reference to the sequelize instance class. @@ -6523,7 +6523,7 @@ declare namespace sequelize { /** * Sets the constraints to be deferred or immediately checked. */ - deferrable?: Deferrable; + deferrable?: Deferrable[keyof Deferrable]; } From f92f259b4c2afd9e5dd1a72745ad9e625b2623d4 Mon Sep 17 00:00:00 2001 From: Florian Keller Date: Mon, 18 Feb 2019 14:36:44 +0100 Subject: [PATCH 127/155] Add types for npm-registry-package-info --- types/npm-registry-package-info/index.d.ts | 36 +++++++++++++++++++ .../npm-registry-package-info-tests.ts | 21 +++++++++++ types/npm-registry-package-info/tsconfig.json | 23 ++++++++++++ types/npm-registry-package-info/tslint.json | 1 + 4 files changed, 81 insertions(+) create mode 100644 types/npm-registry-package-info/index.d.ts create mode 100644 types/npm-registry-package-info/npm-registry-package-info-tests.ts create mode 100644 types/npm-registry-package-info/tsconfig.json create mode 100644 types/npm-registry-package-info/tslint.json 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" } From 7203e742a0d6c1c2a70532c9556a516c8bde7325 Mon Sep 17 00:00:00 2001 From: Pascal Sthamer Date: Mon, 18 Feb 2019 14:38:26 +0100 Subject: [PATCH 128/155] Add new preserveSymlinks option which came with klaw v3.0.0 --- types/klaw/index.d.ts | 4 +++- types/klaw/klaw-tests.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) 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) }) From afeecd2abd9d89b3aae0b46de5f34c704cffbd64 Mon Sep 17 00:00:00 2001 From: Shireesha Bongarala Date: Mon, 18 Feb 2019 19:27:58 +0530 Subject: [PATCH 129/155] Add trailing comma --- types/algoliasearch/algoliasearch-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index e650013a06..8123c69891 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -150,7 +150,7 @@ let _algoliaQueryParameters: QueryParameters = { synonyms: true, replaceSynonymsInHighlight: false, minProximity: 0, - sortFacetValuesBy: 'alpha' + sortFacetValuesBy: 'alpha', }; let client: Client = algoliasearch('', ''); From 44dca6f2db376ee168c862a55ac17335917d0afd Mon Sep 17 00:00:00 2001 From: Shireesha Bongarala Date: Mon, 18 Feb 2019 19:34:08 +0530 Subject: [PATCH 130/155] Add to IndexSettings, change the format to single quotes and spaces --- types/algoliasearch/algoliasearch-tests.ts | 1 + types/algoliasearch/index.d.ts | 4 +++- types/algoliasearch/lite/index.d.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 8123c69891..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 = { diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index e799ee1832..f25d901f73 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1455,7 +1455,7 @@ declare namespace algoliasearch { /** * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ */ - sortFacetValuesBy?: "count"|"alpha"; + sortFacetValuesBy?: 'count' | 'alpha'; } namespace SearchForFacetValues { @@ -1781,6 +1781,8 @@ declare namespace algoliasearch { https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/ */ camelCaseAttributes?: string[]; + + sortFacetValuesBy?: 'count' | 'alpha'; } interface Response { diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index a3babc339b..5c9457df22 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -535,7 +535,7 @@ declare namespace algoliasearch { /** * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ */ - sortFacetValuesBy?: "count"|"alpha"; + sortFacetValuesBy?: 'count' | 'alpha'; } namespace SearchForFacetValues { From cbc764162f06f1a6010007f978edb1bbce6c0159 Mon Sep 17 00:00:00 2001 From: g8up Date: Tue, 19 Feb 2019 00:25:37 +0800 Subject: [PATCH 131/155] sendResponse's param can be optional > sendResponse: (response?: any) => void) => void --- types/chrome/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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> { } From 73f602e451cb6ccfba85fcb3e14ea73a6120e726 Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Mon, 18 Feb 2019 19:47:57 +0100 Subject: [PATCH 132/155] Improve getHistory types and make ignoreNull optional --- types/iobroker/index.d.ts | 5 +++-- types/iobroker/iobroker-tests.ts | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/iobroker/index.d.ts b/types/iobroker/index.d.ts index 71fa1b4d78..846a59ef2d 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"; } @@ -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..ef59085e67 100644 --- a/types/iobroker/iobroker-tests.ts +++ b/types/iobroker/iobroker-tests.ts @@ -260,6 +260,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; From a3cd18ebd9d29afc5253362179833e573951376b Mon Sep 17 00:00:00 2001 From: Lars Klein Date: Mon, 18 Feb 2019 21:12:59 +0100 Subject: [PATCH 133/155] Fix browser.storage.onChange parameters The changes parameter is an object that maps the name of a changed parameter to its StorageChange. Refer to https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/onChanged#Parameters --- types/firefox-webext-browser/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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>; } /** From e41bc7f7c192c0fc3ae8ee7951072a78e1327c91 Mon Sep 17 00:00:00 2001 From: ldanet Date: Mon, 18 Feb 2019 17:57:19 +1300 Subject: [PATCH 134/155] Fix react-draft-wysiwyg onContentStateChange prop type --- types/react-draft-wysiwyg/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-draft-wysiwyg/index.d.ts b/types/react-draft-wysiwyg/index.d.ts index 7b9b3577d8..4cee97e528 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 @@ -20,7 +21,7 @@ export class SelectionState extends Draft.SelectionState {} export interface EditorProps { onChange?(contentState: ContentState): RawDraftContentState; onEditorStateChange?(editorState: EditorState): void; - onContentStateChange?(contentState: ContentState): RawDraftContentState; + onContentStateChange?(contentState: RawDraftContentState): void; initialContentState?: RawDraftContentState; defaultContentState?: RawDraftContentState; contentState?: RawDraftContentState; From 0c1fdf962b040c4406c54f1cd5e48d9a6f748534 Mon Sep 17 00:00:00 2001 From: Lydie Danet Date: Tue, 19 Feb 2019 09:57:50 +1300 Subject: [PATCH 135/155] Add test for react-draft-wysiwyg onContentStateChange prop --- .../uncontrolled-raw-draft-content-state.tsx | 48 +++++++++++++++++++ types/react-draft-wysiwyg/tsconfig.json | 3 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 types/react-draft-wysiwyg/test/uncontrolled-raw-draft-content-state.tsx 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" ] } From a258dc92515835de1f01a6e9e2f7ec1b34ebfa7a Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Tue, 19 Feb 2019 00:57:38 +0100 Subject: [PATCH 136/155] Make the test more realistic --- .../react-places-autocomplete-tests.tsx | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) 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} +
    + ); + })} +
    + + ); + } + }
    ); From 0cf627b0fb947cd91ce0eb29bce8a8b4fd38a4b5 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Tue, 19 Feb 2019 00:59:35 +0100 Subject: [PATCH 137/155] Replace null JSX attributes by undefined See https://github.com/hibiken/react-places-autocomplete/pull/256 See https://codesandbox.io/s/yw7o81nq39 --- types/react-places-autocomplete/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-places-autocomplete/index.d.ts b/types/react-places-autocomplete/index.d.ts index dffcbf29f8..cd299d5bd5 100644 --- a/types/react-places-autocomplete/index.d.ts +++ b/types/react-places-autocomplete/index.d.ts @@ -53,7 +53,7 @@ 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; @@ -62,7 +62,7 @@ export interface PropTypes { } & InputProps; getSuggestionItemProps: (suggestion: Suggestion, options?: SuggestionProps) => { key: number; - id: string | null; + id: string | undefined; role: 'option'; onMouseEnter: () => void; onMouseLeave: () => void; From c705e8559de1600cf721a41a603ff444b150cfd8 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Tue, 19 Feb 2019 01:00:36 +0100 Subject: [PATCH 138/155] Generalize the use of React.*EventHandler --- types/react-places-autocomplete/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/react-places-autocomplete/index.d.ts b/types/react-places-autocomplete/index.d.ts index cd299d5bd5..bf11a9fa30 100644 --- a/types/react-places-autocomplete/index.d.ts +++ b/types/react-places-autocomplete/index.d.ts @@ -56,7 +56,7 @@ export interface PropTypes { 'aria-activedescendant': string | undefined; disabled: boolean; onKeyDown: React.KeyboardEventHandler; - onBlur: () => void; + onBlur: React.FocusEventHandler; value: string | undefined; onChange: (ev: { target: { value: string }}) => void; } & InputProps; @@ -64,13 +64,13 @@ export interface PropTypes { key: number; 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; } From 0a03e0aad489a697919c4d22f15da900332f3b08 Mon Sep 17 00:00:00 2001 From: "Krzysztof \"Bushee\" Nowaczyk" Date: Tue, 19 Feb 2019 09:33:42 +0100 Subject: [PATCH 139/155] jasmine-data_driven_tests - added missing typing for single array argument data --- types/jasmine-data_driven_tests/index.d.ts | 2 +- .../jasmine-data_driven_tests-tests.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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; From 627faaf6421e77942d16cbfa99340a41e7128581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20H=C3=BCbelbauer?= Date: Tue, 19 Feb 2019 10:26:43 +0100 Subject: [PATCH 140/155] Type the event component to show that it also accepts event --- types/react-big-calendar/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 }; From 85497a7e530075b28caa83fd1593e66e61c67f30 Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Tue, 19 Feb 2019 10:27:45 +0100 Subject: [PATCH 141/155] Add missing semicolon --- types/iobroker/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/iobroker/index.d.ts b/types/iobroker/index.d.ts index 846a59ef2d..04860247c1 100644 --- a/types/iobroker/index.d.ts +++ b/types/iobroker/index.d.ts @@ -1682,7 +1682,7 @@ 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 GetHistoryResult = Array<(State & { id?: string })> + type GetHistoryResult = Array<(State & { id?: string })>; type GetHistoryCallback = (err: string | null, result: GetHistoryResult, step: number, sessionId?: string) => void; /** Contains the return values of readDir */ From 3134f8c817884d0333742279ad28bff50d01e1d7 Mon Sep 17 00:00:00 2001 From: Melvin Groenhoff Date: Tue, 19 Feb 2019 11:39:44 +0100 Subject: [PATCH 142/155] Add typings for express-urlrewrite --- .../express-urlrewrite-tests.ts | 22 ++++++++++++++++++ types/express-urlrewrite/index.d.ts | 12 ++++++++++ types/express-urlrewrite/tsconfig.json | 23 +++++++++++++++++++ types/express-urlrewrite/tslint.json | 1 + 4 files changed, 58 insertions(+) create mode 100644 types/express-urlrewrite/express-urlrewrite-tests.ts create mode 100644 types/express-urlrewrite/index.d.ts create mode 100644 types/express-urlrewrite/tsconfig.json create mode 100644 types/express-urlrewrite/tslint.json 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/express-urlrewrite/tsconfig.json b/types/express-urlrewrite/tsconfig.json new file mode 100644 index 0000000000..0e5659e0eb --- /dev/null +++ b/types/express-urlrewrite/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "express-urlrewrite-tests.ts" + ] +} diff --git a/types/express-urlrewrite/tslint.json b/types/express-urlrewrite/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/express-urlrewrite/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b0e5b09e6c37bded83f66f183c361dd20016902b Mon Sep 17 00:00:00 2001 From: Daniel Syddall Date: Tue, 19 Feb 2019 12:29:41 +0000 Subject: [PATCH 143/155] Add typings for vue-chartkick --- types/vue-chartkick/index.d.ts | 14 ++++++++++++++ types/vue-chartkick/package.json | 7 +++++++ types/vue-chartkick/tsconfig.json | 22 ++++++++++++++++++++++ types/vue-chartkick/tslint.json | 1 + types/vue-chartkick/vue-chartkick-tests.ts | 5 +++++ 5 files changed, 49 insertions(+) create mode 100644 types/vue-chartkick/index.d.ts create mode 100644 types/vue-chartkick/package.json create mode 100644 types/vue-chartkick/tsconfig.json create mode 100644 types/vue-chartkick/tslint.json create mode 100644 types/vue-chartkick/vue-chartkick-tests.ts diff --git a/types/vue-chartkick/index.d.ts b/types/vue-chartkick/index.d.ts new file mode 100644 index 0000000000..6c3cfa6275 --- /dev/null +++ b/types/vue-chartkick/index.d.ts @@ -0,0 +1,14 @@ +// 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 + +declare module "vue-chartkick" { + import {PluginObject} from "vue"; + interface VueChartkickPlugin extends PluginObject<{adapter: any}> { + version: string; + addAdapter: (library: any) => void + } + 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..1cbc5f598d --- /dev/null +++ b/types/vue-chartkick/package.json @@ -0,0 +1,7 @@ +{ + "private": true, + "dependencies": { + "chart.js": "^2.7.3", + "vue": "^2.6.6" + } +} diff --git a/types/vue-chartkick/tsconfig.json b/types/vue-chartkick/tsconfig.json new file mode 100644 index 0000000000..82918ac142 --- /dev/null +++ b/types/vue-chartkick/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "vue-chartkick-tests.ts" + ] +} 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..1aa76075df --- /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}); From 4f6f2fb504ee4668d1f4d483636c5b5cbfb32392 Mon Sep 17 00:00:00 2001 From: Daniel Syddall Date: Tue, 19 Feb 2019 12:48:15 +0000 Subject: [PATCH 144/155] Add strictFunctionTypes to tsconfig.json --- types/vue-chartkick/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/vue-chartkick/tsconfig.json b/types/vue-chartkick/tsconfig.json index 82918ac142..a6330a553d 100644 --- a/types/vue-chartkick/tsconfig.json +++ b/types/vue-chartkick/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 5421f894857e597413a8f81c738c36f3f0ff3f7d Mon Sep 17 00:00:00 2001 From: Daniel Syddall Date: Tue, 19 Feb 2019 13:33:40 +0000 Subject: [PATCH 145/155] Set minimum typescript version to 2.3 Add dom lib to tsconfig.json Use absolute import for chart.js Avoid using declare module --- types/vue-chartkick/index.d.ts | 17 +++++++++-------- types/vue-chartkick/tsconfig.json | 3 ++- types/vue-chartkick/vue-chartkick-tests.ts | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/types/vue-chartkick/index.d.ts b/types/vue-chartkick/index.d.ts index 6c3cfa6275..79f70d084d 100644 --- a/types/vue-chartkick/index.d.ts +++ b/types/vue-chartkick/index.d.ts @@ -2,13 +2,14 @@ // Project: https://github.com/ankane/vue-chartkick#readme // Definitions by: CNS Media // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -declare module "vue-chartkick" { - import {PluginObject} from "vue"; - interface VueChartkickPlugin extends PluginObject<{adapter: any}> { - version: string; - addAdapter: (library: any) => void - } - const VueChartkick: VueChartkickPlugin; - export default VueChartkick; +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/tsconfig.json b/types/vue-chartkick/tsconfig.json index a6330a553d..2d517d3efd 100644 --- a/types/vue-chartkick/tsconfig.json +++ b/types/vue-chartkick/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/vue-chartkick/vue-chartkick-tests.ts b/types/vue-chartkick/vue-chartkick-tests.ts index 1aa76075df..4f938eb54e 100644 --- a/types/vue-chartkick/vue-chartkick-tests.ts +++ b/types/vue-chartkick/vue-chartkick-tests.ts @@ -1,5 +1,5 @@ import VueChartkick from 'vue-chartkick'; import Vue from "vue"; -import * as Chart from "../chart.js"; +import * as Chart from "chart.js"; Vue.use(VueChartkick, {adapter: Chart}); From 6f7f71a00d0d1831f4ec6f1accec779e6a8cedd1 Mon Sep 17 00:00:00 2001 From: Nikolaj Kappler Date: Tue, 19 Feb 2019 15:08:47 +0100 Subject: [PATCH 146/155] fixed typo and removed a bit of redundancy workstream: --- types/tern/lib/tern/index.d.ts | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) 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; } /** From 742ec41f82359fb8720c19107e729b4bf79cb9e9 Mon Sep 17 00:00:00 2001 From: Daniel Syddall Date: Tue, 19 Feb 2019 14:21:55 +0000 Subject: [PATCH 147/155] Remove dependency on chart.js and set Vue version to >=2.0.0 --- types/vue-chartkick/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/vue-chartkick/package.json b/types/vue-chartkick/package.json index 1cbc5f598d..1c62b73c5c 100644 --- a/types/vue-chartkick/package.json +++ b/types/vue-chartkick/package.json @@ -1,7 +1,6 @@ { "private": true, "dependencies": { - "chart.js": "^2.7.3", - "vue": "^2.6.6" + "vue": ">=2.0.0" } } From 87d198657d3ca876202a0cfb9ed10fdd347c57af Mon Sep 17 00:00:00 2001 From: Lydie Danet Date: Wed, 20 Feb 2019 09:11:03 +1300 Subject: [PATCH 148/155] react-draft-wysiwyg: fix onChange prop type --- types/react-draft-wysiwyg/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-draft-wysiwyg/index.d.ts b/types/react-draft-wysiwyg/index.d.ts index 4cee97e528..46fab16511 100644 --- a/types/react-draft-wysiwyg/index.d.ts +++ b/types/react-draft-wysiwyg/index.d.ts @@ -19,7 +19,7 @@ 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: RawDraftContentState): void; initialContentState?: RawDraftContentState; From cadc6f11fd0983bdedbea9d863b1137cb617d8c9 Mon Sep 17 00:00:00 2001 From: "Matt R. Wilson" Date: Tue, 19 Feb 2019 16:23:30 -0700 Subject: [PATCH 149/155] [catbox] Update Client.stop to return a promise. The method is define as async. https://github.com/hapijs/catbox/blob/9e474ea17444285c2e82c2b2996d9eced6784f9a/lib/client.js#L40-L43 --- types/catbox/catbox-tests.ts | 3 +++ types/catbox/index.d.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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]). From b926920fcdf821bc6d3daa890834bb47b8e46a00 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 19 Feb 2019 15:41:06 -0800 Subject: [PATCH 150/155] Use dtslint from npm Instead of installing from the production branch on github. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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": {} From ad77aaa3be97495b4c8e481da2deb60c473c8839 Mon Sep 17 00:00:00 2001 From: lukostry Date: Wed, 20 Feb 2019 00:54:30 +0100 Subject: [PATCH 151/155] Definitions for ink-spinner --- types/ink-spinner/index.d.ts | 39 +++++++++++++++++++++++++ types/ink-spinner/ink-spinner-tests.tsx | 10 +++++++ types/ink-spinner/tsconfig.json | 25 ++++++++++++++++ types/ink-spinner/tslint.json | 1 + 4 files changed, 75 insertions(+) create mode 100644 types/ink-spinner/index.d.ts create mode 100644 types/ink-spinner/ink-spinner-tests.tsx create mode 100644 types/ink-spinner/tsconfig.json create mode 100644 types/ink-spinner/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" } From fd67ee726851842c87491e50a5c9c1dfd9eeaa29 Mon Sep 17 00:00:00 2001 From: Jessica Date: Wed, 20 Feb 2019 16:12:32 +0900 Subject: [PATCH 152/155] Add some support for special cases using undefined with hooks --- types/react/index.d.ts | 25 +++++++++++++- types/react/test/hooks.tsx | 70 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 91 insertions(+), 4 deletions(-) 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, []); } From 3d07bb763cb37c2bcae758e16462b628777790f8 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Wed, 20 Feb 2019 17:01:16 +0100 Subject: [PATCH 153/155] [p-throttle] Remove types --- notNeededPackages.json | 6 ++++ types/p-throttle/index.d.ts | 47 ---------------------------- types/p-throttle/p-throttle-tests.ts | 47 ---------------------------- types/p-throttle/tsconfig.json | 23 -------------- types/p-throttle/tslint.json | 1 - 5 files changed, 6 insertions(+), 118 deletions(-) delete mode 100644 types/p-throttle/index.d.ts delete mode 100644 types/p-throttle/p-throttle-tests.ts delete mode 100644 types/p-throttle/tsconfig.json delete mode 100644 types/p-throttle/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index be57d76a49..4c33728a01 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1116,6 +1116,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/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/p-throttle/tsconfig.json b/types/p-throttle/tsconfig.json deleted file mode 100644 index 81852e4d18..0000000000 --- a/types/p-throttle/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-throttle-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-throttle/tslint.json b/types/p-throttle/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/p-throttle/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 84e1ffaf8e03f282ce6747576925d3484eeb780a Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Wed, 20 Feb 2019 14:23:15 -0800 Subject: [PATCH 154/155] Updates based on feedback --- types/office-js-preview/index.d.ts | 2847 ++++------------------------ types/office-js/index.d.ts | 2847 ++++------------------------ 2 files changed, 744 insertions(+), 4950 deletions(-) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 8e19d41cb5..b46d49364b 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -10770,7 +10770,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. * @@ -10792,27 +10792,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. * @@ -10829,7 +10809,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. * @@ -10844,20 +10824,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. * @@ -10883,7 +10850,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. * @@ -10906,54 +10873,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; - /** - * 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. - * @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. - * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. - * @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?: CoercionTypeOptions): void; + prependAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * @@ -10981,7 +10901,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. * @@ -11006,58 +10926,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; - /** - * 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. - * @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. - * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. - * @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?: CoercionTypeOptions): void; + setAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. @@ -11086,7 +10955,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. * @@ -11111,55 +10980,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; - /** - * 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. - * @param options - Optional. An object literal that contains one or more of the following properties. - * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. - */ - setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; + setSelectedDataAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Represents a contact stored on the server. Read mode only. @@ -11292,52 +11113,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. @@ -11493,7 +11269,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. * @@ -11512,24 +11288,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. * @@ -11548,7 +11307,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. * @@ -11565,21 +11324,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. * @@ -11601,7 +11346,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. * @@ -11621,25 +11366,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. @@ -11730,12 +11457,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. * @@ -11752,27 +11480,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; } /** @@ -11812,7 +11524,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. @@ -11831,24 +11543,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. * @@ -11868,7 +11563,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. * @@ -11886,23 +11581,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. * @@ -11926,7 +11605,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. * @@ -11948,27 +11627,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; } /** @@ -12053,10 +11712,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. * @@ -12068,22 +11727,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; } /** @@ -12342,11 +11989,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 & { isInline: boolean }, 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. * @@ -12367,57 +12014,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. - */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12441,13 +12042,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 & { isInline: boolean }, 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. * @@ -12468,63 +12069,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; - /** - * 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. - * @param options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -12548,7 +12099,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. * @@ -12570,27 +12121,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` is 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. * @@ -12615,13 +12146,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. * @@ -12646,37 +12177,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 * @@ -12718,7 +12223,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. * @@ -12737,22 +12242,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. * @@ -12777,7 +12267,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. * @@ -12800,26 +12290,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. * @@ -12843,11 +12314,11 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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. */ - 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. * @@ -12874,7 +12345,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. * @@ -12900,31 +12371,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. * @@ -12950,29 +12397,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. * @@ -12998,7 +12423,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. * @@ -13020,7 +12445,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. * @@ -13040,25 +12465,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` is 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. * @@ -13092,42 +12499,9 @@ 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. - * @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. * @@ -13158,9 +12532,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. * @@ -13189,10 +12563,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. * @@ -13212,60 +12586,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * 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. - * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the - * default style is 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. - */ - setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -13636,7 +12960,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. * @@ -13658,27 +12982,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` is 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. @@ -13706,33 +13010,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. * @@ -13760,33 +13038,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}. * @@ -13812,7 +13064,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}. * @@ -13835,24 +13087,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. * @@ -14088,31 +13323,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. @@ -14135,7 +13346,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. * @@ -14155,25 +13366,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` is 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; } /** @@ -14280,7 +13473,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. @@ -14303,28 +13496,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` is 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. @@ -14354,32 +13526,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. @@ -14407,7 +13554,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}. @@ -14434,7 +13581,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}. @@ -14459,26 +13606,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. @@ -14491,7 +13619,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * @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. @@ -14499,7 +13627,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. @@ -14518,7 +13646,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. @@ -14545,32 +13673,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. @@ -14593,7 +13697,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. @@ -14614,26 +13718,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` is 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}. @@ -14660,6 +13745,7 @@ declare namespace Office { * */ subject: Subject; + /** * Adds a file to a message or appointment as an attachment. * @@ -14684,12 +13770,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 & { isInline: boolean }, 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. * @@ -14710,59 +13796,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the - * attachment list. - */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }, 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. @@ -14787,13 +13826,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 & { isInline: boolean }, 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. * @@ -14814,63 +13853,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; - /** - * 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. - * @param options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): 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. @@ -14896,14 +13885,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. * @@ -14928,38 +13917,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 @@ -15002,7 +13965,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. * @@ -15021,22 +13984,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. * @@ -15063,7 +14011,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. * @@ -15088,26 +14036,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. * @@ -15131,12 +14060,12 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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. */ - 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. * @@ -15163,7 +14092,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. * @@ -15190,53 +14119,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. * @@ -15261,7 +14144,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. @@ -15296,11 +14179,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. - * @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. * @@ -15332,44 +14215,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. * @@ -15398,10 +14248,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. * @@ -15421,60 +14271,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * 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. - * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is - * 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. - */ - setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -15621,33 +14421,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. * @@ -15675,33 +14449,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}. * @@ -15727,7 +14475,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}. * @@ -15751,25 +14499,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. * @@ -16227,12 +14957,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 & { isInline: boolean }, 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. * @@ -16253,59 +14983,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the - * attachment list. - */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16329,13 +15012,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 & { isInline: boolean }, 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. * @@ -16356,63 +15039,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}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 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; - /** - * 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}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 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 options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -16436,7 +15069,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. * @@ -16458,27 +15091,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` is 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. * @@ -16503,14 +15116,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. * @@ -16535,38 +15148,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 * @@ -16608,7 +15195,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. * @@ -16627,22 +15214,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. * @@ -16670,7 +15242,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. * @@ -16696,27 +15268,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. * @@ -16740,12 +15292,12 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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. */ - 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. * @@ -16772,7 +15324,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. * @@ -16798,19 +15350,66 @@ 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` is also supported. + * + * [Api set: Mailbox 1.7] * * @remarks * @@ -16818,251 +15417,106 @@ 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` is 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 - 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. + */ + 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` is 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` is 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` is 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. * @@ -17090,10 +15544,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. * @@ -17113,59 +15567,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * 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. - * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is - * 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. - */ - setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The message read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -17550,7 +15955,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. * @@ -17572,27 +15977,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` is 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. @@ -17620,33 +16005,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. * @@ -17674,33 +16033,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}. @@ -17727,7 +16060,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}. @@ -17752,26 +16085,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. * @@ -18009,31 +16323,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. * @@ -18055,7 +16345,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. * @@ -18075,25 +16365,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` is 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; } /** @@ -18162,7 +16434,7 @@ 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. - * @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] @@ -18173,14 +16445,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] @@ -18191,22 +16463,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. * @@ -18228,25 +16485,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. * @@ -18266,7 +16505,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. @@ -18392,7 +16631,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. * @@ -18413,26 +16652,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. * @@ -18687,43 +16907,14 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * @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. * isRest: Determines if the token provided will be used for the Outlook REST APIs or Exchange Web Services. Default value is false. * asyncContext: Any state data that is passed to the asynchronous method. * @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(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. * @@ -18753,7 +16944,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. * @@ -18777,30 +16968,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. * @@ -18854,60 +17022,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. * @@ -18927,7 +17042,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. * @@ -18946,24 +17061,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; } /** @@ -19085,26 +17183,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. * @@ -19125,7 +17204,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. * @@ -19142,7 +17221,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. * @@ -19157,19 +17236,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. * @@ -19182,24 +17249,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. * @@ -19215,7 +17270,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. * @@ -19237,25 +17292,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. * @@ -19275,7 +17312,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. @@ -19341,30 +17378,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. * @@ -19389,7 +17403,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. * @@ -19403,13 +17417,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 of * 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. * @@ -19427,7 +17441,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. * @@ -19453,12 +17467,12 @@ 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. * 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. * @@ -19482,38 +17496,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; } /** @@ -19648,7 +17636,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. @@ -19668,23 +17656,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. @@ -19707,7 +17679,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. @@ -19728,28 +17700,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; } /** @@ -19863,7 +17814,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. @@ -19938,23 +17889,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. * @@ -20230,13 +18165,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 of * 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. * @@ -20253,7 +18188,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. * @@ -20270,12 +18205,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. * @@ -20292,28 +18227,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; } /** @@ -20366,12 +18283,12 @@ 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 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. * @@ -20389,7 +18306,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. * @@ -20408,13 +18325,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. * @@ -20433,31 +18350,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 eec8df60c0..e21e3b8188 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -10770,7 +10770,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. * @@ -10792,27 +10792,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. * @@ -10829,7 +10809,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. * @@ -10844,20 +10824,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. * @@ -10883,7 +10850,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. * @@ -10906,54 +10873,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; - /** - * 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. - * @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. - * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. - * @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?: CoercionTypeOptions): void; + prependAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the entire body with the specified text. * @@ -10981,7 +10901,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. * @@ -11006,58 +10926,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; - /** - * 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. - * @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. - * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. - * @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?: CoercionTypeOptions): void; + setAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Replaces the selection in the body with the specified text. @@ -11086,7 +10955,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. * @@ -11111,55 +10980,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; - /** - * 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. - * @param options - Optional. An object literal that contains one or more of the following properties. - * coercionType: The desired format for the body. The string in the data parameter will be converted to this format. - */ - setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; + setSelectedDataAsync(data: string, callback?: (asyncResult: Office.AsyncResult) => void): void; } /** * Represents a contact stored on the server. Read mode only. @@ -11292,52 +11113,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. @@ -11493,7 +11269,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. * @@ -11512,24 +11288,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. * @@ -11548,7 +11307,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. * @@ -11565,21 +11324,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. * @@ -11601,7 +11346,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. * @@ -11621,25 +11366,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. @@ -11730,12 +11457,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. * @@ -11752,27 +11480,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; } /** @@ -11812,7 +11524,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. @@ -11831,24 +11543,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. * @@ -11868,7 +11563,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. * @@ -11886,23 +11581,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. * @@ -11926,7 +11605,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. * @@ -11948,27 +11627,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; } /** @@ -12053,10 +11712,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. * @@ -12068,22 +11727,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; } /** @@ -12342,11 +11989,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 & { isInline: boolean }, 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. * @@ -12367,57 +12014,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the attachment list. - */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -12441,13 +12042,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 & { isInline: boolean }, 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. * @@ -12468,63 +12069,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; - /** - * 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. - * @param options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -12548,7 +12099,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. * @@ -12570,27 +12121,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` is 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. * @@ -12615,13 +12146,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. * @@ -12646,37 +12177,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 * @@ -12718,7 +12223,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. * @@ -12737,22 +12242,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. * @@ -12777,7 +12267,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. * @@ -12800,26 +12290,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. * @@ -12843,11 +12314,11 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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. */ - 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. * @@ -12874,7 +12345,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. * @@ -12900,31 +12371,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. * @@ -12950,29 +12397,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. * @@ -12998,7 +12423,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. * @@ -13020,7 +12445,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. * @@ -13040,25 +12465,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` is 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. * @@ -13092,42 +12499,9 @@ 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. - * @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. * @@ -13158,9 +12532,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. * @@ -13189,10 +12563,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. * @@ -13212,60 +12586,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * 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. - * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the - * default style is 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. - */ - setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** @@ -13636,7 +12960,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. * @@ -13658,27 +12982,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` is 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. @@ -13706,33 +13010,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. * @@ -13760,33 +13038,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}. * @@ -13812,7 +13064,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}. * @@ -13835,24 +13087,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. * @@ -14088,31 +13323,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. @@ -14135,7 +13346,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. * @@ -14155,25 +13366,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` is 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; } /** @@ -14280,7 +13473,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. @@ -14303,28 +13496,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` is 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. @@ -14354,32 +13526,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. @@ -14407,7 +13554,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}. @@ -14434,7 +13581,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}. @@ -14459,26 +13606,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. @@ -14491,7 +13619,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * @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. @@ -14499,7 +13627,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. @@ -14518,7 +13646,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. @@ -14545,32 +13673,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. @@ -14593,7 +13697,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. @@ -14614,26 +13718,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` is 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}. @@ -14660,6 +13745,7 @@ declare namespace Office { * */ subject: Subject; + /** * Adds a file to a message or appointment as an attachment. * @@ -14684,12 +13770,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 & { isInline: boolean }, 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. * @@ -14710,59 +13796,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the - * attachment list. - */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }, 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. @@ -14787,13 +13826,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 & { isInline: boolean }, 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. * @@ -14814,63 +13853,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; - /** - * 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. - * @param options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): 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. @@ -14896,14 +13885,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. * @@ -14928,38 +13917,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 @@ -15002,7 +13965,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. * @@ -15021,22 +13984,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. * @@ -15063,7 +14011,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. * @@ -15088,26 +14036,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. * @@ -15131,12 +14060,12 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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. */ - 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. * @@ -15163,7 +14092,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. * @@ -15190,53 +14119,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. * @@ -15261,7 +14144,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. @@ -15296,11 +14179,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. - * @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. * @@ -15332,44 +14215,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. * @@ -15398,10 +14248,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. * @@ -15421,60 +14271,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * 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. - * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is - * 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. - */ - setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -15621,33 +14421,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. * @@ -15675,33 +14449,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}. * @@ -15727,7 +14475,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}. * @@ -15751,25 +14499,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. * @@ -16227,12 +14957,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 & { isInline: boolean }, 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. * @@ -16253,59 +14983,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the - * attachment list. - */ - addFileAttachmentAsync(uri: string, attachmentName: string, options?: { isInline: boolean }): void; + addFileAttachmentAsync(uri: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds a file to a message or appointment as an attachment. * @@ -16329,13 +15012,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 & { isInline: boolean }, 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. * @@ -16356,63 +15039,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}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 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; - /** - * 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}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 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 options - Optional. An object literal that contains one or more of the following properties. - * isInline: If true, indicates that the attachment will be shown inline in the message body and should not be displayed in the attachment list. - * - * @beta - */ - addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, options?: { isInline: boolean }): void; + addFileAttachmentFromBase64Async(base64File: string, attachmentName: string, callback?: (asyncResult: Office.AsyncResult) => void): void; /** * Adds an event handler for a supported event. * @@ -16436,7 +15069,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. * @@ -16458,27 +15091,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` is 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. * @@ -16503,14 +15116,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. * @@ -16535,38 +15148,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 * @@ -16608,7 +15195,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. * @@ -16627,22 +15214,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. * @@ -16670,7 +15242,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. * @@ -16696,27 +15268,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. * @@ -16740,12 +15292,12 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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. */ - 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. * @@ -16772,7 +15324,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. * @@ -16798,19 +15350,66 @@ 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` is also supported. + * + * [Api set: Mailbox 1.7] * * @remarks * @@ -16818,251 +15417,106 @@ 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` is 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 - 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. + */ + 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` is 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` is 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` is 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. * @@ -17090,10 +15544,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. * @@ -17113,59 +15567,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; - /** - * 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 options - Optional. An object literal that contains one or more of the following properties. - * 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. - * If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is - * 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. - */ - setSelectedDataAsync(data: string, options?: CoercionTypeOptions): void; + setSelectedDataAsync(data: string, callback: (asyncResult: Office.AsyncResult) => void): void; } /** * The message read mode of {@link Office.Item | Office.context.mailbox.item}. @@ -17550,7 +15955,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. * @@ -17572,27 +15977,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` is 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. @@ -17620,33 +16005,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. * @@ -17674,33 +16033,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}. @@ -17727,7 +16060,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}. @@ -17752,26 +16085,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. * @@ -18009,31 +16323,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. * @@ -18055,7 +16345,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. * @@ -18075,25 +16365,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` is 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; } /** @@ -18162,7 +16434,7 @@ 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. - * @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] @@ -18173,14 +16445,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] @@ -18191,22 +16463,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. * @@ -18228,25 +16485,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. * @@ -18266,7 +16505,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. @@ -18392,7 +16631,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. * @@ -18413,26 +16652,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. * @@ -18687,43 +16907,14 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * @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. * isRest: Determines if the token provided will be used for the Outlook REST APIs or Exchange Web Services. Default value is false. * asyncContext: Any state data that is passed to the asynchronous method. * @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(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. * @@ -18753,7 +16944,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. * @@ -18777,30 +16968,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. * @@ -18854,60 +17022,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. * @@ -18927,7 +17042,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. * @@ -18946,24 +17061,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; } /** @@ -19085,26 +17183,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. * @@ -19125,7 +17204,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. * @@ -19142,7 +17221,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. * @@ -19157,19 +17236,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. * @@ -19182,24 +17249,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. * @@ -19215,7 +17270,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. * @@ -19237,25 +17292,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. * @@ -19275,7 +17312,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. @@ -19341,30 +17378,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. * @@ -19389,7 +17403,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. * @@ -19403,13 +17417,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 of * 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. * @@ -19427,7 +17441,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. * @@ -19453,12 +17467,12 @@ 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. * 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. * @@ -19482,38 +17496,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; } /** @@ -19648,7 +17636,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. @@ -19668,23 +17656,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. @@ -19707,7 +17679,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. @@ -19728,28 +17700,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; } /** @@ -19863,7 +17814,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. @@ -19938,23 +17889,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. * @@ -20230,13 +18165,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 of * 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. * @@ -20253,7 +18188,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. * @@ -20270,12 +18205,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. * @@ -20292,28 +18227,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; } /** @@ -20366,12 +18283,12 @@ 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 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. * @@ -20389,7 +18306,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. * @@ -20408,13 +18325,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. * @@ -20433,31 +18350,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; } /** From f9f7c55a0636cb91fa15ec1eb743dcd899ef56cc Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Wed, 20 Feb 2019 16:06:00 -0800 Subject: [PATCH 155/155] Updates based on feedback --- types/office-js-preview/index.d.ts | 78 +++++++++++++++++------------- types/office-js/index.d.ts | 78 +++++++++++++++++------------- 2 files changed, 90 insertions(+), 66 deletions(-) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index b46d49364b..42544390d9 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -10591,6 +10591,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. @@ -11715,7 +11727,7 @@ declare namespace Office { * @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?: (asyncResult: 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. * @@ -12314,11 +12326,11 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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 - 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?: (asyncResult: 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. * @@ -12497,11 +12509,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 - 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; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -12554,7 +12566,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. @@ -12566,7 +12578,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. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: 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. * @@ -13619,7 +13631,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * @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 - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. @@ -13627,7 +13639,7 @@ declare namespace Office { * * @beta */ - getSharedPropertiesAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: 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. @@ -14060,12 +14072,12 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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 - 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?: (asyncResult: 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. * @@ -14177,13 +14189,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 - 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?: (asyncResult: Office.AsyncResult) => void): void; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -14239,7 +14251,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. @@ -14251,7 +14263,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. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: 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. * @@ -15292,12 +15304,12 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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 - 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?: (asyncResult: 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. * @@ -15476,12 +15488,12 @@ 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 - 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; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -15536,7 +15548,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. @@ -15547,7 +15559,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. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: 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. * @@ -16432,7 +16444,7 @@ 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 - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. @@ -16445,7 +16457,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * */ - getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the location of an appointment. * @@ -16907,14 +16919,14 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * @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. * isRest: Determines if the token provided will be used for the Outlook REST APIs or Exchange Web Services. Default value is false. * asyncContext: Any state data that is passed to the asynchronous method. * @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(options?: Office.AsyncContextOptions & { isRest?: boolean }, callback?: (asyncResult: 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. * @@ -17417,13 +17429,13 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @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 - 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 EmailAddressDetails objects. */ - getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * @@ -17465,14 +17477,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 - 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?: (asyncResult: 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. * @@ -18165,13 +18177,13 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @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 - 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(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the subject of an appointment or message. * @@ -18283,12 +18295,12 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @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 - 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?: (asyncResult: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the start or end time of an appointment. * diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index e21e3b8188..c207b00668 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -10591,6 +10591,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. @@ -11715,7 +11727,7 @@ declare namespace Office { * @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?: (asyncResult: 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. * @@ -12314,11 +12326,11 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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 - 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?: (asyncResult: 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. * @@ -12497,11 +12509,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 - 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; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -12554,7 +12566,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. @@ -12566,7 +12578,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. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: 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. * @@ -13619,7 +13631,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * @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 - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. @@ -13627,7 +13639,7 @@ declare namespace Office { * * @beta */ - getSharedPropertiesAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: 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. @@ -14060,12 +14072,12 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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 - 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?: (asyncResult: 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. * @@ -14177,13 +14189,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 - 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?: (asyncResult: Office.AsyncResult) => void): void; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -14239,7 +14251,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. @@ -14251,7 +14263,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. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: 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. * @@ -15292,12 +15304,12 @@ declare namespace Office { * * @param coercionType - Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present. * If HTML, the method returns the selected text, whether it is plaintext or HTML. - * @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 - 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?: (asyncResult: 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. * @@ -15476,12 +15488,12 @@ 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 - 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; + saveAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -15536,7 +15548,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. @@ -15547,7 +15559,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. */ - setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: 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. * @@ -16432,7 +16444,7 @@ 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 - When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. @@ -16445,7 +16457,7 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * */ - getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the location of an appointment. * @@ -16907,14 +16919,14 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or Read * * - * @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. * isRest: Determines if the token provided will be used for the Outlook REST APIs or Exchange Web Services. Default value is false. * asyncContext: Any state data that is passed to the asynchronous method. * @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(options?: Office.AsyncContextOptions & { isRest?: boolean }, callback?: (asyncResult: 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. * @@ -17417,13 +17429,13 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @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 - 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 EmailAddressDetails objects. */ - getAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets a recipient list for an appointment or message. * @@ -17465,14 +17477,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 - 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?: (asyncResult: 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. * @@ -18165,13 +18177,13 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @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 - 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(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the subject of an appointment or message. * @@ -18283,12 +18295,12 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose * * - * @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 - 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?: (asyncResult: Office.AsyncResult) => void): void; + getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult) => void): void; /** * Gets the start or end time of an appointment. *