diff --git a/types/browserify/browserify-tests.ts b/types/browserify/browserify-tests.ts index 2a1da315ed..c256d81ca3 100644 --- a/types/browserify/browserify-tests.ts +++ b/types/browserify/browserify-tests.ts @@ -60,3 +60,6 @@ Object.keys(insertGlobals.vars).forEach((x) => { var b = browserify('./browser/main.js', { insertGlobalVars: insertGlobalVars }); + +declare const file: string | string[]; +b.add(file); diff --git a/types/browserify/index.d.ts b/types/browserify/index.d.ts index e419fa2ceb..f9fb6aa3d8 100644 --- a/types/browserify/index.d.ts +++ b/types/browserify/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for Browserify 12.0 // Project: http://browserify.org/ -// Definitions by: Andrew Gaspar , John Vilk , Leonard Thieu +// Definitions by: Andrew Gaspar +// John Vilk +// Leonard Thieu +// Linus Unnebäck // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -102,8 +105,7 @@ interface BrowserifyObject extends NodeJS.EventEmitter { * Add an entry file from file that will be executed when the bundle loads. * If file is an array, each item in file will be added as an entry file. */ - add(file: InputFile[], opts?: FileOptions): BrowserifyObject; - add(file: InputFile, opts?: FileOptions): BrowserifyObject; + add(file: InputFile | InputFile[], opts?: FileOptions): BrowserifyObject; /** * Make file available from outside the bundle with require(file). * The file param is anything that can be resolved by require.resolve(). diff --git a/types/chai-dom/chai-dom-tests.ts b/types/chai-dom/chai-dom-tests.ts index 2cc7b0f232..ef8a9bb385 100644 --- a/types/chai-dom/chai-dom-tests.ts +++ b/types/chai-dom/chai-dom-tests.ts @@ -13,6 +13,7 @@ function test() { expect(testElement).to.have.id('id'); expect(testElement).to.have.html('foo'); expect(testElement).to.have.text('foo'); + expect(testElement).to.have.trimmed.text('foo'); expect(testElement).to.have.text(['foo', 'bar']); expect(testElement).to.have.value('foo'); expect(testElement).to.be.empty; diff --git a/types/chai-dom/index.d.ts b/types/chai-dom/index.d.ts index 8650ebca1d..c6ecc75326 100644 --- a/types/chai-dom/index.d.ts +++ b/types/chai-dom/index.d.ts @@ -35,6 +35,8 @@ declare namespace Chai { displayed: Assertion; + trimmed: Assertion; + } interface Include { diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index 36f25643d9..41ab453e0f 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -5,8 +5,8 @@ import { Chart, ChartData, Point } from "chart.js"; // => chartjs.Chart const plugin = { - afterDraw: (chartInstance: Chart, easing: string, options?: any) => { - } + afterDraw: (chartInstance: Chart, easing: string, options?: any) => { + } }; const chart: Chart = new Chart(new CanvasRenderingContext2D(), { @@ -82,6 +82,18 @@ if (chart.chartArea) { console.log(chart.chartArea.left); } +// Testing custom legends +chart.config.options = { + ...chart.config.options, + legend: { + display: false, + }, + legendCallback: () => 'legend replacement' +}; +chart.update(); +const customLegend = chart.generateLegend(); +console.log(customLegend === 'legend replacement'); + // Testing radial chart const tickOptions: Chart.LinearTickOptions = { max: 100, @@ -107,14 +119,14 @@ const chartConfig: Chart.ChartConfiguration = { data: { labels: ['#apples', '#pears', '#apricots', '#acorns', '#amigas', "#orics"], datasets: [{ - label: "test", - lineTension: 0.15, - data: [1, 1, 2, 3, 5], - backgroundColor: '#37738353', - borderColor: '#37738353', - borderWidth: 3, - fill: true - }] + label: "test", + lineTension: 0.15, + data: [1, 1, 2, 3, 5], + backgroundColor: '#37738353', + borderColor: '#37738353', + borderWidth: 3, + fill: true + }] }, options: radarChartOptions }; diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 49027a2bea..854d4557ed 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -14,6 +14,7 @@ // Francesco Benedetto // Alexandros Dorodoulis // Manuel Heidrich +// Conrad Holtzhausen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -163,7 +164,7 @@ interface Model { } declare namespace Chart { - type ChartType = 'line' | 'bar' | 'horizontalBar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie'; + type ChartType = 'line' | 'bar' | 'horizontalBar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie' | 'scatter'; type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; @@ -264,6 +265,7 @@ declare namespace Chart { aspectRatio?: number; maintainAspectRatio?: boolean; events?: string[]; + legendCallback?(chart: Chart): string; onHover?(this: Chart, event: MouseEvent, activeElements: Array<{}>): any; onClick?(event?: MouseEvent, activeElements?: Array<{}>): any; onResize?(this: Chart, newSize: ChartSize): void; diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index e233a869fd..b20d38828e 100644 --- a/types/custom-functions-runtime/index.d.ts +++ b/types/custom-functions-runtime/index.d.ts @@ -9,6 +9,13 @@ office-js Copyright (c) Microsoft Corporation */ +//////////////////////////////////////////////////////////////// +//////////////////// Begin custom-functions-runtime //////////// +//////////////////////////////////////////////////////////////// + +/* +* Enables you to map your own name that uses lowercase letters to a function. +*/ declare let CustomFunctionMappings: { [key: string]: Function }; declare namespace CustomFunctions { @@ -28,3 +35,7 @@ declare namespace CustomFunctions { onCanceled: () => void; } } + +//////////////////////////////////////////////////////////////// +//////////////////// End custom-functions-runtime //////////// +//////////////////////////////////////////////////////////////// diff --git a/types/custom-functions-runtime/tsconfig.json b/types/custom-functions-runtime/tsconfig.json index 3c8cbbaf27..c42a495281 100644 --- a/types/custom-functions-runtime/tsconfig.json +++ b/types/custom-functions-runtime/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", + "es6", "dom" ], "noImplicitAny": true, diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 644fe647ec..f46f96dfbd 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -208,11 +208,10 @@ declare module 'ember' { const ViewMixin: EmberMixin; /** - Ember.CoreView is an abstract class that exists to give view-like behavior to both Ember's main - view class Ember.Component and other classes that don't need the full functionality of Ember.Component. - - Unless you have specific needs for CoreView, you will use Ember.Component in your applications. - **/ + * Ember.CoreView is an abstract class that exists to give view-like behavior to both Ember's main + * view class Ember.Component and other classes that don't need the full functionality of Ember.Component. + * Unless you have specific needs for CoreView, you will use Ember.Component in your applications. + */ class CoreView extends Ember.Object.extend(Ember.Evented, Ember.ActionHandler) {} interface ActionSupport { sendAction(action: string, ...params: any[]): void; @@ -221,17 +220,17 @@ declare module 'ember' { interface ClassNamesSupport { /** - A list of properties of the view to apply as class names. If the property is a string value, - the value of that string will be applied as a class name. - - If the value of the property is a Boolean, the name of that property is added as a dasherized - class name. - - If you would prefer to use a custom value instead of the dasherized property name, you can - pass a binding like this: `classNameBindings: ['isUrgent:urgent']` - - This list of properties is inherited from the component's superclasses as well. - */ + * A list of properties of the view to apply as class names. If the property is a string value, + * the value of that string will be applied as a class name. + * + * If the value of the property is a Boolean, the name of that property is added as a dasherized + * class name. + * + * If you would prefer to use a custom value instead of the dasherized property name, you can + * pass a binding like this: `classNameBindings: ['isUrgent:urgent']` + * + * This list of properties is inherited from the component's superclasses as well. + */ classNameBindings: string[]; /** * Standard CSS class names to apply to the view's outer element. This @@ -248,11 +247,11 @@ declare module 'ember' { actionContext?: Ember.Object; } /** - Ember.TargetActionSupport is a mixin that can be included in a class to add a triggerAction method - with semantics similar to the Handlebars {{action}} helper. In normal Ember usage, the {{action}} - helper is usually the best choice. This mixin is most often useful when you are doing more - complex event handling in Components. - **/ + * Ember.TargetActionSupport is a mixin that can be included in a class to add a triggerAction method + * with semantics similar to the Handlebars {{action}} helper. In normal Ember usage, the {{action}} + * helper is usually the best choice. This mixin is most often useful when you are doing more + * complex event handling in Components. + */ interface TargetActionSupport { triggerAction(opts: TriggerActionOptions): boolean; } @@ -327,7 +326,7 @@ declare module 'ember' { /** * Given a fullName return the corresponding factory. */ - resolveRegistration(fullName: string): Function; + resolveRegistration(fullName: string): (...args: any[]) => any; /** * Registers a factory or value that can be used for dependency injection (with * `inject`) or for service lookup. Each factory is registered with @@ -374,111 +373,111 @@ declare module 'ember' { } const _RegistryProxyMixin: EmberMixin<_RegistryProxyMixin>; /** - Ember.ActionHandler is available on some familiar classes including Ember.Route, - Ember.Component, and Ember.Controller. (Internally the mixin is used by Ember.CoreView, - Ember.ControllerMixin, and Ember.Route and available to the above classes through inheritance.) - **/ + * Ember.ActionHandler is available on some familiar classes including Ember.Route, + * Ember.Component, and Ember.Controller. (Internally the mixin is used by Ember.CoreView, + * Ember.ControllerMixin, and Ember.Route and available to the above classes through inheritance.) + */ interface ActionHandler { /** - Triggers a named action on the ActionHandler. Any parameters supplied after the actionName - string will be passed as arguments to the action target function. - - If the ActionHandler has its target property set, actions may bubble to the target. - Bubbling happens when an actionName can not be found in the ActionHandler's actions - hash or if the action target function returns true. - **/ + * Triggers a named action on the ActionHandler. Any parameters supplied after the actionName + * string will be passed as arguments to the action target function. + * + * If the ActionHandler has its target property set, actions may bubble to the target. + * Bubbling happens when an actionName can not be found in the ActionHandler's actions + * hash or if the action target function returns true. + */ send(actionName: string, ...args: any[]): void; /** - The collection of functions, keyed by name, available on this ActionHandler as action targets. - **/ + * The collection of functions, keyed by name, available on this ActionHandler as action targets. + */ actions: ActionsHash; } const ActionHandler: EmberMixin; /** - An instance of Ember.Application is the starting point for every Ember application. It helps to - instantiate, initialize and coordinate the many objects that make up your app. - **/ + * An instance of Ember.Application is the starting point for every Ember application. It helps to + * instantiate, initialize and coordinate the many objects that make up your app. + */ class Application extends Engine { /** - Call advanceReadiness after any asynchronous setup logic has completed. - Each call to deferReadiness must be matched by a call to advanceReadiness - or the application will never become ready and routing will not begin. - **/ + * Call advanceReadiness after any asynchronous setup logic has completed. + * Each call to deferReadiness must be matched by a call to advanceReadiness + * or the application will never become ready and routing will not begin. + */ advanceReadiness(): void; /** - Use this to defer readiness until some condition is true. - - This allows you to perform asynchronous setup logic and defer - booting your application until the setup has finished. - - However, if the setup requires a loading UI, it might be better - to use the router for this purpose. - */ + * Use this to defer readiness until some condition is true. + * + * This allows you to perform asynchronous setup logic and defer + * booting your application until the setup has finished. + * + * However, if the setup requires a loading UI, it might be better + * to use the router for this purpose. + */ deferReadiness(): void; /** - defines an injection or typeInjection - **/ + * defines an injection or typeInjection + */ inject(factoryNameOrType: string, property: string, injectionName: string): void; /** - This injects the test helpers into the window's scope. If a function of the - same name has already been defined it will be cached (so that it can be reset - if the helper is removed with `unregisterHelper` or `removeTestHelpers`). - Any callbacks registered with `onInjectHelpers` will be called once the - helpers have been injected. - **/ + * This injects the test helpers into the window's scope. If a function of the + * same name has already been defined it will be cached (so that it can be reset + * if the helper is removed with `unregisterHelper` or `removeTestHelpers`). + * Any callbacks registered with `onInjectHelpers` will be called once the + * helpers have been injected. + */ injectTestHelpers(): void; /** - registers a factory for later injection - @param fullName type:name (e.g., 'model:user') - @param factory (e.g., App.Person) - **/ - register(fullName: string, factory: Function, options?: {}): void; + * registers a factory for later injection + * @param fullName type:name (e.g., 'model:user') + * @param factory (e.g., App.Person) + */ + register(fullName: string, factory: any): void; /** - This removes all helpers that have been registered, and resets and functions - that were overridden by the helpers. - **/ + * This removes all helpers that have been registered, and resets and functions + * that were overridden by the helpers. + */ removeTestHelpers(): void; /** - Reset the application. This is typically used only in tests. - **/ + * Reset the application. This is typically used only in tests. + */ reset(): void; /** - This hook defers the readiness of the application, so that you can start - the app when your tests are ready to run. It also sets the router's - location to 'none', so that the window's location will not be modified - (preventing both accidental leaking of state between tests and interference - with your testing framework). - **/ + * This hook defers the readiness of the application, so that you can start + * the app when your tests are ready to run. It also sets the router's + * location to 'none', so that the window's location will not be modified + * (preventing both accidental leaking of state between tests and interference + * with your testing framework). + */ setupForTesting(): void; /** - The DOM events for which the event dispatcher should listen. - */ + * The DOM events for which the event dispatcher should listen. + */ customEvents: EventDispatcherEvents; /** - The Ember.EventDispatcher responsible for delegating events to this application's views. - **/ + * The Ember.EventDispatcher responsible for delegating events to this application's views. + */ eventDispatcher: EventDispatcher; /** - Set this to provide an alternate class to Ember.DefaultResolver - **/ + * Set this to provide an alternate class to Ember.DefaultResolver + */ resolver: DefaultResolver; /** - The root DOM element of the Application. This can be specified as an - element or a jQuery-compatible selector string. - - This is the element that will be passed to the Application's, eventDispatcher, - which sets up the listeners for event delegation. Every view in your application - should be a child of the element you specify here. - **/ + * The root DOM element of the Application. This can be specified as an + * element or a jQuery-compatible selector string. + * + * This is the element that will be passed to the Application's, eventDispatcher, + * which sets up the listeners for event delegation. Every view in your application + * should be a child of the element you specify here. + */ rootElement: HTMLElement | string; /** - Called when the Application has become ready. - The call will be delayed until the DOM has become ready. - **/ - ready: Function; + * Called when the Application has become ready. + * The call will be delayed until the DOM has become ready. + */ + ready: (...args: any[]) => any; /** - Application's router. - **/ + * Application's router. + */ Router: Router; registry: Registry; /** @@ -492,21 +491,21 @@ declare module 'ember' { buildInstance(options?: object): ApplicationInstance; } /** - The `ApplicationInstance` encapsulates all of the stateful aspects of a - running `Application`. - **/ + * The `ApplicationInstance` encapsulates all of the stateful aspects of a + * running `Application`. + */ class ApplicationInstance extends EngineInstance {} /** - AutoLocation will select the best location option based off browser support with the priority order: history, hash, none. - **/ + * AutoLocation will select the best location option based off browser support with the priority order: history, hash, none. + */ class AutoLocation extends Object {} /** * Connects the properties of two objects so that whenever the value of one property changes, * the other property will be changed also. * * @deprecated https://emberjs.com/deprecations/v2.x#toc_ember-binding - **/ + */ class Binding { constructor(toPath: string, fromPath: string); connect(obj: any): Binding; @@ -517,9 +516,9 @@ declare module 'ember' { toString(): string; } /** - The internal class used to create text inputs when the {{input}} helper is used - with type of checkbox. See Handlebars.helpers.input for usage details. - **/ + * The internal class used to create text inputs when the {{input}} helper is used + * with type of checkbox. See Handlebars.helpers.input for usage details. + */ class Checkbox extends Component {} /** * Implements some standard methods for comparing objects. Add this mixin to @@ -530,10 +529,10 @@ declare module 'ember' { } const Comparable: EmberMixin; /** - A view that is completely isolated. Property access in its templates go to the view object - and actions are targeted at the view object. There is no access to the surrounding context or - outer controller; all contextual information is passed in. - **/ + * A view that is completely isolated. Property access in its templates go to the view object + * and actions are targeted at the view object. There is no access to the surrounding context or + * outer controller; all contextual information is passed in. + */ class Component extends CoreView.extend(ViewMixin, ActionSupport, ClassNamesSupport) { // methods readDOMAttr(name: string): string; @@ -616,9 +615,9 @@ declare module 'ember' { factoryFor(fullName: string, options?: {}): any; } /** - The ContainerDebugAdapter helps the container and resolver interface - with tools that debug Ember such as the Ember Inspector for Chrome and Firefox. - **/ + * The ContainerDebugAdapter helps the container and resolver interface + * with tools that debug Ember such as the Ember Inspector for Chrome and Firefox. + */ class ContainerDebugAdapter extends Object { resolver: Resolver; canCatalogEntriesByType(type: string): boolean; @@ -636,7 +635,7 @@ declare module 'ember' { scope?: QueryParamScopeTypes, as?: string }}>; - target: Object; + target: object; } const ControllerMixin: EmberMixin; class Controller extends Object.extend(ControllerMixin) {} @@ -792,8 +791,8 @@ declare module 'ember' { } /** - A subclass of the JavaScript Error object for use in Ember. - **/ + * A subclass of the JavaScript Error object for use in Ember. + */ const Error: ErrorConstructor; /** * `Ember.EventDispatcher` handles delegating browser events to their @@ -859,7 +858,7 @@ declare module 'ember' { * for Ember. */ const Instrumentation: { - instrument(name: string, payload: any, callback: Function, binding: any): void; + instrument(name: string, payload: any, callback: (...args: any[]) => any, binding: any): void; reset(): void; subscribe(pattern: string, object: any): void; unsubscribe(subscriber: any): void; @@ -952,7 +951,7 @@ declare module 'ember' { class Map { copy(): Map; static create(): Map; - forEach(callback: Function, self: any): void; + forEach(callback: (...args: any[]) => any, self: any): void; get(key: any): any; has(key: any): boolean; set(key: any, value: any): void; @@ -993,7 +992,7 @@ declare module 'ember' { clear(): void; copy(): OrderedSet; static create(): OrderedSet; - forEach(fn: Function, self: any): void; + forEach(fn: (...args: any[]) => any, self: any): void; has(obj: any): boolean; isEmpty(): boolean; toArray(): any[]; @@ -1012,41 +1011,41 @@ declare module 'ember' { } class Resolver extends Ember.Object {} /** - The `Ember.Route` class is used to define individual routes. Refer to - the [routing guide](http://emberjs.com/guides/routing/) for documentation. - */ + * The `Ember.Route` class is used to define individual routes. Refer to + * the [routing guide](http://emberjs.com/guides/routing/) for documentation. + */ class Route extends Object.extend(ActionHandler, Evented) { // methods /** - This hook is called after this route's model has resolved. - It follows identical async/promise semantics to `beforeModel` - but is provided the route's resolved model in addition to - the `transition`, and is therefore suited to performing - logic that can only take place after the model has already - resolved. - */ + * This hook is called after this route's model has resolved. + * It follows identical async/promise semantics to `beforeModel` + * but is provided the route's resolved model in addition to + * the `transition`, and is therefore suited to performing + * logic that can only take place after the model has already + * resolved. + */ afterModel(resolvedModel: any, transition: Transition): any; /** - This hook is the first of the route entry validation hooks - called when an attempt is made to transition into a route - or one of its children. It is called before `model` and - `afterModel`, and is appropriate for cases when: - 1) A decision can be made to redirect elsewhere without - needing to resolve the model first. - 2) Any async operations need to occur first before the - model is attempted to be resolved. - This hook is provided the current `transition` attempt - as a parameter, which can be used to `.abort()` the transition, - save it for a later `.retry()`, or retrieve values set - on it from a previous hook. You can also just call - `this.transitionTo` to another route to implicitly - abort the `transition`. - You can return a promise from this hook to pause the - transition until the promise resolves (or rejects). This could - be useful, for instance, for retrieving async code from - the server that is required to enter a route. - */ + * This hook is the first of the route entry validation hooks + * called when an attempt is made to transition into a route + * or one of its children. It is called before `model` and + * `afterModel`, and is appropriate for cases when: + * 1) A decision can be made to redirect elsewhere without + * needing to resolve the model first. + * 2) Any async operations need to occur first before the + * model is attempted to be resolved. + * This hook is provided the current `transition` attempt + * as a parameter, which can be used to `.abort()` the transition, + * save it for a later `.retry()`, or retrieve values set + * on it from a previous hook. You can also just call + * `this.transitionTo` to another route to implicitly + * abort the `transition`. + * You can return a promise from this hook to pause the + * transition until the promise resolves (or rejects). This could + * be useful, for instance, for retrieving async code from + * the server that is required to enter a route. + */ beforeModel(transition: Transition): any; /** @@ -1394,11 +1393,11 @@ declare module 'ember' { * in as the only argument. */ interface TextSupport extends TargetActionSupport { - cancel(event: Function): void; - focusIn(event: Function): void; - focusOut(event: Function): void; - insertNewLine(event: Function): void; - keyPress(event: Function): void; + cancel(event: (...args: any[]) => any): void; + focusIn(event: (...args: any[]) => any): void; + focusOut(event: (...args: any[]) => any): void; + insertNewLine(event: (...args: any[]) => any): void; + keyPress(event: (...args: any[]) => any): void; action: string; bubbles: boolean; onEvent: string; @@ -1406,15 +1405,15 @@ declare module 'ember' { const TextSupport: Mixin; interface Transition { /** - Aborts the Transition. Note you can also implicitly abort a transition - by initiating another transition while a previous one is underway. - */ + * Aborts the Transition. Note you can also implicitly abort a transition + * by initiating another transition while a previous one is underway. + */ abort(): Transition; /** - Retries a previously-aborted transition (making sure to abort the - transition if it's still active). Returns a new transition that - represents the new attempt to transition. - */ + * Retries a previously-aborted transition (making sure to abort the + * transition if it's still active). Returns a new transition that + * represents the new attempt to transition. + */ retry(): Transition; } interface ViewTargetActionSupport { @@ -1582,7 +1581,7 @@ declare module 'ember' { const String: boolean; } namespace Handlebars { - function compile(string: string): Function; + function compile(string: string): (...args: any[]) => any; function compile(environment: any, options?: any, context?: any, asObject?: any): any; function precompile(string: string, options: any): void; class Compiler {} @@ -2005,7 +2004,7 @@ declare module 'ember' { * Detects when a specific package of Ember (e.g. 'Ember.Application') * has fully loaded and is available for extension. */ - function onLoad(name: string, callback: Function): any; + function onLoad(name: string, callback: (...args: any[]) => any): any; /** * Called when an Ember.js package (e.g Ember.Application) has finished * loading. Triggers any callbacks registered for this event. @@ -2098,44 +2097,44 @@ declare module 'ember' { export class RouterService extends Ember.Service { // /** - Name of the current route. - This property represent the logical name of the route, - which is comma separated. - For the following router: - ```app/router.js - Router.map(function() { - this.route('about'); - this.route('blog', function () { - this.route('post', { path: ':post_id' }); - }); - }); - ``` - It will return: - * `index` when you visit `/` - * `about` when you visit `/about` - * `blog.index` when you visit `/blog` - * `blog.post` when you visit `/blog/some-post-id` - */ + * Name of the current route. + * This property represent the logical name of the route, + * which is comma separated. + * For the following router: + * ```app/router.js + * Router.map(function() { + * this.route('about'); + * this.route('blog', function () { + * this.route('post', { path: ':post_id' }); + * }); + * }); + * ``` + * It will return: + * * `index` when you visit `/` + * * `about` when you visit `/about` + * * `blog.index` when you visit `/blog` + * * `blog.post` when you visit `/blog/some-post-id` + */ readonly currentRouteName: string; // /** - Current URL for the application. - This property represent the URL path for this route. - For the following router: - ```app/router.js - Router.map(function() { - this.route('about'); - this.route('blog', function () { - this.route('post', { path: ':post_id' }); - }); - }); - ``` - It will return: - * `/` when you visit `/` - * `/about` when you visit `/about` - * `/blog` when you visit `/blog` - * `/blog/some-post-id` when you visit `/blog/some-post-id` - */ + * Current URL for the application. + * This property represent the URL path for this route. + * For the following router: + * ```app/router.js + * Router.map(function() { + * this.route('about'); + * this.route('blog', function () { + * this.route('post', { path: ':post_id' }); + * }); + * }); + * ``` + * It will return: + * * `/` when you visit `/` + * * `/about` when you visit `/about` + * * `/blog` when you visit `/blog` + * * `/blog/some-post-id` when you visit `/blog/some-post-id` + */ readonly currentURL: string; // /** @@ -2292,6 +2291,7 @@ declare module '@ember/controller' { // A type registry for Ember `Controller`s. Meant to be declaration-merged // so string lookups resolve to the correct type. + // tslint:disable-next-line:no-empty-interface export interface Registry {} } @@ -2403,6 +2403,7 @@ declare module '@ember/service' { // A type registry for Ember `Service`s. Meant to be declaration-merged so // string lookups resolve to the correct type. + // tslint:disable-next-line:no-empty-interface interface Registry {} } diff --git a/types/ember/test/application-instance.ts b/types/ember/test/application-instance.ts index 9ae22e5f26..4ee5cb2027 100644 --- a/types/ember/test/application-instance.ts +++ b/types/ember/test/application-instance.ts @@ -24,6 +24,6 @@ appInstance.lookup('route:basic'); appInstance.boot(); -(async function() { +(async () => { await appInstance.boot(); -}()); +})(); diff --git a/types/ember/test/application.ts b/types/ember/test/application.ts index fe4152c01a..414be66660 100755 --- a/types/ember/test/application.ts +++ b/types/ember/test/application.ts @@ -1,7 +1,7 @@ import Ember from 'ember'; import { assertType } from "./lib/assert"; -let BaseApp = Ember.Application.extend({ +const BaseApp = Ember.Application.extend({ modulePrefix: 'my-app' }); @@ -19,14 +19,14 @@ BaseApp.instanceInitializer({ } }); -let App1 = BaseApp.create({ +const App1 = BaseApp.create({ rootElement: '#app-one', customEvents: { paste: 'paste' } }); -let App2 = BaseApp.create({ +const App2 = BaseApp.create({ rootElement: '#app-two', customEvents: { mouseenter: null, @@ -34,8 +34,8 @@ let App2 = BaseApp.create({ } }); -let App3 = BaseApp.create(); +const App3 = BaseApp.create(); -let App3Instance1 = App3.buildInstance(); +const App3Instance1 = App3.buildInstance(); -let App3Instance2 = App3.buildInstance({ foo: 'bar' }); +const App3Instance2 = App3.buildInstance({ foo: 'bar' }); diff --git a/types/ember/test/array-proxy.ts b/types/ember/test/array-proxy.ts index dceea7b847..d3167323ff 100644 --- a/types/ember/test/array-proxy.ts +++ b/types/ember/test/array-proxy.ts @@ -21,6 +21,6 @@ class MyNewProxy extends Ember.ArrayProxy { isNew = true; } -let x = MyNewProxy.create({ content: Ember.A([1, 2, 3]) }) as MyNewProxy; +const x = MyNewProxy.create({ content: Ember.A([1, 2, 3]) }) as MyNewProxy; assertType(x.get('firstObject')); assertType(x.isNew); diff --git a/types/ember/test/array.ts b/types/ember/test/array.ts index 8416a4a9ec..a56e428387 100755 --- a/types/ember/test/array.ts +++ b/types/ember/test/array.ts @@ -42,7 +42,7 @@ const codes: number[] = letters.map((item, index, enumerable) => { return item.charCodeAt(0); }); -let value = '1,2,3'; -let filters = Ember.A(value.split(',')); +const value = '1,2,3'; +const filters = Ember.A(value.split(',')); filters.push('4'); filters.sort(); diff --git a/types/ember/test/computed.ts b/types/ember/test/computed.ts index f93b07a0f5..347e2c61e2 100755 --- a/types/ember/test/computed.ts +++ b/types/ember/test/computed.ts @@ -23,7 +23,7 @@ const Person = Ember.Object.extend({ return this.get('fullName'); }, set(key, value) { - let [first, last] = value.split(' '); + const [first, last] = value.split(' '); this.set('firstName', first); this.set('lastName', last); return value; @@ -38,7 +38,7 @@ const Person = Ember.Object.extend({ fullNameSetOnly: Ember.computed('firstName', 'lastName', { set(key, value) { - let [first, last] = value.split(' '); + const [first, last] = value.split(' '); this.set('firstName', first); this.set('lastName', last); return value; diff --git a/types/ember/test/debug.ts b/types/ember/test/debug.ts index b3f4bb5f17..e71beba975 100644 --- a/types/ember/test/debug.ts +++ b/types/ember/test/debug.ts @@ -12,7 +12,7 @@ const { * @ember/debug tests */ runInDebug(); // $ExpectError -let x = runInDebug(() => console.log('Should not show up in prod')); // $ExpectType void +runInDebug(() => console.log('Should not show up in prod')); // $ExpectType void // Log a warning if we have more than 3 tomsters const tomsterCount = 2; diff --git a/types/ember/test/detect-instance.ts b/types/ember/test/detect-instance.ts index 1b25beb244..67b379a113 100755 --- a/types/ember/test/detect-instance.ts +++ b/types/ember/test/detect-instance.ts @@ -9,7 +9,7 @@ class ES6Class extends Ember.Object { bar: string; } -let testObject = null; +const testObject = null; if (ExtendClass.detectInstance(testObject)) { assertType(testObject.foo); diff --git a/types/ember/test/detect.ts b/types/ember/test/detect.ts index cd54880f9f..5b23c10a20 100755 --- a/types/ember/test/detect.ts +++ b/types/ember/test/detect.ts @@ -9,7 +9,7 @@ class ES6Class extends Ember.Object { bar: string; } -let TestClass = Ember.Object; +const TestClass = Ember.Object; if (ExtendClass.detect(TestClass)) { assertType(TestClass.create().foo); diff --git a/types/ember/test/ember-tests.ts b/types/ember/test/ember-tests.ts index c78cb282a2..01aaab7452 100755 --- a/types/ember/test/ember-tests.ts +++ b/types/ember/test/ember-tests.ts @@ -136,7 +136,7 @@ people2.isAny('isHappy', 'true'); people2.isAny('isHappy'); // Examples taken from http://emberjs.com/api/classes/Em.RSVP.Promise.html -const promise = new Ember.RSVP.Promise((resolve: Function, reject: Function) => { +const promise = new Ember.RSVP.Promise((resolve: (...args: any[]) => any, reject: (...args: any[]) => any) => { // on success resolve('ok!'); diff --git a/types/ember/test/engine-instance.ts b/types/ember/test/engine-instance.ts index c74914dea5..6358377639 100644 --- a/types/ember/test/engine-instance.ts +++ b/types/ember/test/engine-instance.ts @@ -21,6 +21,6 @@ engineInstance.lookup('route:basic'); engineInstance.boot(); -(async function() { +(async () => { await engineInstance.boot(); -}()); +})(); diff --git a/types/ember/test/engine.ts b/types/ember/test/engine.ts index 508bd3be4d..49030ea511 100755 --- a/types/ember/test/engine.ts +++ b/types/ember/test/engine.ts @@ -1,7 +1,7 @@ import Ember from 'ember'; import { assertType } from "./lib/assert"; -let BaseEngine = Ember.Engine.extend({ +const BaseEngine = Ember.Engine.extend({ modulePrefix: 'my-engine' }); @@ -19,14 +19,14 @@ BaseEngine.instanceInitializer({ } }); -let Engine1 = BaseEngine.create({ +const Engine1 = BaseEngine.create({ rootElement: '#engine-one', customEvents: { paste: 'paste' } }); -let Engine2 = BaseEngine.create({ +const Engine2 = BaseEngine.create({ rootElement: '#engine-two', customEvents: { mouseenter: null, @@ -34,8 +34,8 @@ let Engine2 = BaseEngine.create({ } }); -let Engine3 = BaseEngine.create(); +const Engine3 = BaseEngine.create(); -let Engine3Instance1 = Engine3.buildInstance(); +const Engine3Instance1 = Engine3.buildInstance(); -let Engine3Instance2 = Engine3.buildInstance({ foo: 'bar' }); +const Engine3Instance2 = Engine3.buildInstance({ foo: 'bar' }); diff --git a/types/ember/test/event.ts b/types/ember/test/event.ts index c934072440..97e68c52c8 100755 --- a/types/ember/test/event.ts +++ b/types/ember/test/event.ts @@ -1,42 +1,42 @@ import Ember from 'ember'; function testOn() { - let Job = Ember.Object.extend({ - logCompleted: Ember.on('completed', function() { + const Job = Ember.Object.extend({ + logCompleted: Ember.on('completed', () => { console.log('Job completed!'); }) }); - let job = Job.create(); + const job = Job.create(); Ember.sendEvent(job, 'completed'); // Logs 'Job completed!' } function testEvented() { - let Person = Ember.Object.extend(Ember.Evented, { + const Person = Ember.Object.extend(Ember.Evented, { greet() { this.trigger('greet'); } }); - let person = Person.create(); + const person = Person.create(); - person.on('greet', function() { + person.on('greet', () => { console.log('Our person has greeted'); }); - person.on('greet', function() { + person.on('greet', () => { console.log('Our person has greeted'); - }).one('greet', function() { + }).one('greet', () => { console.log('Offer one-time special'); - }).off('event', {}, function() {}); + }).off('event', {}, () => {}); person.greet(); } function testObserver() { Ember.Object.extend({ - valueObserver: Ember.observer('value', function() { + valueObserver: Ember.observer('value', () => { // Executes whenever the "value" property changes }) }); diff --git a/types/ember/test/function-ext.ts b/types/ember/test/function-ext.ts index 37d831d49a..77fd35c5d2 100755 --- a/types/ember/test/function-ext.ts +++ b/types/ember/test/function-ext.ts @@ -1,12 +1,14 @@ import Ember from 'ember'; declare global { + // tslint:disable-next-line:no-empty-interface interface Function extends Ember.FunctionPrototypeExtensions {} } Ember.Object.extend({ foo: '', + // tslint:disable-next-line:only-arrow-functions arr: function() { return []; }.property(), @@ -15,7 +17,9 @@ Ember.Object.extend({ return this.get('foo'); }.property('foo', 'bar.@each.baz'), + // tslint:disable-next-line:only-arrow-functions observer: function() {}.observes('foo', 'bar'), + // tslint:disable-next-line:only-arrow-functions on: function() {}.on('foo', 'bar'), }); diff --git a/types/ember/test/helper.ts b/types/ember/test/helper.ts index 2aa79a5ba1..4743841e31 100755 --- a/types/ember/test/helper.ts +++ b/types/ember/test/helper.ts @@ -1,8 +1,8 @@ import Ember from 'ember'; -const FormatCurrencyHelper = Ember.Helper.helper(function(params, hash: { currency: string }) { - let cents = params[0]; - let currency = hash.currency; +const FormatCurrencyHelper = Ember.Helper.helper((params, hash: { currency: string }) => { + const cents = params[0]; + const currency = hash.currency; return `${currency}${cents * 0.01}`; }); diff --git a/types/ember/test/object.ts b/types/ember/test/object.ts index 4547bd40af..060bf8ca81 100755 --- a/types/ember/test/object.ts +++ b/types/ember/test/object.ts @@ -34,8 +34,8 @@ class Foo extends Ember.Object.extend({ }) { b = 5; baz() { - let y = this.b; // $ExpectType number - let z = this.a; // $ExpectType ComputedProperty + const y = this.b; // $ExpectType number + const z = this.a; // $ExpectType ComputedProperty this.b = 10; this.get('b').toFixed(4); // $ExpectType string this.set('a', 'abc').split(','); // $ExpectType string[] @@ -54,10 +54,10 @@ export class Foo2 extends Ember.Object { name!: string; changeName(name: string) { - let a: string = this.set('name', name); - let b: number = this.set('name', name); // $ExpectError - let x: string = Ember.set(this, 'name', name); - let y: number = Ember.set(this, 'name', name); // $ExpectError + const a: string = this.set('name', name); + const b: number = this.set('name', name); // $ExpectError + const x: string = Ember.set(this, 'name', name); + const y: number = Ember.set(this, 'name', name); // $ExpectError this.setProperties({ name }); diff --git a/types/ember/test/private/computed-tests.ts b/types/ember/test/private/computed-tests.ts index 38bf1088df..fc810e64ff 100644 --- a/types/ember/test/private/computed-tests.ts +++ b/types/ember/test/private/computed-tests.ts @@ -21,13 +21,13 @@ class Example1 extends Ember.Object.extend({ fullName!: Ember.ComputedProperty; } -let unwrappedGetters1: UnwrapComputedPropertyGetters = {} as any; +const unwrappedGetters1: UnwrapComputedPropertyGetters = {} as any; unwrappedGetters1.firstName; // $ExpectType string unwrappedGetters1.lastName; // $ExpectType string unwrappedGetters1.fullName; // $ExpectType string unwrappedGetters1.allNames; // $ExpectType string[] -let unwrappedSetters1: UnwrapComputedPropertySetters = {} as any; +const unwrappedSetters1: UnwrapComputedPropertySetters = {} as any; unwrappedSetters1.firstName; // $ExpectType string unwrappedSetters1.lastName; // $ExpectType string unwrappedSetters1.fullName; // $ExpectType string @@ -55,17 +55,15 @@ class Example2 extends Ember.Object.extend({ this.get('lastName').split(','); // $ExpectType string[] } } -let ex2 = new Example2(); +const ex2 = new Example2(); -let unwrappedGetters2: UnwrapComputedPropertyGetters< - typeof ex2 -> = (ex2 as any) as UnwrapComputedPropertyGetters; +const unwrappedGetters2: UnwrapComputedPropertyGetters = (ex2 as any) as UnwrapComputedPropertyGetters; assertType(unwrappedGetters2.firstName); // $ExpectType string assertType(unwrappedGetters2.lastName); // $ExpectType string assertType(unwrappedGetters2.fullName); // $ExpectType string assertType(unwrappedGetters2.allNames); // $ExpectType string[] -let unwrappedSetters2: UnwrapComputedPropertySetters = null as any; +const unwrappedSetters2: UnwrapComputedPropertySetters = null as any; assertType(unwrappedSetters2.firstName); // $ExpectType string assertType(unwrappedSetters2.lastName); // $ExpectType string assertType(unwrappedSetters2.fullName); // $ExpectType string diff --git a/types/ember/test/reopen.ts b/types/ember/test/reopen.ts index fb4857b88d..501309d74d 100755 --- a/types/ember/test/reopen.ts +++ b/types/ember/test/reopen.ts @@ -12,7 +12,7 @@ const Person = Ember.Object.extend({ assertType(Person.reopen()); assertType(Person.create().name); -assertType(Person.create().sayHello()); +Person.create().sayHello(); // $ExpectType void const Person2 = Person.reopenClass({ species: 'Homo sapiens', @@ -23,16 +23,16 @@ const Person2 = Person.reopenClass({ }); assertType(Person2.create().name); -assertType(Person2.create().sayHello()); +Person2.create().sayHello(); // $ExpectType void assertType(Person2.species); -let tom = Person2.create({ +const tom = Person2.create({ name: 'Tom Dale' }); -let badTom = Person2.create({ name: 99 }); // $ExpectError +const badTom = Person2.create({ name: 99 }); // $ExpectError -let yehuda = Person2.createPerson('Yehuda Katz'); +const yehuda = Person2.createPerson('Yehuda Katz'); tom.sayHello(); // "Hello. My name is Tom Dale" yehuda.sayHello(); // "Hello. My name is Yehuda Katz" diff --git a/types/ember/test/route.ts b/types/ember/test/route.ts index 84e432dbd3..2256ee3561 100755 --- a/types/ember/test/route.ts +++ b/types/ember/test/route.ts @@ -3,7 +3,9 @@ import Object from '@ember/object'; import Array from '@ember/array'; import Ember from 'ember'; // currently needed for Transition -interface Post extends Ember.Object {} +interface Post extends Ember.Object { + title: string; +} interface Posts extends Array {} diff --git a/types/ember/test/run.ts b/types/ember/test/run.ts index 8d1c82e6e3..596ad5eb07 100755 --- a/types/ember/test/run.ts +++ b/types/ember/test/run.ts @@ -6,7 +6,7 @@ import { assertType } from "./lib/assert"; assertType(Ember.run.queues); function testRun() { - let r = run(function() { + const r = run(() => { // code to be executed within a RunLoop return 123; }); @@ -38,43 +38,43 @@ function testBind() { function testCancel() { const myContext = {}; - let runNext = run.next(myContext, function() { + const runNext = run.next(myContext, () => { // will not be executed }); run.cancel(runNext); - let runLater = run.later(myContext, function() { + const runLater = run.later(myContext, () => { // will not be executed }, 500); run.cancel(runLater); - let runScheduleOnce = run.scheduleOnce('afterRender', myContext, function() { + const runScheduleOnce = run.scheduleOnce('afterRender', myContext, () => { // will not be executed }); run.cancel(runScheduleOnce); - let runOnce = run.once(myContext, function() { + const runOnce = run.once(myContext, () => { // will not be executed }); run.cancel(runOnce); - let throttle = run.throttle(myContext, function() { + const throttle = run.throttle(myContext, () => { // will not be executed }, 1, false); run.cancel(throttle); - let debounce = run.debounce(myContext, function() { + const debounce = run.debounce(myContext, () => { // will not be executed }, 1); run.cancel(debounce); - let debounceImmediate = run.debounce(myContext, function() { + const debounceImmediate = run.debounce(myContext, () => { // will be executed since we passed in true (immediate) }, 100, true); @@ -86,7 +86,7 @@ function testDebounce() { function runIt() { } - let myContext = { name: 'debounce' }; + const myContext = { name: 'debounce' }; run.debounce(runIt, 150); run.debounce(myContext, runIt, 150); @@ -112,20 +112,20 @@ function testBegin() { } function testJoin() { - run.join(function() { + run.join(() => { // creates a new run-loop }); - run(function() { + run(() => { // creates a new run-loop - run.join(function() { + run.join(() => { // joins with the existing run-loop, and queues for invocation on // the existing run-loops action queue. }); }); - new RSVP.Promise(function(resolve) { - Ember.run.later(function() { + new RSVP.Promise((resolve) => { + Ember.run.later(() => { resolve({ msg: 'Hold Your Horses' }); }, 3000); }); @@ -133,14 +133,14 @@ function testJoin() { function testLater() { const myContext = {}; - run.later(myContext, function() { + run.later(myContext, () => { // code here will execute within a RunLoop in about 500ms with this == myContext }, 500); } function testNext() { const myContext = {}; - run.next(myContext, function() { + run.next(myContext, () => { // code to be executed in the next run loop, // which will be scheduled after the current one }); @@ -160,12 +160,12 @@ function testOnce() { function testSchedule() { Ember.Component.extend({ init() { - run.schedule('sync', this, function() { + run.schedule('sync', this, () => { // this will be executed in the first RunLoop queue, when bindings are synced console.log('scheduled on sync queue'); }); - run.schedule('actions', this, function() { + run.schedule('actions', this, () => { // this will be executed in the 'actions' queue, after bindings have synced. console.log('scheduled on actions queue'); }); @@ -183,12 +183,12 @@ function testScheduleOnce() { } const myContext = {}; - run(function() { + run(() => { run.scheduleOnce('afterRender', myContext, sayHi); run.scheduleOnce('afterRender', myContext, sayHi); // sayHi will only be executed once, in the afterRender queue of the RunLoop }); - run.scheduleOnce('actions', myContext, function() { + run.scheduleOnce('actions', myContext, () => { console.log('Closure'); }); } @@ -197,7 +197,7 @@ function testThrottle() { function runIt() { } - let myContext = { name: 'throttle' }; + const myContext = { name: 'throttle' }; run.throttle(runIt, 150); run.throttle(myContext, runIt, 150); diff --git a/types/ember/test/string-ext.ts b/types/ember/test/string-ext.ts index e4ac77d5b4..6d625fd670 100644 --- a/types/ember/test/string-ext.ts +++ b/types/ember/test/string-ext.ts @@ -1,6 +1,7 @@ import Ember from 'ember'; declare global { + // tslint:disable-next-line:no-empty-interface interface String extends Ember.StringPrototypeExtensions {} } diff --git a/types/ember/test/test.ts b/types/ember/test/test.ts index 6cd1b2b908..a0decd2699 100755 --- a/types/ember/test/test.ts +++ b/types/ember/test/test.ts @@ -1,6 +1,6 @@ import Ember from 'ember'; -let pending = 0; +const pending = 0; Ember.Test.registerWaiter(() => pending !== 0); declare const MyDb: { @@ -8,15 +8,15 @@ declare const MyDb: { }; Ember.Test.registerWaiter(MyDb, MyDb.hasPendingTransactions); -Ember.Test.promise(function(resolve) { +Ember.Test.promise((resolve) => { window.setTimeout(resolve, 500); }); -Ember.Test.registerHelper('boot', function(app) { +Ember.Test.registerHelper('boot', (app) => { Ember.run(app, app.advanceReadiness); }); -Ember.Test.registerAsyncHelper('boot', function(app) { +Ember.Test.registerAsyncHelper('boot', (app) => { Ember.run(app, app.advanceReadiness); }); diff --git a/types/ember/test/transition.ts b/types/ember/test/transition.ts index 3a64675c24..47d171e250 100755 --- a/types/ember/test/transition.ts +++ b/types/ember/test/transition.ts @@ -15,7 +15,7 @@ Ember.Controller.extend({ actions: { login() { // Log the user in, then reattempt previous transition if it exists. - let previousTransition = this.get('previousTransition'); + const previousTransition = this.get('previousTransition'); if (previousTransition) { this.set('previousTransition', null); previousTransition.retry(); diff --git a/types/ember/test/utils.ts b/types/ember/test/utils.ts index 212de9fbb6..ef38424152 100755 --- a/types/ember/test/utils.ts +++ b/types/ember/test/utils.ts @@ -53,7 +53,7 @@ function testAssign() { } function testOnError() { - Ember.onerror = function(error) { + Ember.onerror = (error) => { Ember.$.post('/report-error', { stack: error.stack, otherInformation: 'whatever app state you want to provide' @@ -66,7 +66,7 @@ function testDeprecateFunc() { return ''; } - let oldMethod = Ember.deprecateFunc('Please use the new method', { id: 'deprecated.id', until: '6.0' }, newMethod); + const oldMethod = Ember.deprecateFunc('Please use the new method', { id: 'deprecated.id', until: '6.0' }, newMethod); assertType(newMethod('first', 123)); assertType(oldMethod('first', 123)); } @@ -119,9 +119,8 @@ function testTryInvoke() { Ember.tryInvoke(new Foo(), 'add', ['4', 3]); // $ExpectType undefined } -(function() { +(() => { /** typeOf */ - // TODO: more specific return type in @types/ember https://github.com/typed-ember/ember-cli-typescript/issues/259 Ember.typeOf(); // $ExpectType "undefined" Ember.typeOf(null); // $ExpectType "null" Ember.typeOf(undefined); // $ExpectType "undefined" @@ -145,7 +144,7 @@ function testTryInvoke() { Ember.typeOf((new Date()) as RegExp | Date); // "regexp" | "date" })(); -(function() { /* assign */ +(() => { /* assign */ Ember.assign({}, { a: 'b'}); Ember.assign({}, { a: 'b'}).a; // $ExpectType string Ember.assign({ a: 6 }, { a: 'b'}).a; // $ExpectType string @@ -156,12 +155,12 @@ function testTryInvoke() { Ember.assign({ a: 'hello' }, { b: 6 }, { a: true }).a; // $ExpectType boolean Ember.assign({ a: 'hello' }, '', { a: true }).a; // $ExpectError Ember.assign({ d: ['gobias industries'] }, { a: 'hello' }, { b: 6 }, { a: true }).d; // $ExpectType string[] -}()); +})(); -(function() { /* merge */ +(() => { /* merge */ Ember.merge({}, { a: 'b'}); Ember.merge({}, { a: 'b'}).a; // $ExpectType string Ember.merge({ a: 6 }, { a: 'b'}).a; // $ExpectType string Ember.merge({ a: 6 }, {}).a; // $ExpectType number Ember.merge({ b: 6 }, {}).a; // $ExpectError -}()); +})(); diff --git a/types/ember/tslint.json b/types/ember/tslint.json index f77f8d2ed8..fa8da19714 100755 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -1,28 +1,12 @@ { "extends": "dtslint/dt.json", "rules": { - // Heavy use of Function type in this older package. - "ban-types": false, - "jsdoc-format": false, - "no-misused-new": false, - // these are disabled because of rfc176 module exports "strict-export-declare-modifiers": false, - "no-single-declare-module": false, "no-declare-current-package": false, "no-self-import": false, - // We use interfaces in a number of places to express things (including - // mixins in particular, but also including extending a global - // interface) which TS currently can't express correctly. - "no-empty-interface": false, - - "no-duplicate-imports": false, "no-unnecessary-qualifier": false, - "prefer-const": false, - "no-void-expression": false, - "only-arrow-functions": false, - "no-submodule-imports": false, // false positives "unified-signatures": false diff --git a/types/gl-matrix/gl-matrix-tests.ts b/types/gl-matrix/gl-matrix-tests.ts index cf9c4ef616..e557acf79d 100644 --- a/types/gl-matrix/gl-matrix-tests.ts +++ b/types/gl-matrix/gl-matrix-tests.ts @@ -74,6 +74,7 @@ outVec2 = vec2.cross(outVec3, vec2A, vec2B); outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5); outVec2 = vec2.random(outVec2); outVec2 = vec2.random(outVec2, 5.0); +outVec2 = vec2.rotate(outVec2, vec2A, vec2B, Math.PI * 0.5); outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A); outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA); outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A); diff --git a/types/gl-matrix/index.d.ts b/types/gl-matrix/index.d.ts index 2c86b6a057..33db200cd6 100644 --- a/types/gl-matrix/index.d.ts +++ b/types/gl-matrix/index.d.ts @@ -374,6 +374,17 @@ declare module 'gl-matrix' { */ public static random(out: vec2, scale: number): vec2; + /** + * Rotate a 2D vector + * + * @param out The receiving vec2 + * @param a The vec2 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + public static rotate(out: vec2, a: vec2, b: vec2, c: number): vec2; + /** * Transforms the vec2 with a mat2 * @@ -1959,13 +1970,13 @@ declare module 'gl-matrix' { * @returns out */ public static transpose(out: mat3, a: mat3): mat3; - + /** * Generates a 2D projection matrix with the given bounds * * @param out the receiving matrix * @param width width of your gl context - * @param height height of gl context + * @param height height of gl context * @returns out */ public static projection(out: mat3, width: number, height: number): mat3; @@ -2510,9 +2521,9 @@ declare module 'gl-matrix' { public static getTranslation(out: vec3, mat: mat4): vec3; /** - * Returns the scaling factor component of a transformation matrix. - * If a matrix is built with fromRotationTranslationScale with a - * normalized Quaternion parameter, the returned vector will be + * Returns the scaling factor component of a transformation matrix. + * If a matrix is built with fromRotationTranslationScale with a + * normalized Quaternion parameter, the returned vector will be * the same as the scaling vector originally supplied. * @param {vec3} out Vector to receive scaling factor component * @param {mat4} mat Matrix to be decomposed (input) diff --git a/types/google-apps-script/google-apps-script.properties.d.ts b/types/google-apps-script/google-apps-script.properties.d.ts index 184c46b28f..af38a01c9f 100644 --- a/types/google-apps-script/google-apps-script.properties.d.ts +++ b/types/google-apps-script/google-apps-script.properties.d.ts @@ -19,7 +19,7 @@ declare namespace GoogleAppsScript { deleteProperty(key: string): Properties; getKeys(): string[]; getProperties(): Object; - getProperty(key: string): string; + getProperty(key: string): string | null; setProperties(properties: Object): Properties; setProperties(properties: Object, deleteAllOthers: boolean): Properties; setProperty(key: string, value: string): Properties; @@ -56,7 +56,7 @@ declare namespace GoogleAppsScript { deleteProperty(key: string): ScriptProperties; getKeys(): string[]; getProperties(): Object; - getProperty(key: string): string; + getProperty(key: string): string | null; setProperties(properties: Object): ScriptProperties; setProperties(properties: Object, deleteAllOthers: boolean): ScriptProperties; setProperty(key: string, value: string): ScriptProperties; @@ -73,7 +73,7 @@ declare namespace GoogleAppsScript { deleteProperty(key: string): UserProperties; getKeys(): string[]; getProperties(): Object; - getProperty(key: string): string; + getProperty(key: string): string | null; setProperties(properties: Object): UserProperties; setProperties(properties: Object, deleteAllOthers: boolean): UserProperties; setProperty(key: string, value: string): UserProperties; diff --git a/types/got/got-tests.ts b/types/got/got-tests.ts index 1eb2d89aa8..610ac87c26 100644 --- a/types/got/got-tests.ts +++ b/types/got/got-tests.ts @@ -258,3 +258,5 @@ got('todomvc', { got(new url.URL('http://todomvc.com')); got(url.parse('http://todomvc.com')); + +got('https://todomvc.com', { rejectUnauthorized: false }); diff --git a/types/got/index.d.ts b/types/got/index.d.ts index 86a3d42131..775985e581 100644 --- a/types/got/index.d.ts +++ b/types/got/index.d.ts @@ -75,7 +75,7 @@ declare const got: got.GotFn & CancelError: typeof CancelError; }; -interface InternalRequestOptions extends http.RequestOptions { +interface InternalRequestOptions extends https.RequestOptions { // Redeclare options with `any` type for allow specify types incompatible with http.RequestOptions. timeout?: any; agent?: any; @@ -93,7 +93,7 @@ declare namespace got { type GotStreamFn = (url: GotUrl, options?: GotOptions) => GotEmitter & nodeStream.Duplex; - type GotUrl = string | http.RequestOptions | Url | URL; + type GotUrl = string | https.RequestOptions | Url | URL; interface GotBodyOptions extends GotOptions { body?: string | Buffer | nodeStream.Readable; diff --git a/types/highcharts/highstock.d.ts b/types/highcharts/highstock.d.ts index a97ae9effa..cc92bebe36 100644 --- a/types/highcharts/highstock.d.ts +++ b/types/highcharts/highstock.d.ts @@ -2,7 +2,8 @@ // Project: http://www.highcharts.com/ // Definitions by: David Deutsch -// Definitions by: Dave Baumann +// Dave Baumann +// Richard Ison // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Highcharts from "highcharts"; @@ -31,11 +32,16 @@ declare namespace Highstock { yAxis?: Highcharts.AxisOptions; } + interface RangeSelectorButtonEvent { + click?(event: Event): void; + } + interface RangeSelectorButton { type: string; // Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'. count?: number; text: string; dataGrouping?: any; // not sure how this works + events?: RangeSelectorButtonEvent; } interface RangeSelectorOptions { diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index a71e07c925..bc6eddbd80 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -59,6 +59,8 @@ declare namespace Highcharts { value: any; isFirst: number; isLast: number; + chart: ChartObject; + axis: AxisObject; } interface AxisLabels { @@ -103,7 +105,8 @@ declare namespace Highcharts { format?: string; /** * Callback JavaScript function to format the label. The value is given by this.value. Additional properties for - * this are axis, chart, isFirst and isLast. + * this are axis, chart, isFirst and isLast. The value of the default label formatter can be retrieved by calling + * this.axis.defaultLabelFormatter.call(this) within the function. * @default function() {return this.value;} */ formatter?(this: AxisLabelFormatterOptions): string; @@ -376,6 +379,316 @@ declare namespace Highcharts { zIndex?: number; } + interface AnnotationsPoint { + /** + * The x position of the point. Units can be either in axis or chart pixel coordinates. + * @default undefined + * @since 6.0.0 + */ + x?: number; + /** + * This number defines which xAxis the point is connected to. + * It refers to either the axis id or the index of the axis in the xAxis array. + * If the option is not configured or the axis is not found the point's x coordinate refers to the chart pixels. + * @default undefined + * @since 6.0.0 + */ + xAxis?: number | string; + /** + * The y position of the point. Units can be either in axis or chart pixel coordinates. + * @default undefined + * @since 6.0.0 + */ + y?: number; + /** + * This number defines which yAxis the point is connected to. + * It refers to either the axis id or the index of the axis in the yAxis array. + * If the option is not configured or the axis is not found the point's y coordinate refers to the chart pixels. + * @default undefined + * @since 6.0.0 + */ + yAxis?: number; + } + + interface AnnotationsLabelOptions { + /** + * The alignment of the annotation's label. If right, the right side of the label should be touching the point. + * @default "center" + * @since 6.0.0 + */ + align?: "left" | "center" | "right"; + /** + * The alignment of the annotation's label. If right, the right side of the label should be touching the point. + * @default false + * @since 6.0.0 + */ + allowOverlap?: boolean; + /** + * The background color or gradient for the annotation's label. + * @default rgba(0, 0, 0, 0.75) + * @since 6.0.0 + */ + backgroundColor?: string | Gradient; + /** + * The border color for the annotation's label. + * @default "black" + * @since 6.0.0 + */ + borderColor?: string | Gradient; + /** + * The border radius in pixels for the annotation's label. + * @default 1 + * @since 6.0.0 + */ + borderRadius?: number; + /** + * The border width in pixels for the annotation's label. + * @default 1 + * @since 6.0.0 + */ + borderWidth?: number; + /** + * Whether to hide the annotation's label that is outside the plot area. + * @default false + * @since 6.0.0 + */ + crop?: boolean; + /** + * The label's pixel distance from the point. + * @default undefined + * @since 6.0.0 + */ + distance?: number; + /** + * A format string for the data label. + * @default undefined + * @since 6.0.0 + */ + format?: string; + /** + * Callback JavaScript function to format the annotation's label. + * Note that if a format or text are defined, the format or text take precedence and the formatter is ignored. + * This refers to a point object. + * @default function () { return defined(this.y) ? this.y : 'Annotation label'; } + * @since 6.0.0 + */ + formatter?: Function; + /** + * How to handle the annotation's label that flow outside the plot area. + * The justify option aligns the label inside the plot area. + * @default "justify + * @since 6.0.0 + */ + overflow?: "justify" | "none"; + /** + * When either the borderWidth or the backgroundColor is set, this is the padding within the box. + * @default 5 + * @since 6.0.0 + */ + padding?: number; + /** + * The shadow of the box. The shadow can be an object configuration containing color, offsetX, offsetY, opacity and width. + * @default false + * @since 6.0.0 + */ + shadow?: + | boolean + | { + color?: string | Gradient; + offsetX?: number; + offsetY?: number; + opacity?: number; + width?: number; + }; + /** + * The name of a symbol to use for the border around the label. Symbols are predefined functions on the Renderer object. + * @default "callout" + * @since 6.0.0 + */ + shape?: "connector" | "rect" | "circle" | "diamond" | "triangle"; + /** + * Styles for the annotation's label. + * @default "callout" + * @since 6.0.0 + */ + style?: { + /** + * @default "contrast" + * @since 6.0.0 + */ + color?: string; + fontFamily?: string; + /** + * @default "11px" + * @since 6.0.0 + */ + fontSize?: string; + /** + * @default "normal" + * @since 6.0.0 + */ + fontWeight?: string; + textAlign?: string; + }; + /** + * Alias for the format option. + * @default undefined + * @since 6.0.0 + */ + text?: string; + /** + * Whether to use HTML to render the annotation's label. + * @default false + * @since 6.0.0 + */ + useHTML?: boolean; + /** + * The vertical alignment of the annotation's label. + * @default "bottom" + * @since 6.0.0 + */ + verticalAlign?: "bottom" | "middle" | "top"; + /** + * The x position offset of the label relative to the point. + * Note that if a distance is defined, the distance takes precedence over x and y options. + * @default 0 + * @since 6.0.0 + */ + x?: number; + /** + * The y position offset of the label relative to the point. + * Note that if a distance is defined, the distance takes precedence over x and y options. + * @default -16 + * @since 6.0.0 + */ + y?: number; + } + + interface AnnotationsLabel extends AnnotationsLabelOptions { + /** + * This option defines the point to which the label will be connected. + * It can be either the point which exists in the series - it is referenced by the point's id + * - or a new point with defined x, y properties and optionally axes. + * @since 6.0.0 + */ + point?: string | AnnotationsPoint; + } + + interface AnnotationsShapeOptions { + /** + * The color of the shape's fill. + * @default rgba(0, 0, 0, 0.75) + * @since 6.0.0 + */ + fill: string; + /** + * The height of the shape. + * @default undefined + * @since 6.0.0 + */ + height: number; + /** + * The radius of the shape. + * @default 0 + * @since 6.0.0 + */ + r: number; + /** + * The color of the shape's stroke. + * @default rgba(0, 0, 0, 0.75) + * @since 6.0.0 + */ + stroke: string; + /** + * The pixel stroke width of the shape. + * @default 1 + * @since 6.0.0 + */ + strokeWidth: number; + /** + * The type of the shape, e.g. circle or rectangle. + * @default "rect" + * @since 6.0.0 + */ + type: "circle" | "path" | "rect"; + /** + * The width of the shape. + * @default undefined + * @since 6.0.0 + */ + width: number; + } + + interface AnnotationsShape extends AnnotationsShapeOptions { + /** + * Id of the marker which will be drawn at the final vertex of the path. Custom markers can be defined in defs property. + * @default undefined + * @since 6.0.0 + */ + markerEnd: string; + /** + * Id of the marker which will be drawn at the final vertex of the path. Custom markers can be defined in defs property. + * @default undefined + * @since 6.0.0 + */ + markerStart: string; + /** + * This option defines the point to which the shape will be connected. + * It can be either the point which exists in the series - it is referenced by the point's id + * - or a new point with defined x, y properties and optionally axes. + * @since 6.0.0 + */ + point?: string | AnnotationsPoint; + /** + * An array of points for the shape. This option is available for shapes which can use multiple points such as path. + * A point can be either a point object or a point's id. + * @default undefined + * @since 6.0.0 + */ + points?: Array; + } + + /** + * Options for configuring annotations, for example labels, arrows or shapes. Annotations can be tied to points, + * axis coordinates or chart pixel coordinates. + */ + interface AnnotationsOptions { + /** + * Options for annotation's labels. Each label inherits options from the labelOptions object. + * An option from the labelOptions can be overwritten by config for a specific label. + * @since 6.0.0 + */ + labelOptions?: AnnotationsLabelOptions; + /** + * An array of labels for the annotation. For options that apply to multiple labels, they can be added to the labelOptions. + * @since 6.0.0 + */ + labels?: AnnotationsLabel[]; + /** + * Options for annotation's shapes. Each shape inherits options from the shapeOptions object. + * An option from the shapeOptions can be overwritten by config for a specific shape. + * @since 6.0.0 + */ + shapeOptions?: AnnotationsShapeOptions; + /** + * An array of shapes for the annotation. For options that apply to multiple shapes, they can be added to the shapeOptions. + * @since 6.0.0 + */ + shapes?: AnnotationsShape[]; + /** + * Whether the annotation is visible. + * @default true + * @since 6.0.0 + */ + visible?: boolean; + /** + * The Z index of the annotation. + * @default 6 + * @since 6.0.0 + */ + zIndex?: number; + } + /** * Options for configuring accessibility for the chart. Requires the accessibility module to be loaded. * For a description of the module and information on its features, see Highcharts Accessibility. @@ -5557,6 +5870,12 @@ declare namespace Highcharts { * Individual data label for each point. The options are the same as the ones for plotOptions.series.dataLabels */ dataLabels?: DataLabels; + /** + * A description of the point to add to the screen reader information about the point. + * @default undefined + * @since 5.0.0 + */ + description?: string; /** * The id of a series in the drilldown.series array to use for a drilldown for this point. * @since 3.0.8 @@ -5923,6 +6242,16 @@ declare namespace Highcharts { * The y value. */ formatter?(): boolean | string; + /** + * Whether to allow the tooltip to render outside the chart's SVG element box. + * By default (false), the tooltip is rendered within the chart's SVG element, which results in + * the tooltip being aligned inside the chart area. For small charts, this may result in + * clipping or overlapping. When true, a separate SVG element is created and overlaid on the + * page, allowing the tooltip to be aligned inside the page itself. + * @default false + * @since 6.1.1 + */ + outside?: boolean; /** * Padding inside the tooltip, in pixels. * @since 5.0.0 @@ -6079,6 +6408,10 @@ declare namespace Highcharts { * @since 5.0.0 */ accessibility?: AccessibilityOptions; + /** + * Options for configuring annotations, for example labels, arrows or shapes. + */ + annotations?: AnnotationsOptions; /** * Options regarding the chart area and plot area as well as general chart options. */ @@ -6167,7 +6500,7 @@ declare namespace Highcharts { * Allows setting a set of rules to apply for different screen or chart sizes. Each rule specifies additional chart options. * @since 5.0.0 */ - responsive?: ResponsiveOptions[]; + responsive?: ResponsiveOptions; /** * The actual series to append to the chart. In addition to the members listed below, any member of the plotOptions * for that specific type of plot can be added to a series individually. For example, even though a general @@ -6236,6 +6569,13 @@ declare namespace Highcharts { * Configuration options for the axes are given in options.xAxis and options.yAxis. */ interface AxisObject { + dataMin: number; + dataMax: number; + userMin: number; + userMax: number; + bottom: number; + left: number; + width: number; /** * Add a plot band after render time. * @param options A configuration object consisting of the same members as options.xAxis.plotBands @@ -6248,6 +6588,7 @@ declare namespace Highcharts { * @since 1.2.0 */ addPlotLine(options: PlotLines): void; + defaultLabelFormatter(this: AxisLabelFormatterOptions): string; /** * Get the current extremes for the axis. * @since 1.2.0 @@ -6370,6 +6711,8 @@ declare namespace Highcharts { * @since 3.0.8 */ addSeriesAsDrilldown(point: PointObject, seriesOptions: IndividualSeriesOptions): void; + chartHeight?: number; + chartWidth?: number; /** * A reference to the containing HTML element, dynamically inserted into the element given in chart.renderTo. * @since 1.2.5 @@ -6479,6 +6822,10 @@ declare namespace Highcharts { * @since 1.2.0 */ options: Options; + plotLeft?: number; + plotSizeX?: number; + plotSizeY?: number; + plotTop?: number; /** * Exporting module required. Clears away other elements in the page and prints the chart as it is displayed. By * default, when the exporting module is enabled, a button at the upper left calls this method. diff --git a/types/highcharts/test/highstock.ts b/types/highcharts/test/highstock.ts index 2021e65b68..f1a464f491 100644 --- a/types/highcharts/test/highstock.ts +++ b/types/highcharts/test/highstock.ts @@ -25,6 +25,14 @@ $(() => { rangeSelector: { allButtonsEnabled: true, selected: 1, + buttons: [{ + type: 'month', + count: 1, + text: '1m', + events: { + click: () => { } + } + }], buttonTheme: { // styles for the buttons fill: 'none', stroke: 'none', diff --git a/types/i18next/index.d.ts b/types/i18next/index.d.ts index 484745bcad..9c310a4770 100644 --- a/types/i18next/index.d.ts +++ b/types/i18next/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for i18next 8.4 +// Type definitions for i18next 11.9 // Project: http://i18next.com // Definitions by: Michael Ledin // Budi Irawan // Giedrius Grabauskas +// Silas Rech // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -15,6 +16,18 @@ declare namespace i18next { type FormatFunction = (value: string, format?: string, lng?: string) => string; + /* tslint:disable-next-line:no-empty-interface */ + interface DetectionPluginOptions { + } + + /* tslint:disable-next-line:no-empty-interface */ + interface BackendPluginOptions { + } + + /* tslint:disable-next-line:no-empty-interface */ + interface CachePluginOptions { + } + interface InterpolationOptions { /** * format function see formatting for details @@ -37,6 +50,11 @@ declare namespace i18next { * @default true */ escapeValue?: boolean; + /** + * If true, then value passed into escape function is not casted to string, use with custom escape function that does its own type check + * @default false + */ + useRawValueToEscape?: boolean; /** * prefix for interpolation * @default '{{' @@ -91,7 +109,12 @@ declare namespace i18next { * global variables to use in interpolation replacements * @default undefined */ - defaultVariables?: any; + defaultVariables?: { [index: string]: any }; + /** + * after how many interpolation runs to break out before throwing a stack overflow + * @default 1000 + */ + maxReplaces?: number; } interface ReactOptions { @@ -204,6 +227,15 @@ declare namespace i18next { */ saveMissing?: boolean; + /** + * experimental: enable to update default values using the saveMissing + * (Works only if defaultValue different from translated value. + * Only useful on initial development or when keeping code as source of truth not changing values outside of code. + * Only supported if backend supports it already) + * @default false + */ + updateMissing?: boolean; + /** * @default 'fallback' */ @@ -213,7 +245,7 @@ declare namespace i18next { * Used for custom missing key handling (needs saveMissing set to true!) * @default false */ - missingKeyHandler?: false | ((lng: string, ns: string, key: string, fallbackValue: string) => void); + missingKeyHandler?: false | ((lngs: string[], ns: string, key: string, fallbackValue: string) => void); /** * receives a key that was not found in `t()` and returns a value, that will be returned by `t()` @@ -227,6 +259,12 @@ declare namespace i18next { */ appendNamespaceToMissingKey?: boolean; + /** + * gets called in case a interpolation value is undefined. This method will not be called if the value is empty string or null + * @default noop + */ + missingInterpolationHandler?: (text: string, value: any) => any; + /** * will use 'plural' as suffix for languages only having 1 plural form, setting it to false will suffix all with numbers * @default true @@ -284,19 +322,19 @@ declare namespace i18next { * options for language detection - check documentation of plugin * @default undefined */ - detection?: object; + detection?: DetectionPluginOptions; /** * options for backend - check documentation of plugin * @default undefined */ - backend?: object; + backend?: BackendPluginOptions; /** * options for cache layer - check documentation of plugin * @default undefined */ - cache?: object; + cache?: CachePluginOptions; /** * options for react - check documentation of plugin diff --git a/types/i18next/v8/i18next-tests.ts b/types/i18next/v8/i18next-tests.ts new file mode 100644 index 0000000000..1a425084e8 --- /dev/null +++ b/types/i18next/v8/i18next-tests.ts @@ -0,0 +1,455 @@ +import * as i18next from 'i18next'; + +i18next.init({ + lng: "en", + debug: true, + resources: { + en: { + translation: { + key: "hello world" + } + } + } +}, (err: any, t: i18next.TranslationFunction) => { + // initialized and ready to go! + const value: string = i18next.t('key'); +}); + +i18next.init({ initImmediate: false }); + +i18next.init({ + lng: 'en', + debug: true, + resources: { + en: { + translation: { + key: "hello world" + } + }, + de: { + translation: { + key: "hello welt" + } + } + } +}, (err: any, t: i18next.TranslationFunction) => { + // init set content + updateContent(); +}); + +i18next.init({ + ns: ['common', 'moduleA', 'moduleB'], + defaultNS: 'moduleA' +}, (err: any, t: i18next.TranslationFunction) => { + i18next.t('myKey'); // key in moduleA namespace (defined default) + i18next.t('common:myKey'); // key in common namespace +}); + +i18next.loadNamespaces('anotherNamespace', (err: any, t: i18next.TranslationFunction) => { /* ... */ }); + +// fallback to one language +i18next.init({ + lng: 'en-GB' +}, () => { + i18next.t('i18n'); // -> "Internationalisation" + i18next.t('i18n_short'); // -> "i18n" (from en.json) + + // force loading en + i18next.t('i18n', { lng: 'en' }); // -> "Internationalization" +}); + +// fallback to one language +i18next.init({ + fallbackLng: 'en' +}); + +// fallback ordered +i18next.init({ + fallbackLng: ['fr', 'en'] +}); + +// fallback depending on user language +i18next.init({ + fallbackLng: { + 'de-CH': ['fr', 'it'], + 'zh-HANT': ['zh-HANS', 'en'], + es: ['fr'], + default: ['en'] + } +}); + +const updateContent = () => { + const value: string = i18next.t('key'); +}; + +const changeLng = (lng: string) => { + i18next.changeLanguage(lng); +}; + +i18next.init({ + // files to load + ns: ['app', 'common'], + + // default namespace (needs no prefix on calling t) + defaultNS: 'app', + + // fallback, can be a string or an array of namespaces + fallbackNS: 'common' +}, () => { + i18next.t('title'); // -> "i18next" + + i18next.t('button.save'); // -> "save" (fallback from common) + + // without fallbackNS you would have to prefix namespace + // to access keys in that namespace + i18next.t('common:button.save'); // -> "save" +}); + +i18next.init({ + lng: 'de', + + // allow keys to be phrases having `:`, `.` + nsSeparator: false, + keySeparator: false, + + // do not load a fallback + fallbackLng: false +}); + +const error404 = '404'; +i18next.t([`error.${error404}`, 'error.unspecific']); // -> "The page was not found" + +const error502 = '502'; +i18next.t([`error.${error502}`, 'error.unspecific']); // -> "Something went wrong" + +i18next.t('No one says a key can not be the fallback.'); +// -> "Niemand sagt ein key kann nicht als Ersatz dienen." + +i18next.t('This will be shown if the current loaded translations to not have this.'); +// -> "This will be shown if the current loaded translations to not have this." + +const languageChangedCallback = () => { + updateContent(); +}; + +i18next.on('languageChanged', languageChangedCallback); +i18next.off('languageChanged', languageChangedCallback); + +i18next + .init({ + fallbackLng: 'en', + debug: true, + ns: ['special', 'common'], + defaultNS: 'special', + backend: { + // load from i18next-gitbook repo + loadPath: 'https://raw.githubusercontent.com/i18next/i18next-gitbook/master/locales/{{lng}}/{{ns}}.json', + crossDomain: true + } + }, (err: any, t: i18next.TranslationFunction) => { + // init set content + updateContent2(); + }); + +// just set some content and react to language changes +// could be optimized using vue-i18next, jquery-i18next, react-i18next, ... +const updateContent2 = () => { + const value: string = i18next.t('title', { what: 'i18next' }); + const value2: string = i18next.t('common:button.save', { count: Math.floor(Math.random() * 2 + 1) }); + const value3 = `detected user language: "${i18next.language}" --> loaded languages: "${i18next.languages.join(', ')}"`; +}; + +i18next.init({ + fallbackLng: 'en', + ns: ['file1', 'file2'], + defaultNS: 'file1', + debug: true +}, (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +// with only callback +i18next.init((err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +const v: string = i18next.t('my.key'); +const a: boolean = i18next.exists('my.key'); + +// fix language to german +const de = i18next.getFixedT('de'); +const z: string = de('myKey'); + +// or fix the namespace to anotherNamespace +const anotherNamespace = i18next.getFixedT(null, 'anotherNamespace'); +const x: string = anotherNamespace('anotherNamespaceKey'); // no need to prefix ns i18n.t('anotherNamespace:anotherNamespaceKey'); + +i18next.changeLanguage('en', (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +i18next.loadNamespaces('myNamespace', (err: any, t: i18next.TranslationFunction) => { /* resources have been loaded */ }); +i18next.loadNamespaces(['myNamespace1', 'myNamespace2'], (err: any, t: i18next.TranslationFunction) => { /* resources have been loaded */ }); + +i18next.loadLanguages('de', (err: any, t: i18next.TranslationFunction) => { /* resources have been loaded */ }); +i18next.loadLanguages(['de', 'fr'], (err: any, t: i18next.TranslationFunction) => { /* resources have been loaded */ }); + +// reload all +i18next.reloadResources(); + +// reload languages +i18next.reloadResources(['de', 'fr']); + +// reload namespaces for all languages +i18next.reloadResources(null, ['ns1', 'ns2']); + +// reload namespaces in languages +i18next.reloadResources(['de', 'fr'], ['ns1', 'ns2']); + +// for current language +i18next.dir(); + +// for another language +i18next.dir('en-US'); // -> "ltr"; +i18next.dir('ar'); // -> "rtl"; + +// key = 'hello {{what}}' +i18next.t('key', { what: i18next.format('world', 'uppercase') }); // -> hello WORLD + +const newInstance = i18next.createInstance({ + fallbackLng: 'en', + ns: ['file1', 'file2'], + defaultNS: 'file1', + debug: true +}, (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +// is the same as +newInstance.init({ + fallbackLng: 'en', + ns: ['file1', 'file2'], + defaultNS: 'file1', + debug: true +}, (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +const newInstance2 = i18next.cloneInstance({ + fallbackLng: 'en', + ns: ['file1', 'file2'], + defaultNS: 'file1', + debug: true +}, (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +// is the same as +const newInstance3 = i18next.cloneInstance(); +newInstance.init({ + fallbackLng: 'en', + ns: ['file1', 'file2'], + defaultNS: 'file1', + debug: true +}, (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +i18next.on('initialized', options => { }); +i18next.on('loaded', loaded => { }); +i18next.on('failedLoading', (lng: string, ns: string, msg: string) => { }); +i18next.on('missingKey', (lngs: string[], namespace: string, key: string, res: string) => { }); +i18next.on('added', (lng: string, ns: string) => { }); +i18next.on('removed', (lng: string, ns: string) => { }); +i18next.on('languageChanged', (lng: string) => { }); +i18next.on("customEvent", () => { }); + +i18next.getResource("en", "test", "key"); +i18next.getResource("en", "test", "key", { keySeparator: "-" }); + +i18next.addResource("en", "test", "key", "value"); +i18next.addResource("en", "test", "key", "value", { keySeparator: "-", silent: false }); + +i18next.addResources("en", "test", { key: "value" }); + +i18next.addResourceBundle('en', 'translations', { + key: 'value', +}, true, true); + +const has: boolean = i18next.hasResourceBundle("en", "test"); + +i18next.getResourceBundle("en", "test"); + +i18next.removeResourceBundle("en", "test"); + +i18next + .init({ + resources: { + en: { + namespace1: { + key: 'hello from namespace 1' + }, + namespace2: { + key: 'hello from namespace 2' + } + }, + de: { + namespace1: { + key: 'hallo von namespace 1' + }, + namespace2: { + key: 'hallo von namespace 2' + } + } + } + }); + +i18next.init(); + +i18next.addResourceBundle("en", 'namespace1', { + key: 'hello from namespace 1' +}); + +i18next + .init({ + backend: { + // for all available options read the backend's repository readme file + loadPath: '/locales/{{lng}}/{{ns}}.json' + } + }); + +i18next.init({ + ns: ['common', 'moduleA'], + defaultNS: 'moduleA' +}); + +i18next.t('key', { what: 'i18next', how: 'great' }); + +const author = { + name: 'Jan', + github: 'jamuhl' +}; +i18next.t('key', { author }); + +i18next.t('keyEscaped', { myVar: '' }); +// -> "no danger <img />" + +i18next.t('keyUnescaped', { myVar: '' }); +// -> "dangerous " + +i18next.t('keyEscaped', { myVar: '', interpolation: { escapeValue: false } }); +// -> "no danger " (obviously could be dangerous) + +i18next + .init({ + lng: 'en', + fallbackLng: 'en', + + resources: { + en: { + translation: { + key1: 'test', + interpolateKey: 'add {{insert}} {{up, uppercase}}', + interpolateKey2: 'add {{insert}} {{up, uppercase}}' + } + } + }, + + interpolation: { + escapeValue: false, // not needed for react!! + formatSeparator: ',', + format: (value: string, format: string, lng: string) => { + if (format === 'uppercase') return value.toUpperCase(); + return value; + } + } + }); + +i18next.t('key', { count: 0 }); // -> "items" +i18next.t('key', { count: 1 }); // -> "item" +i18next.t('key', { count: 5 }); // -> "items" +i18next.t('key', { count: 100 }); // -> "items" +i18next.t('keyWithCount', { count: 0 }); // -> "0 items" +i18next.t('keyWithCount', { count: 1 }); // -> "1 item" +i18next.t('keyWithCount', { count: 5 }); // -> "5 items" +i18next.t('keyWithCount', { count: 100 }); // -> "100 items" + +i18next.t('key1_interval', { postProcess: 'interval', count: 1 }); // -> "one item" +i18next.t('key1_interval', { postProcess: 'interval', count: 4 }); // -> "a few items" +i18next.t('key1_interval', { postProcess: 'interval', count: 100 }); // -> "a lot of items" + +// not matching into a range it will fallback to +// the regular plural form +i18next.t('key2_interval', { postProcess: 'interval', count: 1 }); // -> "one item" +i18next.t('key2_interval', { postProcess: 'interval', count: 4 }); // -> "a few items" +i18next.t('key2_interval', { postProcess: 'interval', count: 100 }); // -> "100 items" +i18next.t('friend', { context: 'male', count: 1 }); // -> "A boyfriend" +i18next.t('friend', { context: 'male', count: 1 }); // -> "A boyfriend" +i18next.t('friend', { context: 'female', count: 100 }); // -> "100 girlfriends" +i18next.t('friend', { context: 'female', count: 100 }); // -> "100 girlfriends" +i18next.t('tree', { returnObjects: true, something: 'gold' }); +// -> { res: 'added gold' } + +i18next.t('array', { returnObjects: true }); +// -> ['a', 'b', 'c'] +i18next.t('arrayJoin', { joinArrays: '+' }); +// -> "line1+line2+line3" + +i18next.t('arrayJoinWithInterpolation', { myVar: 'interpolate', joinArrays: ' ' }); +// -> "you can interpolate" + +i18next.t('arrayOfObjects.0.name'); +// -> "tom" + +type KeyList = "friend" | "tree"; + +interface CustomOptions { + myVar: string; +} + +i18next.t("friend"); +i18next.t(["friend", "tree"]); +i18next.t("friend", { myVar: "someValue" }); +i18next.t(["friend", "tree"], { myVar: "someValue" }); +i18next.t("friend", { myVar: "someValue" }); +i18next.t(["friend", "tree"], { myVar: "someValue" }); + +const t1: i18next.TranslationFunction = (key: string, options: i18next.TranslationOptions) => ""; +const t2: i18next.TranslationFunction<{ value: string }> = (key: string, options: i18next.TranslationOptions) => ({ value: "asd" }); +const t3: i18next.TranslationFunction = (key: string | string[], options: i18next.TranslationOptions) => ""; +const t4: i18next.TranslationFunction = (key: KeyList | KeyList[], options: i18next.TranslationOptions) => ""; + +i18next.exists("friend"); +i18next.exists(["friend", "tree"]); +i18next.exists("friend", { myVar: "someValue" }); +i18next.exists(["friend", "tree"], { myVar: "someValue" }); +i18next.exists("friend", { myVar: "someValue" }); +i18next.exists(["friend", "tree"], { myVar: "someValue" }); diff --git a/types/i18next/v8/index.d.ts b/types/i18next/v8/index.d.ts new file mode 100644 index 0000000000..484745bcad --- /dev/null +++ b/types/i18next/v8/index.d.ts @@ -0,0 +1,619 @@ +// Type definitions for i18next 8.4 +// Project: http://i18next.com +// Definitions by: Michael Ledin +// Budi Irawan +// Giedrius Grabauskas +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare namespace i18next { + interface FallbackLngObjList { + [language: string]: string[]; + } + + type FallbackLng = string | string[] | FallbackLngObjList; + + type FormatFunction = (value: string, format?: string, lng?: string) => string; + + interface InterpolationOptions { + /** + * format function see formatting for details + * @default noop + */ + format?: FormatFunction; + /** + * used to separate format from interpolation value + * @default ',' + */ + formatSeparator?: string; + /** + * escape function + * @default str => str + */ + escape?(str: string): string; + + /** + * escape passed in values to avoid xss injection + * @default true + */ + escapeValue?: boolean; + /** + * prefix for interpolation + * @default '{{' + */ + prefix?: string; + /** + * suffix for interpolation + * @default '}}' + */ + suffix?: string; + /** + * escaped prefix for interpolation (regexSafe) + * @default undefined + */ + prefixEscaped?: string; + /** + * escaped suffix for interpolation (regexSafe) + * @default undefined + */ + suffixEscaped?: string; + /** + * suffix to unescaped mode + * @default undefined + */ + unescapeSuffix?: string; + /** + * prefix to unescaped mode + * @default '-' + */ + unescapePrefix?: string; + /** + * prefix for nesting + * @default '$t(' + */ + nestingPrefix?: string; + /** + * suffix for nesting + * @default ')' + */ + nestingSuffix?: string; + /** + * escaped prefix for nesting (regexSafe) + * @default undefined + */ + nestingPrefixEscaped?: string; + /** + * escaped suffix for nesting (regexSafe) + * @default undefined + */ + nestingSuffixEscaped?: string; + /** + * global variables to use in interpolation replacements + * @default undefined + */ + defaultVariables?: any; + } + + interface ReactOptions { + /** + * set to true if you like to wait for loaded in every translated hoc + * @default false + */ + wait?: boolean; + /** + * set it to fallback to let passed namespaces to translated hoc act as fallbacks + * @default 'default' + */ + nsMode?: 'default' | 'fallback'; + /** + * set it to the default parent element created by the Trans component. + * @default 'div' + */ + defaultTransParent?: string; + /** + * set which events trigger a rerender, can be set to false or string of events + * @default 'languageChanged loaded' + */ + bindI18n?: string | false; + /** + * set which events on store trigger a rerender, can be set to false or string of events + * @default 'added removed' + */ + bindStore?: string | false; + } + + interface InitOptions { + /** + * logs info level to console output. Helps finding issues with loading not working. + * @default false + */ + debug?: boolean; + + /** + * resources to initialize with (if not using loading or not appending using addResourceBundle) + * @default undefined + */ + resources?: Resource; + + /** + * language to use (overrides language detection) + * @default undefined + */ + lng?: string; + + /** + * language to use if translations in user language are not available. + * @default 'dev' + */ + fallbackLng?: false | FallbackLng; + + /** + * array of allowed languages + * @default false + */ + whitelist?: false | string[]; + + /** + * if true will pass eg. en-US if finding en in whitelist + * @default false + */ + nonExplicitWhitelist?: boolean; + + /** + * language codes to lookup, given set language is + * 'en-US': 'all' --> ['en-US', 'en', 'dev'], + * 'currentOnly' --> 'en-US', + * 'languageOnly' --> 'en' + * @default 'all' + */ + load?: "all" | "currentOnly" | "languageOnly"; + + /** + * array of languages to preload. Important on serverside to assert translations are loaded before rendering views. + * @default false + */ + preload?: false | string[]; + + /** + * language will be lowercased eg. en-US --> en-us + * @default false + */ + lowerCaseLng?: boolean; + + /** + * string or array of namespaces to load + * @default 'translation' + */ + ns?: string | string[]; + + /** + * default namespace used if not passed to translation function + * @default 'translation' + */ + defaultNS?: string; + + /** + * string or array of namespaces to lookup key if not found in given namespace. + * @default false + */ + fallbackNS?: false | string | string[]; + + /** + * calls save missing key function on backend if key not found + * @default false + */ + saveMissing?: boolean; + + /** + * @default 'fallback' + */ + saveMissingTo?: "current" | "all" | "fallback"; + + /** + * Used for custom missing key handling (needs saveMissing set to true!) + * @default false + */ + missingKeyHandler?: false | ((lng: string, ns: string, key: string, fallbackValue: string) => void); + + /** + * receives a key that was not found in `t()` and returns a value, that will be returned by `t()` + * @default noop + */ + parseMissingKeyHandler?(key: string): any; + + /** + * appends namespace to missing key + * @default false + */ + appendNamespaceToMissingKey?: boolean; + + /** + * will use 'plural' as suffix for languages only having 1 plural form, setting it to false will suffix all with numbers + * @default true + */ + simplifyPluralSuffix?: boolean; + + /** + * string or array of postProcessors to apply per default + * @default false + */ + postProcess?: false | string | string[]; + + /** + * allows null values as valid translation + * @default true + */ + returnNull?: boolean; + + /** + * allows empty string as valid translation + * @default true + */ + returnEmptyString?: boolean; + + /** + * allows objects as valid translation result + * @default false + */ + returnObjects?: boolean; + + /** + * Gets called if object was passed in as key but returnObjects was set to false + * @default noop + */ + returnedObjectHandler?(key: string, value: string, options: any): void; + + /** + * char, eg. '\n' that arrays will be joined by + * @default false + */ + joinArrays?: false | string; + + /** + * default: sets defaultValue + * @default args => ({ defaultValue: args[1] }) + */ + overloadTranslationOptionHandler?(args: string[]): TranslationOptions; + + /** + * @see https://www.i18next.com/interpolation.html + */ + interpolation?: InterpolationOptions; + + /** + * options for language detection - check documentation of plugin + * @default undefined + */ + detection?: object; + + /** + * options for backend - check documentation of plugin + * @default undefined + */ + backend?: object; + + /** + * options for cache layer - check documentation of plugin + * @default undefined + */ + cache?: object; + + /** + * options for react - check documentation of plugin + * @default undefined + */ + react?: ReactOptions; + + /** + * triggers resource loading in init function inside a setTimeout (default async behaviour). + * Set it to false if your backend loads resources sync - that way calling i18next.t after + * init is possible without relaying on the init callback. + * @default true + */ + initImmediate?: boolean; + + /** + * char to separate keys + * @default '.' + */ + keySeparator?: false | string; + + /** + * char to split namespace from key + * @default ':' + */ + nsSeparator?: false | string; + + /** + * char to split plural from key + * @default '_' + */ + pluralSeparator?: string; + + /** + * char to split context from key + * @default '_' + */ + contextSeparator?: string; + + /** + * prefixes the namespace to the returned key when using cimode + * @default false + */ + appendNamespaceToCIMode?: boolean; + + /** + * Compatibility JSON version + */ + compatibilityJSON?: string; + } + + // Add an indexer to assure that interpolation arguments can be passed + type TranslationOptions = TranslationOptionsBase & TCustomOptions & { [key: string]: any }; + + interface TranslationOptionsBase { + /** + * defaultValue to return if a translation was not found + */ + defaultValue?: any; + /** + * count value used for plurals + */ + count?: number; + /** + * used for contexts (eg. male\female) + */ + context?: any; + /** + * object with vars for interpolation - or put them directly in options + */ + replace?: any; + /** + * override language to use + */ + lng?: string; + /** + * override languages to use + */ + lngs?: string[]; + /** + * override language to lookup key if not found see fallbacks for details + */ + fallbackLng?: FallbackLng; + /** + * override namespaces (string or array) + */ + ns?: string | string[]; + /** + * override char to separate keys + */ + keySeparator?: string; + /** + * override char to split namespace from key + */ + nsSeparator?: string; + /** + * accessing an object not a translation string (can be set globally too) + */ + returnObjects?: boolean; + /** + * char, eg. '\n' that arrays will be joined by (can be set globally too) + */ + joinArrays?: string; + /** + * string or array of postProcessors to apply see interval plurals as a sample + */ + postProcess?: string | string[]; + /** + * override interpolation options + */ + interpolation?: InterpolationOptions; + } + + type Callback = (error: any, t: TranslationFunction) => void; + + type TranslationFunction = + (key: TKeys | TKeys[], options?: TranslationOptions) => TResult; + + interface Resource { + [language: string]: ResourceLanguage; + } + + interface ResourceLanguage { + [namespace: string]: ResourceKey; + } + + interface ResourceKey { + [key: string]: any; + } + + interface i18n { + /** + * The default export of the i18next module is an i18next instance ready to be initialized by calling init. + * You can create additional instances using the createInstance function. + * + * @param options - Initial options. + * @param callback - will be called after all translations were loaded or with an error when failed (in case of using a backend). + */ + init(options: InitOptions, callback?: Callback): i18n; + init(callback?: Callback): i18n; + + loadResources(callback?: (err: any) => void): void; + + /** + * The use function is there to load additional plugins to i18next. + * For available module see the plugins page and don't forget to read the documentation of the plugin. + */ + use(module: any): i18n; + + /** + * Please have a look at the translation functions like interpolation, formatting and plurals for more details on using it. + */ + t: TranslationFunction; + + /** + * Uses the same resolve functionality as the t function and returns true if a key exists. + */ + exists: TranslationFunction; + + /** + * Returns a t function that defaults to given language or namespace. + * Both params could be arrays of languages or namespaces and will be treated as fallbacks in that case. + * On the returned function you can like in the t function override the languages or namespaces by passing them in options or by prepending namespace. + */ + getFixedT(lng: string | string[], ns?: string | string[]): TranslationFunction; + getFixedT(lng: null, ns: string | string[]): TranslationFunction; + + /** + * Changes the language. The callback will be called as soon translations were loaded or an error occurs while loading. + * HINT: For easy testing - setting lng to 'cimode' will set t function to always return the key. + */ + changeLanguage(lng: string, callback?: Callback): void; + + /** + * Is set to the current detected or set language. + * If you need the primary used language depending on your configuration (whilelist, load) you will prefer using i18next.languages[0]. + */ + language: string; + + /** + * Is set to an array of language-codes that will be used it order to lookup the translation value. + */ + languages: string[]; + + /** + * Loads additional namespaces not defined in init options. + */ + loadNamespaces(ns: string | string[], callback: Callback): void; + + /** + * Loads additional languages not defined in init options (preload). + */ + loadLanguages(lngs: string | string[], callback: Callback): void; + + /** + * Reloads resources on given state. Optionally you can pass an array of languages and namespaces as params if you don't want to reload all. + */ + reloadResources(lngs?: string[], ns?: string[]): void; + reloadResources(lngs: null, ns: string[]): void; + + /** + * Changes the default namespace. + */ + setDefaultNamespace(ns: string): void; + + /** + * Returns rtl or ltr depending on languages read direction. + */ + dir(lng?: string): "ltr" | "rtl"; + + /** + * Exposes interpolation.format function added on init. + */ + format: FormatFunction; + + /** + * Will return a new i18next instance. + * Please read the options page for details on configuration options. + * Providing a callback will automatically call init. + * The callback will be called after all translations were loaded or with an error when failed (in case of using a backend). + */ + createInstance(options?: InitOptions, callback?: Callback): i18n; + + /** + * Creates a clone of the current instance. Shares store, plugins and initial configuration. + * Can be used to create an instance sharing storage but being independent on set language or namespaces. + */ + cloneInstance(options?: InitOptions, callback?: Callback): i18n; + + /** + * Gets fired after initialization. + */ + on(event: "initialized", callback: (options: InitOptions) => void): void; + + /** + * Gets fired on loaded resources. + */ + on(event: "loaded", callback: (loaded: boolean) => void): void; + + /** + * Gets fired if loading resources failed. + */ + on(event: "failedLoading", callback: (lng: string, ns: string, msg: string) => void): void; + + /** + * Gets fired on accessing a key not existing. + */ + on(event: "missingKey", callback: (lngs: string[], namespace: string, key: string, res: string) => void): void; + + /** + * Gets fired when resources got added or removed. + */ + on(event: "added" | "removed", callback: (lng: string, ns: string) => void): void; + + /** + * Gets fired when changeLanguage got called. + */ + on(event: "languageChanged", callback: (lng: string) => void): void; + + /** + * Event listener + */ + on(event: string, listener: (...args: any[]) => void): void; + + /** + * Remove event listener + */ + off(event: string, listener: (...args: any[]) => void): void; + + /** + * Gets one value by given key. + */ + getResource(lng: string, ns: string, key: string, options?: { keySeparator?: string }): any; + + /** + * Adds one key/value. + */ + addResource(lng: string, ns: string, key: string, value: string, options?: { keySeparator?: string, silent?: boolean }): void; + + /** + * Adds multiple key/values. + */ + addResources(lng: string, ns: string, resources: any): void; + + /** + * Adds a complete bundle. + * Setting deep param to true will extend existing translations in that file. + * Setting overwrite to true it will overwrite existing translations in that file. + */ + addResourceBundle(lng: string, ns: string, resources: any, deep?: boolean, overwrite?: boolean): void; + + /** + * Checks if a resource bundle exists. + */ + hasResourceBundle(lng: string, ns: string): boolean; + + /** + * Returns a resource bundle. + */ + getResourceBundle(lng: string, ns: string): any; + + /** + * Removes an existing bundle. + */ + removeResourceBundle(lng: string, ns: string): void; + + /** + * Current options + */ + options: InitOptions; + + /** + * Is initialized + */ + isInitialized: boolean; + } +} + +declare const i18next: i18next.i18n; +export = i18next; diff --git a/types/i18next/v8/tsconfig.json b/types/i18next/v8/tsconfig.json new file mode 100644 index 0000000000..cb9f9ab724 --- /dev/null +++ b/types/i18next/v8/tsconfig.json @@ -0,0 +1,29 @@ +{ + "files": [ + "index.d.ts", + "i18next-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "i18next": [ + "i18next/v8" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/i18next/v8/tslint.json b/types/i18next/v8/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/i18next/v8/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/json-schema/index.d.ts b/types/json-schema/index.d.ts index 314f285b59..156a86c9a5 100644 --- a/types/json-schema/index.d.ts +++ b/types/json-schema/index.d.ts @@ -214,6 +214,7 @@ export type JSONSchema6Type = any[] | boolean | number | null | object | string * JSON Schema V6 * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01 */ +export type JSONSchema6Definition = JSONSchema6 | boolean; export interface JSONSchema6 { $id?: string $ref?: string @@ -281,7 +282,7 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9 */ - items?: boolean | JSONSchema6 | JSONSchema6[] + items?: JSONSchema6Definition | JSONSchema6Definition[] /** * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. @@ -292,7 +293,7 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10 */ - additionalItems?: boolean | JSONSchema6 + additionalItems?: JSONSchema6Definition /** * Must be a non-negative integer. @@ -321,7 +322,7 @@ export interface JSONSchema6 { * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14 */ - contains?: boolean | JSONSchema6 + contains?: JSONSchema6Definition /** * Must be a non-negative integer. @@ -356,7 +357,7 @@ export interface JSONSchema6 { * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18 */ properties?: { - [k: string]: boolean | JSONSchema6 + [k: string]: JSONSchema6Definition } /** @@ -368,7 +369,7 @@ export interface JSONSchema6 { * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19 */ patternProperties?: { - [k: string]: boolean | JSONSchema6 + [k: string]: JSONSchema6Definition } /** @@ -378,7 +379,7 @@ export interface JSONSchema6 { * The default value is an empty schema which allows any value for additional properties. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20 */ - additionalProperties?: boolean | JSONSchema6 + additionalProperties?: JSONSchema6Definition /** * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. @@ -388,7 +389,7 @@ export interface JSONSchema6 { * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21 */ dependencies?: { - [k: string]: boolean | JSONSchema6 | string[] + [k: string]: JSONSchema6Definition | string[] } /** @@ -397,7 +398,7 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22 */ - propertyNames?: boolean | JSONSchema6 + propertyNames?: JSONSchema6Definition /** * This provides an enumeration of all possible values that are valid @@ -425,28 +426,28 @@ export interface JSONSchema6 { /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26 */ - allOf?: JSONSchema6[] + allOf?: JSONSchema6Definition[] /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27 */ - anyOf?: JSONSchema6[] + anyOf?: JSONSchema6Definition[] /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28 */ - oneOf?: JSONSchema6[] + oneOf?: JSONSchema6Definition[] /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29 */ - not?: boolean | JSONSchema6 + not?: JSONSchema6Definition /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1 */ definitions?: { - [k: string]: boolean | JSONSchema6 + [k: string]: JSONSchema6Definition } /** @@ -508,6 +509,11 @@ export type JSONSchema7Version = 'http://json-schema.org/schema#' | 'http://json-schema.org/draft-07/schema#' | 'http://json-schema.org/draft-07/hyper-schema#'; +/** + * JSON Schema v7 + * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01 + */ +export type JSONSchema7Definition = JSONSchema7 | boolean; export interface JSONSchema7 { $id?: string; $ref?: string; @@ -540,8 +546,8 @@ export interface JSONSchema7 { /** * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4 */ - items?: JSONSchema7 | JSONSchema7[]; - additionalItems?: JSONSchema7; + items?: JSONSchema7Definition | JSONSchema7Definition[]; + additionalItems?: JSONSchema7Definition; maxItems?: number; minItems?: number; uniqueItems?: boolean; @@ -554,31 +560,31 @@ export interface JSONSchema7 { minProperties?: number; required?: string[]; properties?: { - [key: string]: JSONSchema7; + [key: string]: JSONSchema7Definition; }; patternProperties?: { - [key: string]: JSONSchema7; + [key: string]: JSONSchema7Definition; }; - additionalProperties?: JSONSchema7; + additionalProperties?: JSONSchema7Definition; dependencies?: { - [key: string]: JSONSchema7 | string[]; + [key: string]: JSONSchema7Definition | string[]; }; - propertyNames?: JSONSchema7; + propertyNames?: JSONSchema7Definition; /** * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6 */ - if?: JSONSchema7; - then?: JSONSchema7; - else?: JSONSchema7; + if?: JSONSchema7Definition; + then?: JSONSchema7Definition; + else?: JSONSchema7Definition; /** * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7 */ - allOf?: JSONSchema7[]; - anyOf?: JSONSchema7[]; - oneOf?: JSONSchema7[]; - not?: JSONSchema7; + allOf?: JSONSchema7Definition[]; + anyOf?: JSONSchema7Definition[]; + oneOf?: JSONSchema7Definition[]; + not?: JSONSchema7Definition; /** * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7 @@ -595,7 +601,7 @@ export interface JSONSchema7 { * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9 */ definitions?: { - [key: string]: JSONSchema7; + [key: string]: JSONSchema7Definition; }; /** diff --git a/types/json-schema/json-schema-tests.ts b/types/json-schema/json-schema-tests.ts index 66cf7c5af5..ae750271b5 100644 --- a/types/json-schema/json-schema-tests.ts +++ b/types/json-schema/json-schema-tests.ts @@ -8,7 +8,9 @@ import { JSONSchema7, JSONSchema7Array, JSONSchema7Type, - JSONSchema7TypeName + JSONSchema7TypeName, + JSONSchema6Definition, + JSONSchema7Definition } from 'json-schema' /* JSON Schema 4 */ @@ -80,6 +82,10 @@ import { } } +// Class +class Schema4 implements JSONSchema4 { +} + /* JSON Schema 6 */ // SimpleType @@ -96,10 +102,10 @@ import { const c: JSONSchema6Type = [1, 2] } -// JSONSchema6 +// JSONSchema6Definition () => { - const a: JSONSchema6 = {} - const b: JSONSchema6 = { + const a: JSONSchema6Definition = {} + const b: JSONSchema6Definition = { $id: 'foo', $ref: 'foo/bar', $schema: 'http://json-schema.org/schema#', @@ -149,6 +155,11 @@ import { propertyNames: {}, format: 'date-time' } + const c: JSONSchema6Definition = false; +} + +// Class +class Schema6 implements JSONSchema6 { } /* JSON Schema 7 */ @@ -167,10 +178,10 @@ import { const c: JSONSchema7Type = [1, 2] } -// JSONSchema4 +// JSONSchema7Definition () => { - const a: JSONSchema7 = {} - const b: JSONSchema7 = { + const a: JSONSchema7Definition = {} + const b: JSONSchema7Definition = { $id: 'foo', $ref: 'foo/bar', $schema: 'http://json-schema.org/schema#', @@ -228,4 +239,9 @@ import { if: {}, then: {} } + const c: JSONSchema7Definition = false; +} + +// Class +class Schema7 implements JSONSchema7 { } diff --git a/types/jss/index.d.ts b/types/jss/index.d.ts index c8e0f13c6c..edcb0ba95f 100644 --- a/types/jss/index.d.ts +++ b/types/jss/index.d.ts @@ -77,7 +77,7 @@ export interface StyleSheet { export type GenerateClassName = (rule: Rule, sheet?: StyleSheet) => string; export interface JSSPlugin { - [key: string]: () => Partial<{ + [key: string]: Partial<{ onCreateRule(name: string, style: Style, options: RuleOptions): Rule; onProcessRule(rule: Rule, sheet: StyleSheet): void; onProcessStyle(style: Style, rule: Rule, sheet: StyleSheet): Style; diff --git a/types/micro/index.d.ts b/types/micro/index.d.ts index 7914d107bd..f3787b1010 100644 --- a/types/micro/index.d.ts +++ b/types/micro/index.d.ts @@ -19,8 +19,8 @@ export function sendError(req: IncomingMessage, res: ServerResponse, info: { sta export function createError(code: number, msg: string, orig?: Error): Error & { statusCode: number, originalError?: Error }; -export function buffer(req: IncomingMessage, info?: { limit?: string, encoding?: string }): Promise; +export function buffer(req: IncomingMessage, info?: { limit?: string | number, encoding?: string }): Promise; -export function text(req: IncomingMessage, info?: { limit?: string, encoding?: string }): Promise; +export function text(req: IncomingMessage, info?: { limit?: string | number, encoding?: string }): Promise; -export function json(req: IncomingMessage, info?: { limit?: string, encoding?: string }): Promise; +export function json(req: IncomingMessage, info?: { limit?: string | number, encoding?: string }): Promise; diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 2ac8410672..7a28f641f6 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -2832,6 +2832,32 @@ declare module "mongoose" { /** sets the document fields to return */ select?: any; }, callback?: (err: any, res: T | null) => void): DocumentQuery; + + /** + * Issues a mongodb findOneAndDelete command. + * Finds a matching document, removes it, passing the found document (if any) to the + * callback. Executes immediately if callback is passed. + */ + findOneAndDelete(): DocumentQuery; + findOneAndDelete(conditions: any, + callback?: (err: any, res: T | null) => void): DocumentQuery; + findOneAndDelete(conditions: any, options: { + /** + * if multiple docs are found by the conditions, sets the sort order to choose + * which doc to update + */ + sort?: any; + /** puts a time limit on the query - requires mongodb >= 2.6.0 */ + maxTimeMS?: number; + /** sets the document fields to return */ + select?: any; + /** like select, it determines which fields to return */ + projection?: any; + /** if true, returns the raw result from the MongoDB driver */ + rawResult?: boolean; + /** overwrites the schema's strict mode option for this update */ + strict?: boolean|string; + }, callback?: (err: any, res: T | null) => void): DocumentQuery; /** * Issues a mongodb findAndModify update command. diff --git a/types/next/app.d.ts b/types/next/app.d.ts index d077c0e95a..aef2980063 100644 --- a/types/next/app.d.ts +++ b/types/next/app.d.ts @@ -1,19 +1,46 @@ import * as React from "react"; -import { NextContext } from "."; +import { NextContext, NextComponentType } from "."; import { RouterProps, DefaultQuery } from "./router"; -export interface AppComponentProps { - Component: React.ComponentType; - router: RouterProps; - pageProps: any; -} +// Deprecated +export type AppComponentProps = AppProps; +export type AppComponentContext = NextAppContext; +// End Deprecated -export interface AppComponentContext { - Component: React.ComponentType; +/** + * Context passed to App.getInitialProps. + * Component is dynamic - cannot infer type. + * + * @template Q Query object schema. + */ +export interface NextAppContext { + Component: NextComponentType>; router: RouterProps; ctx: NextContext; } -export class Container extends React.Component { } +/** + * Props passed to the App component. + * Component and pageProps are dynamic - cannot infer type. + * + * @template Q Query object schema. + */ +export interface AppProps { + Component: NextComponentType>; + router: RouterProps; + pageProps: any; +} -export default class App extends React.Component> { } +/** + * App component type. Differs from the default type because the context it passes + * to getInitialProps and the props is passes to the component are different. + * + * @template IP Initial props returned from getInitialProps. + * @template C Context passed to getInitialProps. + */ +export type AppComponentType = NextComponentType; + +export class Container extends React.Component {} +export default class App extends React.Component { + getInitialProps(context: C): Promise | IP; +} diff --git a/types/next/document.d.ts b/types/next/document.d.ts index e6ba38b6c9..2e9880db51 100644 --- a/types/next/document.d.ts +++ b/types/next/document.d.ts @@ -1,6 +1,6 @@ import * as React from "react"; - -import { NextContext } from "."; +import { NextContext, NextComponentType } from "."; +import { DefaultQuery } from "./router"; export interface RenderPageResponse { buildManifest: { [key: string]: any }; @@ -21,16 +21,25 @@ export interface AnyPageProps extends PageProps { [key: string]: any; } -export type Enhancer = (page: React.ComponentType

) => React.ComponentType; +export type Enhancer = ( + page: React.ComponentType

+) => React.ComponentType; /** - * Context object used inside `Document` + * Context passed to Document.getInitialProps. + * + * @template Q Query object schema. */ -export interface NextDocumentContext extends NextContext { +export interface NextDocumentContext extends NextContext { /** A callback that executes the actual React rendering logic (synchronously) */ - renderPage(enhancer?: Enhancer): RenderPageResponse; // tslint:disable-line:no-unnecessary-generics + renderPage( + enhancer?: Enhancer // tslint:disable-line no-unnecessary-generics + ): RenderPageResponse; } +/** + * Props passed to the Document component. + */ export interface DocumentProps { __NEXT_DATA__?: any; dev?: boolean; @@ -45,18 +54,40 @@ export interface DocumentProps { [key: string]: any; } +/** + * Props supported by the Head component. + */ export interface HeadProps { nonce?: string; [key: string]: any; } +/** + * Props supported by the NextScript component. + */ export interface NextScriptProps { nonce?: string; + [key: string]: any; } +/** + * Document component type. Differs from the default type because the context it passes + * to getInitialProps and the props is passes to the component are different. + * + * @template IP Initial props returned from getInitialProps. + * @template C Context passed to getInitialProps. + */ +export type DocumentComponentType = NextComponentType< + IP & DocumentProps, + IP, + C +>; + export class Head extends React.Component {} export class Main extends React.Component {} export class NextScript extends React.Component {} -export default class Document extends React.Component { - static getInitialProps(ctx: NextDocumentContext): Promise | DocumentProps; +export default class Document extends React.Component< + IP & DocumentProps +> { + getInitialProps(context: C): Promise | IP; } diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 08e82106ab..c66e4c82ac 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -16,16 +16,22 @@ import * as url from "url"; import { Response as NodeResponse } from "node-fetch"; -import { SingletonRouter, DefaultQuery } from './router'; +import { SingletonRouter, DefaultQuery } from "./router"; declare namespace next { // Deprecated type QueryStringMapObject = DefaultQuery; + type ServerConfig = NextConfig; + // End Deprecated + + type UrlLike = url.UrlObject | url.Url; /** * Context object used in methods like `getInitialProps()` * https://github.com/zeit/next.js/blob/6.1.1/server/render.js#L77 * https://github.com/zeit/next.js/blob/6.1.1/readme.md#fetching-data-and-component-lifecycle + * + * @template Q Query object schema. */ interface NextContext { /** path section of URL */ @@ -44,19 +50,11 @@ declare namespace next { err?: Error; } - type NextSFC = NextStatelessComponent; - interface NextStatelessComponent - extends React.StatelessComponent { - getInitialProps?: (ctx: NextContext) => Promise; - } - - type UrlLike = url.UrlObject | url.Url; - /** * Next.js config schema. * https://github.com/zeit/next.js/blob/6.1.1/server/config.js#L10 */ - interface ServerConfig { + interface NextConfig { webpack?: any; webpackDevMiddleware?: any; poweredByHeader?: boolean; @@ -83,7 +81,7 @@ declare namespace next { dev?: boolean; staticMarkup?: boolean; quiet?: boolean; - conf?: ServerConfig; + conf?: NextConfig; } /** @@ -97,7 +95,7 @@ declare namespace next { quiet: boolean; router: SingletonRouter; http: null | http.Server; - nextConfig: ServerConfig; + nextConfig: NextConfig; distDir: string; buildId: string; hotReloader: any; @@ -114,7 +112,7 @@ declare namespace next { getHotReloader( dir: string, - options: { quiet: boolean; config: ServerConfig; buildId: string } + options: { quiet: boolean; config: NextConfig; buildId: string } ): any; handleRequest( req: http.IncomingMessage, @@ -132,11 +130,7 @@ declare namespace next { close(): Promise; defineRoutes(): Promise; start(): Promise; - run( - req: http.IncomingMessage, - res: http.ServerResponse, - parsedUrl: UrlLike - ): Promise; + run(req: http.IncomingMessage, res: http.ServerResponse, parsedUrl: UrlLike): Promise; render( req: http.IncomingMessage, @@ -182,6 +176,49 @@ declare namespace next { getCompilationError(): Promise; send404(res: http.ServerResponse): void; } + + /** + * Next.js counterpart of React.ComponentType. + * Specially useful in HOCs that receive Next.js components. + * + * @template P Component props. + * @template IP Initial props returned from getInitialProps. + * @template C Context passed to getInitialProps. + */ + type NextComponentType

= + | NextComponentClass + | NextStatelessComponent; + + /** + * Next.js counterpart of React.SFC/React.StatelessComponent. + * + * @template P Component props. + * @template IP Initial props returned from getInitialProps. + * @template C Context passed to getInitialProps. + */ + type NextSFC

= NextStatelessComponent; + type NextStatelessComponent

= React.StatelessComponent

& + NextStaticLifecycle; + + /** + * Next.js counterpart of React.ComponentClass. + * + * @template P Component props. + * @template IP Initial props returned from getInitialProps. + * @template C Context passed to getInitialProps. + */ + type NextComponentClass

= React.ComponentClass

& + NextStaticLifecycle; + + /** + * Next.js specific lifecycle methods. + * + * @template IP Initial props returned from getInitialProps and passed to the component. + * @template C Context passed to getInitialProps. + */ + interface NextStaticLifecycle { + getInitialProps?: (ctx: C) => Promise | IP; + } } declare function next(options?: next.ServerOptions): next.Server; diff --git a/types/next/test/next-app-tests.tsx b/types/next/test/next-app-tests.tsx index ffdcbaaf65..331df9e92f 100644 --- a/types/next/test/next-app-tests.tsx +++ b/types/next/test/next-app-tests.tsx @@ -1,24 +1,15 @@ import * as React from "react"; -import App, { Container, AppComponentContext } from "next/app"; -import { NextStatelessComponent } from "next"; +import App, { Container, NextAppContext, AppProps, AppComponentType } from "next/app"; interface NextComponentProps { example: string; } -class TestApp extends App { - static async getInitialProps({ Component, router, ctx }: AppComponentContext) { - let pageProps = {}; - // TODO: fix AppComponentContext to return NextComponentType instead of React.ComponentType - const Page = Component as NextStatelessComponent; - - if (Page.getInitialProps) { - pageProps = await Page.getInitialProps(ctx); - } - - return { pageProps }; - } +interface TypedQuery { + id?: string; +} +class TestApp extends App { render() { const { Component, router, pageProps } = this.props; return ( @@ -28,3 +19,78 @@ class TestApp extends App { ); } } + +class TestAppWithProps extends App { + static async getInitialProps({ Component, router, ctx }: NextAppContext) { + const pageProps = Component.getInitialProps && (await Component.getInitialProps(ctx)); + return { pageProps, example: "foobar" }; + } + + render() { + const { Component, router, pageProps, example } = this.props; + return ; + } +} + +class TestAppWithTypedQuery extends App<{}, NextAppContext> { + static async getInitialProps({ ctx }: NextAppContext) { + const { id } = ctx.query; + const processQuery = (id?: string) => id; + processQuery(id); + } +} + +interface WithExampleProps { + example: string; +} + +interface WithExampleHocProps { + test: string; +} + +interface TestProps { + ownProp: boolean; +} + +// Stateful HOC that adds props to wrapped component. Similar to what withRedux does. +// tslint:disable-next-line no-unnecessary-generics +const withExample =

(App: AppComponentType

) => + class extends React.Component

{ + test: string; + + static async getInitialProps(context: NextAppContext) { + const pageProps = App.getInitialProps && (await App.getInitialProps(context)); + + // tslint:disable-next-line prefer-object-spread + return Object.assign({}, pageProps, { test: "test" }); + } + + constructor(props: P & AppProps & WithExampleHocProps) { + super(props); + this.test = props.test; + } + + render() { + return ; + } + }; + +// Basic stateless HOC. Similar to what withAuth would do. +// tslint:disable-next-line no-unnecessary-generics +const withBasic =

(App: AppComponentType) => + class extends React.Component

{ + static async getInitialProps(context: C) { + const pageProps = App.getInitialProps && (await App.getInitialProps(context)); + + // tslint:disable-next-line prefer-object-spread + return Object.assign({}, pageProps); + } + + render() { + return ; + } + }; + +withExample(TestAppWithProps); + +withBasic(TestAppWithTypedQuery); diff --git a/types/next/test/next-component-tests.tsx b/types/next/test/next-component-tests.tsx index 37cd7264ef..4ba145ee15 100644 --- a/types/next/test/next-component-tests.tsx +++ b/types/next/test/next-component-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { NextStatelessComponent, NextContext } from "next"; +import { NextStatelessComponent, NextContext, NextComponentType } from "next"; interface NextComponentProps { example: string; @@ -12,13 +12,11 @@ interface TypedQuery { class ClassNext extends React.Component { static async getInitialProps(ctx: NextContext) { const { example } = ctx.query; - return { example }; + return { example: example as string }; } render() { - return ( -

I'm a class component! {this.props.example}
- ); + return
I'm a class component! {this.props.example}
; } } @@ -38,3 +36,87 @@ StatelessNext.getInitialProps = async ({ query }: NextContext) => { const { example } = query; return { example: example as string }; }; + +interface WithExampleProps { + example: string; +} + +interface WithExampleHocProps { + test: string; +} + +interface TestProps { + ownProp: boolean; +} + +// Stateful HOC that adds props to wrapped component. Similar to what withRedux does. +// tslint:disable-next-line use-default-type-parameter +const withExample =

(Page: NextComponentType

) => + class extends React.Component

{ + test: string; + + static async getInitialProps(ctx: NextContext) { + const pageProps = Page.getInitialProps && (await Page.getInitialProps(ctx)); + + // tslint:disable-next-line prefer-object-spread + return Object.assign({}, pageProps, { test: "test" }); + } + + constructor(props: P & WithExampleHocProps) { + super(props); + this.test = props.test; + } + + render() { + return ; + } + }; + +// Basic stateless HOC. Similar to what withAuth would do. +// tslint:disable-next-line no-unnecessary-generics +const withBasic =

(Page: NextComponentType

) => + class extends React.Component

{ + static async getInitialProps(ctx: NextContext) { + const pageProps = Page.getInitialProps && (await Page.getInitialProps(ctx)); + + // tslint:disable-next-line prefer-object-spread + const props = Object.assign({}, pageProps); + + if (ctx.query.example === "bar") { + // Redirect + } + + return props; + } + + render() { + return ; + } + }; + +class NextWithExample extends React.Component { + static async getInitialProps(ctx: NextContext) { + const { id } = ctx.query; + const processQuery = (id?: string) => id; + processQuery(id); + return { ownProp: true }; + } + + render() { + const { ownProp, example } = this.props; + return ( +

+ I'm wrapped in a HOC that gives me an example prop! {example} {ownProp} +
+ ); + } +} + +// P template is inferred as . +withExample(NextWithExample); + +// P template inferred as . +withBasic(ClassNext); + +// P template inferred as +withBasic(withExample(NextWithExample)); diff --git a/types/obj-str/index.d.ts b/types/obj-str/index.d.ts new file mode 100644 index 0000000000..44672fbd0a --- /dev/null +++ b/types/obj-str/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for obj-str 1.0 +// Project: https://github.com/lukeed/obj-str#readme +// Definitions by: Sascha Englert +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = objstr; + +declare function objstr(obj: { [name: string]: boolean }): string; diff --git a/types/obj-str/obj-str-tests.ts b/types/obj-str/obj-str-tests.ts new file mode 100644 index 0000000000..e945aef673 --- /dev/null +++ b/types/obj-str/obj-str-tests.ts @@ -0,0 +1,6 @@ +import objstr = require('obj-str'); + +const isTrue = () => true; + +objstr({ foo: true, bar: false, baz: isTrue() }); +// => 'foo baz' diff --git a/types/obj-str/tsconfig.json b/types/obj-str/tsconfig.json new file mode 100644 index 0000000000..e2498d5707 --- /dev/null +++ b/types/obj-str/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "strictFunctionTypes": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "obj-str-tests.ts"] +} diff --git a/types/obj-str/tslint.json b/types/obj-str/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/obj-str/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 9e51ad6fad..96da063a76 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -17176,12 +17176,9 @@ declare namespace OfficeExtension { //////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// ////////////////////// Begin OfficeCore //////////////////////// //////////////////////////////////////////////////////////////// @@ -17209,6 +17206,15 @@ declare namespace OfficeCore { //////////////////////////////////////////////////////////////// declare namespace Excel { + /** + * + * Creates and opens a new workbook. Optionally, the workbook can be pre-populated with a base64-encoded .xlsx file. + * + * [Api set: ExcelApi 1.8] + * + * @param base64File Optional. The base64 encoded .xlsx file. The default value is null. + */ + function createWorkbook(base64?: string): Promise; interface ThreeArrowsSet { [index: number]: Icon; redDownArrow: Icon; @@ -17575,14 +17581,14 @@ declare namespace Excel { * * Gets the range that represents the changed area of a specific worksheet. * - * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * [Api set: ExcelApi 1.8] */ getRange(ctx: Excel.RequestContext): Excel.Range; /** * * Gets the range that represents the changed area of a specific worksheet. It might return null object. * - * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * [Api set: ExcelApi 1.8] */ getRangeOrNullObject(ctx: Excel.RequestContext): Excel.Range; } @@ -17639,14 +17645,14 @@ declare namespace Excel { * * Gets the range that represents the changed area of a table on a specific worksheet. * - * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * [Api set: ExcelApi 1.8] */ getRange(ctx: Excel.RequestContext): Excel.Range; /** * * Gets the range that represents the changed area of a table on a specific worksheet. It might return null object. * - * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * [Api set: ExcelApi 1.8] */ getRangeOrNullObject(ctx: Excel.RequestContext): Excel.Range; } @@ -17824,6 +17830,158 @@ declare namespace Excel { */ worksheetId: string; } + /** + * + * Provides information about the chart that raised the Added event. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartAddedEventArgs { + /** + * + * Gets the id of the chart that is added to the worksheet. + * + * [Api set: ExcelApi 1.8] + */ + chartId: string; + /** + * + * Gets the source of the event. See Excel.EventSource for details. + * + * [Api set: ExcelApi 1.8] + */ + source: Excel.EventSource | "Local" | "Remote"; + /** + * + * Gets the type of the event. See Excel.EventType for details. + * + * [Api set: ExcelApi 1.8] + */ + type: "ChartAdded"; + /** + * + * Gets the id of the worksheet in which the chart is added. + * + * [Api set: ExcelApi 1.8] + */ + worksheetId: string; + } + /** + * + * Provides information about the chart that raised the Activated event. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartActivatedEventArgs { + /** + * + * Gets the id of the chart that is activated. + * + * [Api set: ExcelApi 1.8] + */ + chartId: string; + /** + * + * Gets the type of the event. See Excel.EventType for details. + * + * [Api set: ExcelApi 1.8] + */ + type: "ChartActivated"; + /** + * + * Gets the id of the worksheet in which the chart is activated. + * + * [Api set: ExcelApi 1.8] + */ + worksheetId: string; + } + /** + * + * Provides information about the chart that raised the Deactivated event. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartDeactivatedEventArgs { + /** + * + * Gets the id of the chart that is deactivated. + * + * [Api set: ExcelApi 1.8] + */ + chartId: string; + /** + * + * Gets the type of the event. See Excel.EventType for details. + * + * [Api set: ExcelApi 1.8] + */ + type: "ChartDeactivated"; + /** + * + * Gets the id of the worksheet in which the chart is deactivated. + * + * [Api set: ExcelApi 1.8] + */ + worksheetId: string; + } + /** + * + * Provides information about the chart that raised the Deleted event. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartDeletedEventArgs { + /** + * + * Gets the id of the chart that is deleted from the worksheet. + * + * [Api set: ExcelApi 1.8] + */ + chartId: string; + /** + * + * Gets the source of the event. See Excel.EventSource for details. + * + * [Api set: ExcelApi 1.8] + */ + source: Excel.EventSource | "Local" | "Remote"; + /** + * + * Gets the type of the event. See Excel.EventType for details. + * + * [Api set: ExcelApi 1.8] + */ + type: "ChartDeleted"; + /** + * + * Gets the id of the worksheet in which the chart is deleted. + * + * [Api set: ExcelApi 1.8] + */ + worksheetId: string; + } + /** + * + * Provides information about the worksheet that raised the Calculated event. + * + * [Api set: ExcelApi 1.8] + */ + interface WorksheetCalculatedEventArgs { + /** + * + * Gets the type of the event. See Excel.EventType for details. + * + * [Api set: ExcelApi 1.8] + */ + type: "WorksheetCalculated"; + /** + * + * Gets the id of the worksheet that is calculated. + * + * [Api set: ExcelApi 1.8] + */ + worksheetId: string; + } /** * * Represents the Excel Runtime class. @@ -17831,9 +17989,49 @@ declare namespace Excel { * [Api set: ExcelApi 1.5] */ class Runtime extends OfficeExtension.ClientObject { - toJSON(): { - [key: string]: string; - }; + /** + * + * Turn on/off JavaScript events in current taskpane or content add-in. + * + * [Api set: ExcelApi 1.8] + */ + enableEvents: boolean; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.Runtime): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.RuntimeUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.Runtime): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.Runtime` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.Runtime` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.Runtime` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.RuntimeLoadOptions): Excel.Runtime; + load(option?: string | string[]): Excel.Runtime; + load(option?: { + select?: string; + expand?: string; + }): Excel.Runtime; + toJSON(): Excel.Interfaces.RuntimeData; } /** * @@ -18016,6 +18214,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ readonly name: string; + /** + * + * True if the workbook is open in Read-only mode. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readonly readOnly: boolean; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. * * @remarks @@ -18131,6 +18336,35 @@ declare namespace Excel { }): Excel.WorkbookProtection; toJSON(): Excel.Interfaces.WorkbookProtectionData; } + /** + * + * The WorkbookCreated object is the top level object created by Application.CreateWorkbook. A WorkbookCreated object is a special Workbook object. + * + * [Api set: ExcelApi 1.8] + */ + class WorkbookCreated extends OfficeExtension.ClientObject { + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.WorkbookCreated` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.WorkbookCreated` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.WorkbookCreated` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: string | string[]): Excel.WorkbookCreated; + load(option?: { + select?: string; + expand?: string; + }): Excel.WorkbookCreated; + toJSON(): Excel.Interfaces.WorkbookCreatedData; + } /** * * An Excel worksheet is a grid of cells. It can contain data, tables, charts, etc. @@ -18204,6 +18438,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ position: number; + /** + * + * Gets or sets the worksheet's gridlines flag. + This flag determines whether gridlines are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showGridlines: boolean; + /** + * + * Gets or sets the worksheet's headings flag. + This flag determines whether headings are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showHeadings: boolean; /** * * Returns the standard (default) height of all the rows in the worksheet, in points. Read-only. @@ -18407,6 +18657,15 @@ declare namespace Excel { * @eventproperty */ readonly onActivated: OfficeExtension.EventHandlers; + /** + * + * Occurs when the worksheet is calculated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onCalculated: OfficeExtension.EventHandlers; /** * * Occurs when data changed on a specific worksheet. @@ -18542,6 +18801,15 @@ declare namespace Excel { * @eventproperty */ readonly onAdded: OfficeExtension.EventHandlers; + /** + * + * Occurs when any worksheet in the workbook is calculated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onCalculated: OfficeExtension.EventHandlers; /** * * Occurs when any worksheet in the workbook is deactivated. @@ -18808,6 +19076,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.6] */ readonly conditionalFormats: Excel.ConditionalFormatCollection; + /** + * + * Returns a data validation object. + * + * [Api set: ExcelApi 1.8] + */ + readonly dataValidation: Excel.DataValidation; /** * * Returns a format object, encapsulating the range's font, fill, borders, alignment, and other properties. Read-only. @@ -20327,6 +20602,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ readonly id: string; + /** + * + * Returns a numeric id. + * + * [Api set: ExcelApi 1.8] + */ + readonly legacyId: string; /** * * Name of the table. @@ -20836,6 +21118,327 @@ declare namespace Excel { }): Excel.TableRow; toJSON(): Excel.Interfaces.TableRowData; } + /** + * + * Represents the data validation applied to the current range. + * + * [Api set: ExcelApi 1.8] + */ + class DataValidation extends OfficeExtension.ClientObject { + /** + * + * Error alert when user enters invalid data. + * + * [Api set: ExcelApi 1.8] + */ + errorAlert: Excel.DataValidationErrorAlert; + /** + * + * Ignore blanks: no data validation will be performed on blank cells, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + ignoreBlanks: boolean; + /** + * + * Prompt when users select a cell. + * + * [Api set: ExcelApi 1.8] + */ + prompt: Excel.DataValidationPrompt; + /** + * + * Data Validation rule that contains different type of data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + rule: Excel.DataValidationRule; + /** + * + * Type of the data validation, see Excel.DataValidationType for details. + * + * [Api set: ExcelApi 1.8] + */ + readonly type: Excel.DataValidationType | "None" | "WholeNumber" | "Decimal" | "List" | "Date" | "Time" | "TextLength" | "Custom" | "Inconsistent" | "MixedCriteria"; + /** + * + * Represents if all cell values are valid according to the data validation rules. + Returns true if all cell values are valid, or false if all cell values are invalid. + Returns null if there are both valid and invalid cell values within the range. + * + * [Api set: ExcelApi 1.8] + */ + readonly valid: boolean; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.DataValidation): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.DataValidationUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.DataValidation): void; + /** + * + * Clears the data validation from the current range. + * + * [Api set: ExcelApi 1.8] + */ + clear(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.DataValidation` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.DataValidation` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.DataValidation` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.DataValidationLoadOptions): Excel.DataValidation; + load(option?: string | string[]): Excel.DataValidation; + load(option?: { + select?: string; + expand?: string; + }): Excel.DataValidation; + toJSON(): Excel.Interfaces.DataValidationData; + } + /** + * + * Data validation rule contains different types of data validation. You can only use one of them at a time according the Excel.DataValidationType. + * + * [Api set: ExcelApi 1.8] + */ + interface DataValidationRule { + /** + * + * Custom data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + custom?: Excel.CustomDataValidation; + /** + * + * Date data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + date?: Excel.DateTimeDataValidation; + /** + * + * Decimal data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + decimal?: Excel.BasicDataValidation; + /** + * + * List data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + list?: Excel.ListDataValidation; + /** + * + * TextLength data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + textLength?: Excel.BasicDataValidation; + /** + * + * Time data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + time?: Excel.DateTimeDataValidation; + /** + * + * WholeNumber data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + wholeNumber?: Excel.BasicDataValidation; + } + /** + * + * Represents the Basic Type data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + interface BasicDataValidation { + /** + * + * Gets or sets the Formula1, i.e. minimum value or value depending of the operator. + When setting the value, it can be passed in as a number, a range object, or a string formula (where the string is either a stringified number, a cell reference like "=A1", or a formula like "=MIN(A1, B1)"). + When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc. + * + * [Api set: ExcelApi 1.8] + */ + formula1: string | number | Range; + /** + * + * Gets or sets the Formula2, i.e. maximum value or value depending of the operator. + When setting the value, it can be passed in as a number, a range object, or a string formula (where the string is either a stringified number, a cell reference like "=A1", or a formula like "=MIN(A1, B1)"). + When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc. + * + * [Api set: ExcelApi 1.8] + */ + formula2?: string | number | Range; + /** + * + * The operator to use for validating the data. + * + * [Api set: ExcelApi 1.8] + */ + operator: Excel.DataValidationOperator | "Between" | "NotBetween" | "EqualTo" | "NotEqualTo" | "GreaterThan" | "LessThan" | "GreaterThanOrEqualTo" | "LessThanOrEqualTo"; + } + /** + * + * Represents the Date data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + interface DateTimeDataValidation { + /** + * + * Gets or sets the Formula1, i.e. minimum value or value depending of the operator. + When setting the value, it can be passed in as a Date, a Range object, or a string formula (where the string is either a stringified date/time in ISO8601 format, a cell reference like "=A1", or a formula like "=MIN(A1, B1)"). + When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc. + * + * [Api set: ExcelApi 1.8] + */ + formula1: string | Date | Range; + /** + * + * Gets or sets the Formula2, i.e. maximum value or value depending of the operator. + When setting the value, it can be passed in as a Date, a Range object, or a string (where the string is either a stringified date/time in ISO8601 format, a cell reference like "=A1", or a formula like "=MIN(A1, B1)"). + When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc. + * + * [Api set: ExcelApi 1.8] + */ + formula2?: string | Date | Range; + /** + * + * The operator to use for validating the data. + * + * [Api set: ExcelApi 1.8] + */ + operator: Excel.DataValidationOperator | "Between" | "NotBetween" | "EqualTo" | "NotEqualTo" | "GreaterThan" | "LessThan" | "GreaterThanOrEqualTo" | "LessThanOrEqualTo"; + } + /** + * + * Represents the List data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + interface ListDataValidation { + /** + * + * Displays the list in cell drop down or not, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + inCellDropDown: boolean; + /** + * + * Source of the list for data validation + When setting the value, it can be passed in as a Excel Range object, or a string that contains comma separated number, boolean or date. + * + * [Api set: ExcelApi 1.8] + */ + source: string | Range; + } + /** + * + * Represents the Custom data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + interface CustomDataValidation { + /** + * + * Custom data validation formula, it is to create special rules, such as preventing duplicates, or limiting the total in a range of cells. + * + * [Api set: ExcelApi 1.8] + */ + formula: string; + } + /** + * + * Represents the error alert properties for the data validation. + * + * [Api set: ExcelApi 1.8] + */ + interface DataValidationErrorAlert { + /** + * + * Represents error alert message. + * + * [Api set: ExcelApi 1.8] + */ + message: string; + /** + * + * It determines show error alert dialog or not when users enter invalid data, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + showAlert: boolean; + /** + * + * Represents Data validation alert type, please see Excel.DataValidationAlertStyle for details. + * + * [Api set: ExcelApi 1.8] + */ + style: Excel.DataValidationAlertStyle | "Stop" | "Warning" | "Information"; + /** + * + * Represents error alert dialog title. + * + * [Api set: ExcelApi 1.8] + */ + title: string; + } + /** + * + * Represents the user prompt properties for the data validation. + * + * [Api set: ExcelApi 1.8] + */ + interface DataValidationPrompt { + /** + * + * Represents the message of the prompt. + * + * [Api set: ExcelApi 1.8] + */ + message: string; + /** + * + * It determines showing the prompt or not when user selects a cell with the data validation. + * + * [Api set: ExcelApi 1.8] + */ + showPrompt: boolean; + /** + * + * Represents the title for the prompt. + * + * [Api set: ExcelApi 1.8] + */ + title: string; + } /** * * A format object encapsulating the range's font, fill, borders, alignment, and other properties. @@ -21360,7 +21963,7 @@ declare namespace Excel { * @param sourceData The Range object corresponding to the source data. * @param seriesBy Optional. Specifies the way columns or rows are used as data series on the chart. See Excel.ChartSeriesBy for details. */ - add(type: "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel", sourceData: Range, seriesBy?: "Auto" | "Columns" | "Rows"): Excel.Chart; + add(type: "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel", sourceData: Range, seriesBy?: "Auto" | "Columns" | "Rows"): Excel.Chart; /** * * Returns the number of charts in the worksheet. @@ -21414,6 +22017,42 @@ declare namespace Excel { load(option?: Excel.Interfaces.ChartCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.ChartCollection; load(option?: string | string[]): Excel.ChartCollection; load(option?: OfficeExtension.LoadOption): Excel.ChartCollection; + /** + * + * Occurs when a chart is activated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onActivated: OfficeExtension.EventHandlers; + /** + * + * Occurs when a new chart is added to the worksheet. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onAdded: OfficeExtension.EventHandlers; + /** + * + * Occurs when a chart is deactivated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onDeactivated: OfficeExtension.EventHandlers; + /** + * + * Occurs when a chart is deleted. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onDeleted: OfficeExtension.EventHandlers; toJSON(): Excel.Interfaces.ChartCollectionData; } /** @@ -21454,6 +22093,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ readonly legend: Excel.ChartLegend; + /** + * + * Represents the plotArea for the chart. + * + * [Api set: ExcelApi 1.8] + */ + readonly plotArea: Excel.ChartPlotArea; /** * * Represents either a single series or collection of series in the chart. Read-only. @@ -21475,13 +22121,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.2] */ readonly worksheet: Excel.Worksheet; + /** + * + * Returns or sets a ChartCategoryLabelLevel enumeration constant referring to + the level of where the category labels are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + categoryLabelLevel: number; /** * * Represents the type of the chart. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + /** + * + * Returns or sets the way that blank cells are plotted on a chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + displayBlanksAs: Excel.ChartDisplayBlanksAs | "NotPlotted" | "Zero" | "Interplotted"; /** * * Represents the height, in points, of the chart object. @@ -21510,6 +22171,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name: string; + /** + * + * Returns or sets the way columns or rows are used as data series on the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotBy: Excel.ChartPlotBy | "Rows" | "Columns"; + /** + * + * True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotVisibleOnly: boolean; + /** + * + * Returns or sets a ChartSeriesNameLevel enumeration constant referring to + the level of where the series names are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + seriesNameLevel: number; /** * * Represents whether to display all field buttons on a PivotChart. @@ -21517,6 +22200,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showAllFieldButtons: boolean; + /** + * + * Represents whether to to show the data labels when the value is greater than the maximum value on the value axis. + If value axis became smaller than the size of data points, you can use this property to set whether to show the data labels. + This property applies to 2-D charts only. + * + * [Api set: ExcelApi 1.8] + */ + showDataLabelsOverMaximum: boolean; + /** + * + * Returns or sets the chart style for the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + style: number; /** * * Represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). @@ -21627,6 +22326,24 @@ declare namespace Excel { select?: string; expand?: string; }): Excel.Chart; + /** + * + * Occurs when the chart is activated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onActivated: OfficeExtension.EventHandlers; + /** + * + * Occurs when the chart is deactivated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onDeactivated: OfficeExtension.EventHandlers; toJSON(): Excel.Interfaces.ChartData; } /** @@ -21763,6 +22480,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ class ChartSeries extends OfficeExtension.ClientObject { + /** + * + * Represents a collection of all dataLabels in the series. + * + * [Api set: ExcelApi 1.8] + */ + readonly dataLabels: Excel.ChartDataLabels; /** * * Represents the formatting of a chart series, which includes fill and line formatting. Read-only. @@ -21784,13 +22508,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ readonly trendlines: Excel.ChartTrendlineCollection; + /** + * + * Returns or sets the group for the specified series. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + axisGroup: Excel.ChartAxisGroup | "Primary" | "Secondary"; /** * * Represents the chart type of a series. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -21799,6 +22530,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ doughnutHoleSize: number; + /** + * + * Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + explosion: number; /** * * Boolean value representing if the series is filtered or not. Not applicable for surface charts. @@ -21806,6 +22544,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ filtered: boolean; + /** + * + * Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + firstSliceAngle: number; /** * * Represents the gap width of a chart series. Only valid on bar and column charts, as well as @@ -21821,6 +22566,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ hasDataLabels: boolean; + /** + * + * True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + invertIfNegative: boolean; /** * * Represents markers background color of a chart series. @@ -21856,6 +22608,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name: string; + /** + * + * Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + overlap: number; /** * * Represents the plot order of a chart series within the chart group. @@ -21863,6 +22622,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ plotOrder: number; + /** + * + * Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + secondPlotSize: number; /** * * Boolean value representing if the series has a shadow or not. @@ -21877,6 +22643,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ smooth: boolean; + /** + * + * Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + splitType: Excel.ChartSplitStype | "SplitByPosition" | "SplitByValue" | "SplitByPercentValue" | "SplitByCustomSplit"; + /** + * + * True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + varyByCategories: boolean; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. * * @remarks @@ -22336,6 +23116,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ readonly title: Excel.ChartAxisTitle; + /** + * + * Represents the alignment for the specified axis tick label. See Excel.ChartTextHorizontalAlignment for detail. + * + * [Api set: ExcelApi 1.8] + */ + alignment: Excel.ChartTickLabelAlignment | "Center" | "Left" | "Right"; /** * * Represents the group for the specified axis. See Excel.ChartAxisGroup for details. Read-only. @@ -22378,6 +23165,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ readonly height: number; + /** + * + * Represents whether value axis crosses the category axis between categories. + * + * [Api set: ExcelApi 1.8] + */ + isBetweenCategories: boolean; /** * * Represents the distance, in points, from the left edge of the axis to the left of chart area. Null if the axis is not visible. Read-only. @@ -22448,6 +23242,41 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ minorUnit: any; + /** + * + * Represents whether an axis is multilevel or not. + * + * [Api set: ExcelApi 1.8] + */ + multiLevel: boolean; + /** + * + * Represents the format code for the axis tick label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat: string; + /** + * + * Represents the distance between the levels of labels, and the distance between the first level and the axis line. The value should be an integer from 0 to 1000. + * + * [Api set: ExcelApi 1.8] + */ + offset: number; + /** + * + * Represents the specified axis position where the other axis crosses. See Excel.ChartAxisPosition for details. + * + * [Api set: ExcelApi 1.8] + */ + position: Excel.ChartAxisPosition | "Automatic" | "Maximum" | "Minimum" | "Custom"; + /** + * + * Represents the specified axis position where the other axis crosses at. Read Only. Set to this property should use SetPositionAt(double) method. + * + * [Api set: ExcelApi 1.8] + */ + readonly positionAt: number; /** * * Represents whether Microsoft Excel plots data points from last to first. @@ -22469,6 +23298,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showDisplayUnitLabel: boolean; + /** + * + * Represents the text orientation of the axis tick label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation: any; /** * * Represents the position of tick-mark labels on the specified axis. See Excel.ChartAxisTickLabelPosition for details. @@ -22550,6 +23386,15 @@ declare namespace Excel { * @param value Custom value of the display unit. */ setCustomDisplayUnit(value: number): void; + /** + * + * Set the specified axis position where the other axis crosses at. + * + * [Api set: ExcelApi 1.8] + * + * @param value Custom value of the crosses at + */ + setPositionAt(value: number): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. * @@ -22580,6 +23425,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ class ChartAxisFormat extends OfficeExtension.ClientObject { + /** + * + * Represents chart fill formatting. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readonly fill: Excel.ChartFill; /** * * Represents the font attributes (font name, font size, color, etc.) for a chart axis element. Read-only. @@ -22673,6 +23525,15 @@ declare namespace Excel { set(properties: Interfaces.ChartAxisTitleUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ set(properties: Excel.ChartAxisTitle): void; + /** + * + * A string value that represents the formula of chart axis title using A1-style notation. + * + * [Api set: ExcelApi 1.8] + * + * @param formula a string that present the formula to set + */ + setFormula(formula: string): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. * @@ -22703,6 +23564,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ class ChartAxisTitleFormat extends OfficeExtension.ClientObject { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + readonly border: Excel.ChartBorder; + /** + * + * Represents chart fill formatting. + * + * [Api set: ExcelApi 1.8] + */ + readonly fill: Excel.ChartFill; /** * * Represents the font attributes, such as font name, font size, color, etc. of chart axis title object. Read-only. @@ -22761,6 +23636,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ readonly format: Excel.ChartDataLabelFormat; + /** + * + * Represents whether data labels automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText: boolean; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the format code for data labels. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -22817,6 +23714,21 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ showValue: boolean; + /** + * + * Represents the text orientation of data labels. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. * * @remarks @@ -22861,6 +23773,56 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ class ChartDataLabel extends OfficeExtension.ClientObject { + /** + * + * Represents the format of chart data label. + * + * [Api set: ExcelApi 1.8] + */ + readonly format: Excel.ChartDataLabelFormat; + /** + * + * Boolean value representing if data label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText: boolean; + /** + * + * String value that represents the formula of chart data label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula: string; + /** + * + * Returns the height, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + readonly height: number; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart data label to the left edge of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left: number; + /** + * + * String value that represents the format code for data label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -22917,6 +23879,42 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showValue: boolean; + /** + * + * String representing the text of the data label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text: string; + /** + * + * Represents the text orientation of chart data label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation: number; + /** + * + * Represents the distance, in points, from the top edge of chart data label to the top of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; + /** + * + * Returns the width, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + readonly width: number; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. * * @remarks @@ -22961,6 +23959,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ class ChartDataLabelFormat extends OfficeExtension.ClientObject { + /** + * + * Represents the border format, which includes color, linestyle, and weight. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readonly border: Excel.ChartBorder; /** * * Represents the fill format of the current chart data label. Read-only. @@ -23242,6 +24247,34 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ class ChartLegendEntry extends OfficeExtension.ClientObject { + /** + * + * Represents the height of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + readonly height: number; + /** + * + * Represents the index of the LegendEntry in the Chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + readonly index: number; + /** + * + * Represents the left of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + readonly left: number; + /** + * + * Represents the top of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + readonly top: number; /** * * Represents the visible of a chart legend entry. @@ -23249,6 +24282,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ visible: boolean; + /** + * + * Represents the width of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + readonly width: number; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. * * @remarks @@ -23338,6 +24378,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ class ChartLegendFormat extends OfficeExtension.ClientObject { + /** + * + * Represents the border format, which includes color, linestyle, and weight. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readonly border: Excel.ChartBorder; /** * * Represents the fill format of an object, which includes background formating information. Read-only. @@ -23732,6 +24779,13 @@ declare namespace Excel { set(properties: Interfaces.ChartBorderUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ set(properties: Excel.ChartBorder): void; + /** + * + * Clear the border format of a chart element. + * + * [Api set: ExcelApi 1.8] + */ + clear(): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. * @@ -23927,6 +24981,27 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ readonly format: Excel.ChartTrendlineFormat; + /** + * + * Represents the label of a chart trendline. + * + * [Api set: ExcelApi 1.8] + */ + readonly label: Excel.ChartTrendlineLabel; + /** + * + * Represents the number of periods that the trendline extends backward. + * + * [Api set: ExcelApi 1.8] + */ + backwardPeriod: number; + /** + * + * Represents the number of periods that the trendline extends forward. + * + * [Api set: ExcelApi 1.8] + */ + forwardPeriod: number; /** * * Represents the intercept value of the trendline. Can be set to a numeric value or an empty string (for automatic values). The returned value is always a number. @@ -23955,6 +25030,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ polynomialOrder: number; + /** + * + * True if the equation for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showEquation: boolean; + /** + * + * True if the R-squared for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showRSquared: boolean; /** * * Represents the type of a chart trendline. @@ -24120,6 +25209,373 @@ declare namespace Excel { }): Excel.ChartTrendlineFormat; toJSON(): Excel.Interfaces.ChartTrendlineFormatData; } + /** + * + * This object represents the attributes for a chart trendline lable object. + * + * [Api set: ExcelApi 1.8] + */ + class ChartTrendlineLabel extends OfficeExtension.ClientObject { + /** + * + * Represents the format of chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + readonly format: Excel.ChartTrendlineLabelFormat; + /** + * + * Boolean value representing if trendline label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText: boolean; + /** + * + * String value that represents the formula of chart trendline label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula: string; + /** + * + * Returns the height, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + readonly height: number; + /** + * + * Represents the horizontal alignment for chart trendline label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of trendline label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart trendline label to the left edge of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left: number; + /** + * + * String value that represents the format code for trendline label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat: string; + /** + * + * String representing the text of the trendline label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text: string; + /** + * + * Represents the text orientation of chart trendline label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation: number; + /** + * + * Represents the distance, in points, from the top edge of chart trendline label to the top of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top: number; + /** + * + * Represents the vertical alignment of chart trendline label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of trendline label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; + /** + * + * Returns the width, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + readonly width: number; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.ChartTrendlineLabel): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ChartTrendlineLabelUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.ChartTrendlineLabel): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.ChartTrendlineLabel` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.ChartTrendlineLabel` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.ChartTrendlineLabel` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.ChartTrendlineLabelLoadOptions): Excel.ChartTrendlineLabel; + load(option?: string | string[]): Excel.ChartTrendlineLabel; + load(option?: { + select?: string; + expand?: string; + }): Excel.ChartTrendlineLabel; + toJSON(): Excel.Interfaces.ChartTrendlineLabelData; + } + /** + * + * Encapsulates the format properties for the chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + class ChartTrendlineLabelFormat extends OfficeExtension.ClientObject { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + readonly border: Excel.ChartBorder; + /** + * + * Represents the fill format of the current chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + readonly fill: Excel.ChartFill; + /** + * + * Represents the font attributes (font name, font size, color, etc.) for a chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + readonly font: Excel.ChartFont; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.ChartTrendlineLabelFormat): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ChartTrendlineLabelFormatUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.ChartTrendlineLabelFormat): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.ChartTrendlineLabelFormat` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.ChartTrendlineLabelFormat` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.ChartTrendlineLabelFormat` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.ChartTrendlineLabelFormatLoadOptions): Excel.ChartTrendlineLabelFormat; + load(option?: string | string[]): Excel.ChartTrendlineLabelFormat; + load(option?: { + select?: string; + expand?: string; + }): Excel.ChartTrendlineLabelFormat; + toJSON(): Excel.Interfaces.ChartTrendlineLabelFormatData; + } + /** + * + * This object represents the attributes for a chart plotArea object. + * + * [Api set: ExcelApi 1.8] + */ + class ChartPlotArea extends OfficeExtension.ClientObject { + /** + * + * Represents the formatting of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + readonly format: Excel.ChartPlotAreaFormat; + /** + * + * Represents the height value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + height: number; + /** + * + * Represents the insideHeight value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideHeight: number; + /** + * + * Represents the insideLeft value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideLeft: number; + /** + * + * Represents the insideTop value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideTop: number; + /** + * + * Represents the insideWidth value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideWidth: number; + /** + * + * Represents the left value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + left: number; + /** + * + * Represents the position of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + position: Excel.ChartPlotAreaPosition | "Automatic" | "Custom"; + /** + * + * Represents the top value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + top: number; + /** + * + * Represents the width value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + width: number; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.ChartPlotArea): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ChartPlotAreaUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.ChartPlotArea): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.ChartPlotArea` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.ChartPlotArea` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.ChartPlotArea` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.ChartPlotAreaLoadOptions): Excel.ChartPlotArea; + load(option?: string | string[]): Excel.ChartPlotArea; + load(option?: { + select?: string; + expand?: string; + }): Excel.ChartPlotArea; + toJSON(): Excel.Interfaces.ChartPlotAreaData; + } + /** + * + * Represents the format properties for chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + class ChartPlotAreaFormat extends OfficeExtension.ClientObject { + /** + * + * Represents the border attributes of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + readonly border: Excel.ChartBorder; + /** + * + * Represents the fill format of an object, which includes background formating information. + * + * [Api set: ExcelApi 1.8] + */ + readonly fill: Excel.ChartFill; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.ChartPlotAreaFormat): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ChartPlotAreaFormatUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.ChartPlotAreaFormat): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.ChartPlotAreaFormat` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.ChartPlotAreaFormat` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.ChartPlotAreaFormat` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.ChartPlotAreaFormatLoadOptions): Excel.ChartPlotAreaFormat; + load(option?: string | string[]): Excel.ChartPlotAreaFormat; + load(option?: { + select?: string; + expand?: string; + }): Excel.ChartPlotAreaFormat; + toJSON(): Excel.Interfaces.ChartPlotAreaFormatData; + } /** * * Manages sorting operations on Range objects. @@ -24792,6 +26248,18 @@ declare namespace Excel { class PivotTableCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ readonly items: Excel.PivotTable[]; + /** + * + * Add a Pivottable based on the specified source data and insert it at the top left cell of the destination range. + * + * [Api set: ExcelApi 1.8] + * + * @param name The name of the new PivotTable. + * @param source The source data for the new PivotTable, this can either be a range (or string address including the worksheet name) or a table. + * @param destination The cell in the upper-left corner of the PivotTable report's destination range (the range on the worksheet where the resulting report will be placed). + * @returns Returns the newly inserted PivotTable. + */ + add(name: string, source: Range | string | Table, destination: Range | string): Excel.PivotTable; /** * * Gets the number of pivot tables in the collection. @@ -24854,6 +26322,48 @@ declare namespace Excel { * Our {@link https://docs.microsoft.com/office/dev/add-ins/excel/excel-add-ins-pivottables | how-to guide on working with PivotTables} has detailed walkthroughs, images, and code samples. */ class PivotTable extends OfficeExtension.ClientObject { + /** + * + * The Column Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly columnHierarchies: Excel.RowColumnPivotHierarchyCollection; + /** + * + * The Data Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly dataHierarchies: Excel.DataPivotHierarchyCollection; + /** + * + * The Filter Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly filterHierarchies: Excel.FilterPivotHierarchyCollection; + /** + * + * The Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly hierarchies: Excel.PivotHierarchyCollection; + /** + * + * The PivotLayout describing the layout and visual structure of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly layout: Excel.PivotLayout; + /** + * + * The Row Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly rowHierarchies: Excel.RowColumnPivotHierarchyCollection; /** * * The worksheet containing the current PivotTable. @@ -24889,6 +26399,13 @@ declare namespace Excel { set(properties: Interfaces.PivotTableUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ set(properties: Excel.PivotTable): void; + /** + * + * Deletes the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + delete(): void; /** * * Refreshes the PivotTable. @@ -24919,6 +26436,1234 @@ declare namespace Excel { }): Excel.PivotTable; toJSON(): Excel.Interfaces.PivotTableData; } + /** + * + * Represents the visual layout of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + class PivotLayout extends OfficeExtension.ClientObject { + /** + * + * This property indicates the PivotLayoutType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + layoutType: Excel.PivotLayoutType | "Compact" | "Tabular" | "Outline"; + /** + * + * True if the PivotTable report shows grand totals for columns. + * + * [Api set: ExcelApi 1.8] + */ + showColumnGrandTotals: boolean; + /** + * + * True if the PivotTable report shows grand totals for rows. + * + * [Api set: ExcelApi 1.8] + */ + showRowGrandTotals: boolean; + /** + * + * This property indicates the SubtotalLocationType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + subtotalLocation: Excel.SubtotalLocationType | "AtTop" | "AtBottom" | "Off"; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.PivotLayout): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PivotLayoutUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.PivotLayout): void; + /** + * + * Returns the range where the PivotTable's column labels reside. + * + * [Api set: ExcelApi 1.8] + */ + getColumnLabelRange(): Excel.Range; + /** + * + * Returns the range where the PivotTable's data values reside. + * + * [Api set: ExcelApi 1.8] + */ + getDataBodyRange(): Excel.Range; + /** + * + * Returns the range of the PivotTable's filter area. + * + * [Api set: ExcelApi 1.8] + */ + getFilterAxisRange(): Excel.Range; + /** + * + * Returns the range the PivotTable exists on, excluding the filter area. + * + * [Api set: ExcelApi 1.8] + */ + getRange(): Excel.Range; + /** + * + * Returns the range where the PivotTable's row labels reside. + * + * [Api set: ExcelApi 1.8] + */ + getRowLabelRange(): Excel.Range; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotLayout` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotLayout` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotLayout` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotLayoutLoadOptions): Excel.PivotLayout; + load(option?: string | string[]): Excel.PivotLayout; + load(option?: { + select?: string; + expand?: string; + }): Excel.PivotLayout; + toJSON(): Excel.Interfaces.PivotLayoutData; + } + /** + * + * Represents a collection of all the PivotTables that are part of the workbook or worksheet. + * + * [Api set: ExcelApi 1.8] + */ + class PivotHierarchyCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.PivotHierarchy[]; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a PivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.PivotHierarchy; + /** + * + * Gets a PivotHierarchy by name. If the PivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.PivotHierarchy; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotHierarchyCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotHierarchyCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotHierarchyCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotHierarchyCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.PivotHierarchyCollection; + load(option?: string | string[]): Excel.PivotHierarchyCollection; + load(option?: OfficeExtension.LoadOption): Excel.PivotHierarchyCollection; + toJSON(): Excel.Interfaces.PivotHierarchyCollectionData; + } + /** + * + * Represents the Excel PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + class PivotHierarchy extends OfficeExtension.ClientObject { + /** + * + * Returns the PivotFields associated with the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly fields: Excel.PivotFieldCollection; + /** + * + * Id of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Name of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.PivotHierarchy): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PivotHierarchyUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.PivotHierarchy): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotHierarchy` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotHierarchy` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotHierarchy` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotHierarchyLoadOptions): Excel.PivotHierarchy; + load(option?: string | string[]): Excel.PivotHierarchy; + load(option?: { + select?: string; + expand?: string; + }): Excel.PivotHierarchy; + toJSON(): Excel.Interfaces.PivotHierarchyData; + } + /** + * + * Represents a collection of RowColumnPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + class RowColumnPivotHierarchyCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.RowColumnPivotHierarchy[]; + /** + * + * Adds the PivotHierarchy to the current axis. If the hierarchy is present elsewhere on the row, column, + or filter axis, it will be removed from that location. + * + * [Api set: ExcelApi 1.8] + */ + add(pivotHierarchy: Excel.PivotHierarchy): Excel.RowColumnPivotHierarchy; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a RowColumnPivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.RowColumnPivotHierarchy; + /** + * + * Gets a RowColumnPivotHierarchy by name. If the RowColumnPivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the RowColumnPivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.RowColumnPivotHierarchy; + /** + * + * Removes the PivotHierarchy from the current axis. + * + * [Api set: ExcelApi 1.8] + */ + remove(rowColumnPivotHierarchy: Excel.RowColumnPivotHierarchy): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.RowColumnPivotHierarchyCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.RowColumnPivotHierarchyCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.RowColumnPivotHierarchyCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.RowColumnPivotHierarchyCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.RowColumnPivotHierarchyCollection; + load(option?: string | string[]): Excel.RowColumnPivotHierarchyCollection; + load(option?: OfficeExtension.LoadOption): Excel.RowColumnPivotHierarchyCollection; + toJSON(): Excel.Interfaces.RowColumnPivotHierarchyCollectionData; + } + /** + * + * Represents the Excel RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + class RowColumnPivotHierarchy extends OfficeExtension.ClientObject { + /** + * + * Returns the PivotFields associated with the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly fields: Excel.PivotFieldCollection; + /** + * + * Id of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Name of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** + * + * Position of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position: number; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.RowColumnPivotHierarchy): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.RowColumnPivotHierarchyUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.RowColumnPivotHierarchy): void; + /** + * + * Reset the RowColumnPivotHierarchy back to its default values. + * + * [Api set: ExcelApi 1.8] + */ + setToDefault(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.RowColumnPivotHierarchy` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.RowColumnPivotHierarchy` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.RowColumnPivotHierarchy` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.RowColumnPivotHierarchyLoadOptions): Excel.RowColumnPivotHierarchy; + load(option?: string | string[]): Excel.RowColumnPivotHierarchy; + load(option?: { + select?: string; + expand?: string; + }): Excel.RowColumnPivotHierarchy; + toJSON(): Excel.Interfaces.RowColumnPivotHierarchyData; + } + /** + * + * Represents a collection of FilterPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + class FilterPivotHierarchyCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.FilterPivotHierarchy[]; + /** + * + * Adds the PivotHierarchy to the current axis. If the hierarchy is present elsewhere on the row, column, + or filter axis, it will be removed from that location. + * + * [Api set: ExcelApi 1.8] + */ + add(pivotHierarchy: Excel.PivotHierarchy): Excel.FilterPivotHierarchy; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a FilterPivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.FilterPivotHierarchy; + /** + * + * Gets a FilterPivotHierarchy by name. If the FilterPivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the FilterPivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.FilterPivotHierarchy; + /** + * + * Removes the PivotHierarchy from the current axis. + * + * [Api set: ExcelApi 1.8] + */ + remove(filterPivotHierarchy: Excel.FilterPivotHierarchy): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.FilterPivotHierarchyCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.FilterPivotHierarchyCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.FilterPivotHierarchyCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.FilterPivotHierarchyCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.FilterPivotHierarchyCollection; + load(option?: string | string[]): Excel.FilterPivotHierarchyCollection; + load(option?: OfficeExtension.LoadOption): Excel.FilterPivotHierarchyCollection; + toJSON(): Excel.Interfaces.FilterPivotHierarchyCollectionData; + } + /** + * + * Represents the Excel FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + class FilterPivotHierarchy extends OfficeExtension.ClientObject { + /** + * + * Returns the PivotFields associated with the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly fields: Excel.PivotFieldCollection; + /** + * + * Determines whether to allow multiple filter items. + * + * [Api set: ExcelApi 1.8] + */ + enableMultipleFilterItems: boolean; + /** + * + * Id of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Name of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** + * + * Position of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position: number; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.FilterPivotHierarchy): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.FilterPivotHierarchyUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.FilterPivotHierarchy): void; + /** + * + * Reset the FilterPivotHierarchy back to its default values. + * + * [Api set: ExcelApi 1.8] + */ + setToDefault(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.FilterPivotHierarchy` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.FilterPivotHierarchy` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.FilterPivotHierarchy` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.FilterPivotHierarchyLoadOptions): Excel.FilterPivotHierarchy; + load(option?: string | string[]): Excel.FilterPivotHierarchy; + load(option?: { + select?: string; + expand?: string; + }): Excel.FilterPivotHierarchy; + toJSON(): Excel.Interfaces.FilterPivotHierarchyData; + } + /** + * + * Represents a collection of DataPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + class DataPivotHierarchyCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.DataPivotHierarchy[]; + /** + * + * Adds the PivotHierarchy to the current axis. + * + * [Api set: ExcelApi 1.8] + */ + add(pivotHierarchy: Excel.PivotHierarchy): Excel.DataPivotHierarchy; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a DataPivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.DataPivotHierarchy; + /** + * + * Gets a DataPivotHierarchy by name. If the DataPivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the DataPivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.DataPivotHierarchy; + /** + * + * Removes the PivotHierarchy from the current axis. + * + * [Api set: ExcelApi 1.8] + */ + remove(DataPivotHierarchy: Excel.DataPivotHierarchy): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.DataPivotHierarchyCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.DataPivotHierarchyCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.DataPivotHierarchyCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.DataPivotHierarchyCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.DataPivotHierarchyCollection; + load(option?: string | string[]): Excel.DataPivotHierarchyCollection; + load(option?: OfficeExtension.LoadOption): Excel.DataPivotHierarchyCollection; + toJSON(): Excel.Interfaces.DataPivotHierarchyCollectionData; + } + /** + * + * Represents the Excel DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + class DataPivotHierarchy extends OfficeExtension.ClientObject { + /** + * + * Returns the PivotFields associated with the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly field: Excel.PivotField; + /** + * + * Id of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Name of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** + * + * Number format of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat: string; + /** + * + * Position of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position: number; + /** + * + * Determines whether the data should be sown as a specific summary calculation or not. + * + * [Api set: ExcelApi 1.8] + */ + showAs: Excel.ShowAsRule; + /** + * + * Determines whether to show all items of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + summarizeBy: Excel.AggregationFunction | "Unknown" | "Automatic" | "Sum" | "Count" | "Average" | "Max" | "Min" | "Product" | "CountNumbers" | "StandardDeviation" | "StandardDeviationP" | "Variance" | "VarianceP"; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.DataPivotHierarchy): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.DataPivotHierarchyUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.DataPivotHierarchy): void; + /** + * + * Reset the DataPivotHierarchy back to its default values. + * + * [Api set: ExcelApi 1.8] + */ + setToDefault(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.DataPivotHierarchy` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.DataPivotHierarchy` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.DataPivotHierarchy` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.DataPivotHierarchyLoadOptions): Excel.DataPivotHierarchy; + load(option?: string | string[]): Excel.DataPivotHierarchy; + load(option?: { + select?: string; + expand?: string; + }): Excel.DataPivotHierarchy; + toJSON(): Excel.Interfaces.DataPivotHierarchyData; + } + /** + * [Api set: ExcelApi 1.8] + */ + interface ShowAsRule { + /** + * + * The Base PivotField to base the ShowAs calculation, if applicable based on the ShowAsCalculation type, else null. + * + * [Api set: ExcelApi 1.8] + */ + baseField?: Excel.PivotField; + /** + * + * The Base Item to base the ShowAs calculation on, if applicable based on the ShowAsCalculation type, else null. + * + * [Api set: ExcelApi 1.8] + */ + baseItem?: Excel.PivotItem; + /** + * + * The ShowAs Calculation to use for the Data PivotField. See Excel.ShowAsCalculation for Details. + * + * [Api set: ExcelApi 1.8] + */ + calculation: Excel.ShowAsCalculation | "Unknown" | "None" | "PercentOfGrandTotal" | "PercentOfRowTotal" | "PercentOfColumnTotal" | "PercentOfParentRowTotal" | "PercentOfParentColumnTotal" | "PercentOfParentTotal" | "PercentOf" | "RunningTotal" | "PercentRunningTotal" | "DifferenceFrom" | "PercentDifferenceFrom" | "RankAscending" | "RankDecending" | "Index"; + } + /** + * + * Represents a collection of all the PivotTables that are part of the workbook or worksheet. + * + * [Api set: ExcelApi 1.8] + */ + class PivotFieldCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.PivotField[]; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a PivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.PivotField; + /** + * + * Gets a PivotHierarchy by name. If the PivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.PivotField; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotFieldCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotFieldCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotFieldCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotFieldCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.PivotFieldCollection; + load(option?: string | string[]): Excel.PivotFieldCollection; + load(option?: OfficeExtension.LoadOption): Excel.PivotFieldCollection; + toJSON(): Excel.Interfaces.PivotFieldCollectionData; + } + /** + * + * Represents the Excel PivotField. + * + * [Api set: ExcelApi 1.8] + */ + class PivotField extends OfficeExtension.ClientObject { + /** + * + * Returns the PivotFields associated with the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + readonly items: Excel.PivotItemCollection; + /** + * + * Id of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Name of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** + * + * Determines whether to show all items of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + showAllItems: boolean; + /** + * + * Subtotals of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + subtotals: Excel.Subtotals; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.PivotField): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PivotFieldUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.PivotField): void; + /** + * + * Sorts the PivotField. If a DataPivotHierarchy is specified, then sort will be applied based on it, if not sort will be based on the PivotField itself. + * + * [Api set: ExcelApi 1.8] + * + * @param sortby Represents whether the sorting is done in an ascending or descending order. + */ + sortByLabels(sortby: Excel.SortBy): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotField` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotField` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotField` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotFieldLoadOptions): Excel.PivotField; + load(option?: string | string[]): Excel.PivotField; + load(option?: { + select?: string; + expand?: string; + }): Excel.PivotField; + toJSON(): Excel.Interfaces.PivotFieldData; + } + /** + * + * Represents a collection of all the Pivot Items related to their parent PivotField. + * + * [Api set: ExcelApi 1.8] + */ + class PivotItemCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.PivotItem[]; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a PivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.PivotItem; + /** + * + * Gets a PivotHierarchy by name. If the PivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.PivotItem; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotItemCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotItemCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotItemCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotItemCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.PivotItemCollection; + load(option?: string | string[]): Excel.PivotItemCollection; + load(option?: OfficeExtension.LoadOption): Excel.PivotItemCollection; + toJSON(): Excel.Interfaces.PivotItemCollectionData; + } + /** + * + * Represents the Excel PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + class PivotItem extends OfficeExtension.ClientObject { + /** + * + * Id of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Determines whether the item is expanded to show child items or if it's collapsed and child items are hidden. + * + * [Api set: ExcelApi 1.8] + */ + isExpanded: boolean; + /** + * + * Name of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** + * + * Determines whether the PivotItem is visible or not. + * + * [Api set: ExcelApi 1.8] + */ + visible: boolean; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.PivotItem): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PivotItemUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.PivotItem): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotItem` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotItem` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotItem` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotItemLoadOptions): Excel.PivotItem; + load(option?: string | string[]): Excel.PivotItem; + load(option?: { + select?: string; + expand?: string; + }): Excel.PivotItem; + toJSON(): Excel.Interfaces.PivotItemData; + } + /** + * + * Subtotals for the Pivot Field. + * + * [Api set: ExcelApi 1.8] + */ + interface Subtotals { + /** + * + * If Automatic is set to true, then all other values will be ignored when setting the Subtotals. + * + * [Api set: ExcelApi 1.8] + */ + automatic?: boolean; + average?: boolean; + count?: boolean; + countNumbers?: boolean; + max?: boolean; + min?: boolean; + product?: boolean; + standardDeviation?: boolean; + standardDeviationP?: boolean; + sum?: boolean; + variance?: boolean; + varianceP?: boolean; + } + /** + * + * Represents the sort direction. + * + * [Api set: ExcelApi 1.8] + */ + enum SortBy { + /** + * + * Ascending sort. Smallest to largest or A to Z. + * + */ + ascending = "Ascending", + /** + * + * Descending sort. Largest to smallest or Z to A. + * + */ + descending = "Descending", + } + /** + * + * Aggregation Function for the Data Pivot Field. + * + * [Api set: ExcelApi 1.8] + */ + enum AggregationFunction { + /** + * + * Aggregation function is unknown or unsupported. + * + */ + unknown = "Unknown", + /** + * + * Excel will automatically select the aggregation based on the data items. + * + */ + automatic = "Automatic", + /** + * + * Aggregate using the sum of the data, equivalent to the SUM function. + * + */ + sum = "Sum", + /** + * + * Aggregate using the count of items in the data, equivalent to the COUNTA function. + * + */ + count = "Count", + /** + * + * Aggregate using the average of the data, equivalent to the AVERAGE function. + * + */ + average = "Average", + /** + * + * Aggregate using the maximum value of the data, equivalent to the MAX function. + * + */ + max = "Max", + /** + * + * Aggregate using the minimum value of the data, equivalent to the MIN function. + * + */ + min = "Min", + /** + * + * Aggregate using the product of the data, equivalent to the PRODUCT function. + * + */ + product = "Product", + /** + * + * Aggregate using the count of numbers in the data, equivalent to the COUNTA function. + * + */ + countNumbers = "CountNumbers", + /** + * + * Aggregate using the standard deviation of the data, equivalent to the STDEV function. + * + */ + standardDeviation = "StandardDeviation", + /** + * + * Aggregate using the standard deviation of the data, equivalent to the STDEVP function. + * + */ + standardDeviationP = "StandardDeviationP", + /** + * + * Aggregate using the variance of the data, equivalent to the VAR function. + * + */ + variance = "Variance", + /** + * + * Aggregate using the variance of the data, equivalent to the VARP function. + * + */ + varianceP = "VarianceP", + } + /** + * + * The ShowAs Calculation function for the Data Pivot Field. + * + * [Api set: ExcelApi 1.8] + */ + enum ShowAsCalculation { + /** + * + * Calculation is unknown or unsupported. + * + */ + unknown = "Unknown", + /** + * + * No calculation is applied. + * + */ + none = "None", + /** + * + * Percent of the grand total. + * + */ + percentOfGrandTotal = "PercentOfGrandTotal", + /** + * + * Percent of the row total. + * + */ + percentOfRowTotal = "PercentOfRowTotal", + /** + * + * Percent of the column total. + * + */ + percentOfColumnTotal = "PercentOfColumnTotal", + /** + * + * Percent of the row total for the specified Base Field. + * + */ + percentOfParentRowTotal = "PercentOfParentRowTotal", + /** + * + * Percent of the column total for the specified Base Field. + * + */ + percentOfParentColumnTotal = "PercentOfParentColumnTotal", + /** + * + * Percent of the grand total for the specified Base Field. + * + */ + percentOfParentTotal = "PercentOfParentTotal", + /** + * + * Percent of the specified Base Field and Base Item. + * + */ + percentOf = "PercentOf", + /** + * + * Running Total of the specified Base Field. + * + */ + runningTotal = "RunningTotal", + /** + * + * Percent Running Total of the specified Base Field. + * + */ + percentRunningTotal = "PercentRunningTotal", + /** + * + * Difference from the specified Base Field and Base Item. + * + */ + differenceFrom = "DifferenceFrom", + /** + * + * Difference from the specified Base Field and Base Item. + * + */ + percentDifferenceFrom = "PercentDifferenceFrom", + /** + * + * Ascending Rank of the specified Base Field. + * + */ + rankAscending = "RankAscending", + /** + * + * Descending Rank of the specified Base Field. + * + */ + rankDecending = "RankDecending", + /** + * + * Calculates the values as follows: + ((value in cell) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total)) + * + */ + index = "Index", + } /** * * Represents workbook properties. @@ -26815,6 +29560,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ readonly font: Excel.RangeFont; + /** + * + * Indicates if text is automatically indented when the text alignment in a cell is set to equal distribution. + * + * [Api set: ExcelApi 1.8] + */ + autoIndent: boolean; /** * * Indicates if the style is a built-in style. @@ -26927,6 +29679,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ shrinkToFit: boolean; + /** + * + * The text orientation for the style. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation: number; /** * * Represents the vertical alignment for the style. See Excel.VerticalAlignment for details. @@ -27299,6 +30058,13 @@ declare namespace Excel { plus = "Plus", picture = "Picture", } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartPlotAreaPosition { + automatic = "Automatic", + custom = "Custom", + } /** * * Specifies whether the series are by rows or by columns. On Desktop, the "auto" option will inspect the source data shape to automatically guess whether the data is by rows or columns; on Excel Online, "auto" will simply default to "columns". @@ -27341,6 +30107,14 @@ declare namespace Excel { justify = "Justify", distributed = "Distributed", } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartTickLabelAlignment { + center = "Center", + left = "Left", + right = "Right", + } /** * [Api set: ExcelApi 1.1] */ @@ -27420,8 +30194,13 @@ declare namespace Excel { doughnut = "Doughnut", radar = "Radar", histogram = "Histogram", + boxwhisker = "Boxwhisker", pareto = "Pareto", regionMap = "RegionMap", + treemap = "Treemap", + waterfall = "Waterfall", + sunburst = "Sunburst", + funnel = "Funnel", } /** * [Api set: ExcelApi 1.1] @@ -27430,6 +30209,52 @@ declare namespace Excel { none = "None", single = "Single", } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartDisplayBlanksAs { + notPlotted = "NotPlotted", + zero = "Zero", + interplotted = "Interplotted", + } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartPlotBy { + rows = "Rows", + columns = "Columns", + } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartSplitStype { + splitByPosition = "SplitByPosition", + splitByValue = "SplitByValue", + splitByPercentValue = "SplitByPercentValue", + splitByCustomSplit = "SplitByCustomSplit", + } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartColorScheme { + colorfulPalette1 = "ColorfulPalette1", + colorfulPalette2 = "ColorfulPalette2", + colorfulPalette3 = "ColorfulPalette3", + colorfulPalette4 = "ColorfulPalette4", + monochromaticPalette1 = "MonochromaticPalette1", + monochromaticPalette2 = "MonochromaticPalette2", + monochromaticPalette3 = "MonochromaticPalette3", + monochromaticPalette4 = "MonochromaticPalette4", + monochromaticPalette5 = "MonochromaticPalette5", + monochromaticPalette6 = "MonochromaticPalette6", + monochromaticPalette7 = "MonochromaticPalette7", + monochromaticPalette8 = "MonochromaticPalette8", + monochromaticPalette9 = "MonochromaticPalette9", + monochromaticPalette10 = "MonochromaticPalette10", + monochromaticPalette11 = "MonochromaticPalette11", + monochromaticPalette12 = "MonochromaticPalette12", + monochromaticPalette13 = "MonochromaticPalette13", + } /** * [Api set: ExcelApi 1.7] */ @@ -27751,6 +30576,101 @@ declare namespace Excel { single = "Single", double = "Double", } + /** + * + * Represents Data validation type enum. + * + * [Api set: ExcelApi 1.8] + */ + enum DataValidationType { + /** + * + * None means allow any value and so there is no data validation in the range. + * + */ + none = "None", + /** + * + * Whole number data validation type + * + */ + wholeNumber = "WholeNumber", + /** + * + * Decimal data validation type + * + */ + decimal = "Decimal", + /** + * + * List data validation type + * + */ + list = "List", + /** + * + * Date data validation type + * + */ + date = "Date", + /** + * + * Time data validation type + * + */ + time = "Time", + /** + * + * Text length data validation type + * + */ + textLength = "TextLength", + /** + * + * Custom data validation type + * + */ + custom = "Custom", + /** + * + * Inconsistent means that the range has inconsistent data validation (there are different rules on different cells) + * + */ + inconsistent = "Inconsistent", + /** + * + * MixedCriteria means that the range has data validation present on some but not all cells + * + */ + mixedCriteria = "MixedCriteria", + } + /** + * + * Represents Data validation operator enum. + * + * [Api set: ExcelApi 1.8] + */ + enum DataValidationOperator { + between = "Between", + notBetween = "NotBetween", + equalTo = "EqualTo", + notEqualTo = "NotEqualTo", + greaterThan = "GreaterThan", + lessThan = "LessThan", + greaterThanOrEqualTo = "GreaterThanOrEqualTo", + lessThanOrEqualTo = "LessThanOrEqualTo", + } + /** + * + * Represents Data validation error alert style. The default is "Stop". + * + * [Api set: ExcelApi 1.8] + */ + enum DataValidationAlertStyle { + stop = "Stop", + warning = "Warning", + information = "Information", + } /** * [Api set: ExcelApi 1.1] */ @@ -27975,7 +30895,6 @@ declare namespace Excel { justify = "Justify", distributed = "Distributed", } - /** * [Api set: ExcelApi 1.7] */ @@ -28162,6 +31081,18 @@ declare namespace Excel { * */ tableDeleted = "TableDeleted", + /** + * + * TableFiltered represents the type of event registered on table or TableCollection, and occurs when data of table is filtered. + * + */ + tableFiltered = "TableFiltered", + /** + * + * WorksheetFiltered represents the type of event registered on worksheet or WorksheetCollection, and occurs when data of autofilter in the worksheet is filtered. + * + */ + worksheetFiltered = "WorksheetFiltered", /** * * ShapeActivated represents the type of event that is registered on Shape, and occurs when shape activates. @@ -28174,6 +31105,12 @@ declare namespace Excel { * */ shapeDeactivated = "ShapeDeactivated", + /** + * + * VisualChange represents the type of event registered on Visual, and occurs when there is a visual change. + * + */ + visualChange = "VisualChange", } /** * [Api set: ExcelApi 1.7] @@ -28196,6 +31133,52 @@ declare namespace Excel { manager = "Manager", company = "Company", } + /** + * [Api set: ExcelApi 1.8] + */ + enum SubtotalLocationType { + /** + * + * Subtotals are at the top. + * + */ + atTop = "AtTop", + /** + * + * Subtotals are at the bottom. + * + */ + atBottom = "AtBottom", + /** + * + * Subtotals are off. + * + */ + off = "Off", + } + /** + * [Api set: ExcelApi 1.8] + */ + enum PivotLayoutType { + /** + * + * A horizontally compressed form with labels from the next field in the same column. + * + */ + compact = "Compact", + /** + * + * Inner fields' items are always on a new line relative to the outer fields' items. + * + */ + tabular = "Tabular", + /** + * + * Inner fields' items are on same row as outer fields' items and subtotals are always on the bottom. + * + */ + outline = "Outline", + } /** * [Api set: ExcelApi 1.7] */ @@ -32140,6 +35123,16 @@ declare namespace Excel { */ $skip?: number; } + /** An interface for updating data on the Runtime object, for use in "runtime.set({ ... })". */ + interface RuntimeUpdateData { + /** + * + * Turn on/off JavaScript events in current taskpane or content add-in. + * + * [Api set: ExcelApi 1.8] + */ + enableEvents?: boolean; + } /** An interface for updating data on the Application object, for use in "application.set({ ... })". */ interface ApplicationUpdateData { /** @@ -32176,6 +35169,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ position?: number; + /** + * + * Gets or sets the worksheet's gridlines flag. + This flag determines whether gridlines are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showGridlines?: boolean; + /** + * + * Gets or sets the worksheet's headings flag. + This flag determines whether headings are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showHeadings?: boolean; /** * * Returns or sets the standard (default) width of all the columns in the worksheet. @@ -32207,6 +35216,13 @@ declare namespace Excel { } /** An interface for updating data on the Range object, for use in "range.set({ ... })". */ interface RangeUpdateData { + /** + * + * Returns a data validation object. + * + * [Api set: ExcelApi 1.8] + */ + dataValidation?: Excel.Interfaces.DataValidationUpdateData; /** * * Returns a format object, encapsulating the range's font, fill, borders, alignment, and other properties. @@ -32486,6 +35502,37 @@ declare namespace Excel { */ values?: any[][]; } + /** An interface for updating data on the DataValidation object, for use in "dataValidation.set({ ... })". */ + interface DataValidationUpdateData { + /** + * + * Error alert when user enters invalid data. + * + * [Api set: ExcelApi 1.8] + */ + errorAlert?: Excel.DataValidationErrorAlert; + /** + * + * Ignore blanks: no data validation will be performed on blank cells, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + ignoreBlanks?: boolean; + /** + * + * Prompt when users select a cell. + * + * [Api set: ExcelApi 1.8] + */ + prompt?: Excel.DataValidationPrompt; + /** + * + * Data Validation rule that contains different type of data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + rule?: Excel.DataValidationRule; + } /** An interface for updating data on the RangeFormat object, for use in "rangeFormat.set({ ... })". */ interface RangeFormatUpdateData { /** @@ -32710,18 +35757,40 @@ declare namespace Excel { legend?: Excel.Interfaces.ChartLegendUpdateData; /** * + * Represents the plotArea for the chart. + * + * [Api set: ExcelApi 1.8] + */ + plotArea?: Excel.Interfaces.ChartPlotAreaUpdateData; + /** + * * Represents the title of the specified chart, including the text, visibility, position, and formating of the title. * * [Api set: ExcelApi 1.1] */ title?: Excel.Interfaces.ChartTitleUpdateData; + /** + * + * Returns or sets a ChartCategoryLabelLevel enumeration constant referring to + the level of where the category labels are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + categoryLabelLevel?: number; /** * * Represents the type of the chart. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + /** + * + * Returns or sets the way that blank cells are plotted on a chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + displayBlanksAs?: Excel.ChartDisplayBlanksAs | "NotPlotted" | "Zero" | "Interplotted"; /** * * Represents the height, in points, of the chart object. @@ -32743,6 +35812,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: string; + /** + * + * Returns or sets the way columns or rows are used as data series on the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotBy?: Excel.ChartPlotBy | "Rows" | "Columns"; + /** + * + * True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotVisibleOnly?: boolean; + /** + * + * Returns or sets a ChartSeriesNameLevel enumeration constant referring to + the level of where the series names are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + seriesNameLevel?: number; /** * * Represents whether to display all field buttons on a PivotChart. @@ -32750,6 +35841,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showAllFieldButtons?: boolean; + /** + * + * Represents whether to to show the data labels when the value is greater than the maximum value on the value axis. + If value axis became smaller than the size of data points, you can use this property to set whether to show the data labels. + This property applies to 2-D charts only. + * + * [Api set: ExcelApi 1.8] + */ + showDataLabelsOverMaximum?: boolean; + /** + * + * Returns or sets the chart style for the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + style?: number; /** * * Represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). @@ -32788,6 +35895,13 @@ declare namespace Excel { } /** An interface for updating data on the ChartSeries object, for use in "chartSeries.set({ ... })". */ interface ChartSeriesUpdateData { + /** + * + * Represents a collection of all dataLabels in the series. + * + * [Api set: ExcelApi 1.8] + */ + dataLabels?: Excel.Interfaces.ChartDataLabelsUpdateData; /** * * Represents the formatting of a chart series, which includes fill and line formatting. @@ -32795,13 +35909,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ format?: Excel.Interfaces.ChartSeriesFormatUpdateData; + /** + * + * Returns or sets the group for the specified series. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + axisGroup?: Excel.ChartAxisGroup | "Primary" | "Secondary"; /** * * Represents the chart type of a series. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -32810,6 +35931,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ doughnutHoleSize?: number; + /** + * + * Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + explosion?: number; /** * * Boolean value representing if the series is filtered or not. Not applicable for surface charts. @@ -32817,6 +35945,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ filtered?: boolean; + /** + * + * Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + firstSliceAngle?: number; /** * * Represents the gap width of a chart series. Only valid on bar and column charts, as well as @@ -32832,6 +35967,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ hasDataLabels?: boolean; + /** + * + * True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + invertIfNegative?: boolean; /** * * Represents markers background color of a chart series. @@ -32867,6 +36009,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: string; + /** + * + * Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + overlap?: number; /** * * Represents the plot order of a chart series within the chart group. @@ -32874,6 +36023,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ plotOrder?: number; + /** + * + * Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + secondPlotSize?: number; /** * * Boolean value representing if the series has a shadow or not. @@ -32888,6 +36044,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ smooth?: boolean; + /** + * + * Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + splitType?: Excel.ChartSplitStype | "SplitByPosition" | "SplitByValue" | "SplitByPercentValue" | "SplitByCustomSplit"; + /** + * + * True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + varyByCategories?: boolean; } /** An interface for updating data on the ChartSeriesFormat object, for use in "chartSeriesFormat.set({ ... })". */ interface ChartSeriesFormatUpdateData { @@ -33019,6 +36189,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ title?: Excel.Interfaces.ChartAxisTitleUpdateData; + /** + * + * Represents the alignment for the specified axis tick label. See Excel.ChartTextHorizontalAlignment for detail. + * + * [Api set: ExcelApi 1.8] + */ + alignment?: Excel.ChartTickLabelAlignment | "Center" | "Left" | "Right"; /** * * Returns or sets the base unit for the specified category axis. @@ -33047,6 +36224,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ displayUnit?: Excel.ChartAxisDisplayUnit | "None" | "Hundreds" | "Thousands" | "TenThousands" | "HundredThousands" | "Millions" | "TenMillions" | "HundredMillions" | "Billions" | "Trillions" | "Custom"; + /** + * + * Represents whether value axis crosses the category axis between categories. + * + * [Api set: ExcelApi 1.8] + */ + isBetweenCategories?: boolean; /** * * Represents the base of the logarithm when using logarithmic scales. @@ -33110,6 +36294,34 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ minorUnit?: any; + /** + * + * Represents whether an axis is multilevel or not. + * + * [Api set: ExcelApi 1.8] + */ + multiLevel?: boolean; + /** + * + * Represents the format code for the axis tick label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * Represents the distance between the levels of labels, and the distance between the first level and the axis line. The value should be an integer from 0 to 1000. + * + * [Api set: ExcelApi 1.8] + */ + offset?: number; + /** + * + * Represents the specified axis position where the other axis crosses. See Excel.ChartAxisPosition for details. + * + * [Api set: ExcelApi 1.8] + */ + position?: Excel.ChartAxisPosition | "Automatic" | "Maximum" | "Minimum" | "Custom"; /** * * Represents whether Microsoft Excel plots data points from last to first. @@ -33131,6 +36343,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showDisplayUnitLabel?: boolean; + /** + * + * Represents the text orientation of the axis tick label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: any; /** * * Represents the position of tick-mark labels on the specified axis. See Excel.ChartAxisTickLabelPosition for details. @@ -33203,6 +36422,13 @@ declare namespace Excel { } /** An interface for updating data on the ChartAxisTitleFormat object, for use in "chartAxisTitleFormat.set({ ... })". */ interface ChartAxisTitleFormatUpdateData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderUpdateData; /** * * Represents the font attributes, such as font name, font size, color, etc. of chart axis title object. @@ -33220,6 +36446,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ format?: Excel.Interfaces.ChartDataLabelFormatUpdateData; + /** + * + * Represents whether data labels automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the format code for data labels. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -33276,9 +36524,67 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ showValue?: boolean; + /** + * + * Represents the text orientation of data labels. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; } /** An interface for updating data on the ChartDataLabel object, for use in "chartDataLabel.set({ ... })". */ interface ChartDataLabelUpdateData { + /** + * + * Represents the format of chart data label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartDataLabelFormatUpdateData; + /** + * + * Boolean value representing if data label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart data label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: string; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart data label to the left edge of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * String value that represents the format code for data label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -33335,9 +36641,45 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showValue?: boolean; + /** + * + * String representing the text of the data label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: string; + /** + * + * Represents the text orientation of chart data label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the distance, in points, from the top edge of chart data label to the top of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; } /** An interface for updating data on the ChartDataLabelFormat object, for use in "chartDataLabelFormat.set({ ... })". */ interface ChartDataLabelFormatUpdateData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderUpdateData; /** * * Represents the font attributes (font name, font size, color, etc.) for a chart data label. @@ -33455,6 +36797,13 @@ declare namespace Excel { } /** An interface for updating data on the ChartLegendFormat object, for use in "chartLegendFormat.set({ ... })". */ interface ChartLegendFormatUpdateData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderUpdateData; /** * * Represents the font attributes such as font name, font size, color, etc. of a chart legend. @@ -33672,6 +37021,27 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ format?: Excel.Interfaces.ChartTrendlineFormatUpdateData; + /** + * + * Represents the label of a chart trendline. + * + * [Api set: ExcelApi 1.8] + */ + label?: Excel.Interfaces.ChartTrendlineLabelUpdateData; + /** + * + * Represents the number of periods that the trendline extends backward. + * + * [Api set: ExcelApi 1.8] + */ + backwardPeriod?: number; + /** + * + * Represents the number of periods that the trendline extends forward. + * + * [Api set: ExcelApi 1.8] + */ + forwardPeriod?: number; /** * * Represents the intercept value of the trendline. Can be set to a numeric value or an empty string (for automatic values). The returned value is always a number. @@ -33700,6 +37070,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ polynomialOrder?: number; + /** + * + * True if the equation for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showEquation?: boolean; + /** + * + * True if the R-squared for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showRSquared?: boolean; /** * * Represents the type of a chart trendline. @@ -33722,6 +37106,181 @@ declare namespace Excel { */ line?: Excel.Interfaces.ChartLineFormatUpdateData; } + /** An interface for updating data on the ChartTrendlineLabel object, for use in "chartTrendlineLabel.set({ ... })". */ + interface ChartTrendlineLabelUpdateData { + /** + * + * Represents the format of chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartTrendlineLabelFormatUpdateData; + /** + * + * Boolean value representing if trendline label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart trendline label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: string; + /** + * + * Represents the horizontal alignment for chart trendline label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of trendline label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart trendline label to the left edge of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * String value that represents the format code for trendline label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * String representing the text of the trendline label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: string; + /** + * + * Represents the text orientation of chart trendline label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the distance, in points, from the top edge of chart trendline label to the top of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the vertical alignment of chart trendline label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of trendline label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; + } + /** An interface for updating data on the ChartTrendlineLabelFormat object, for use in "chartTrendlineLabelFormat.set({ ... })". */ + interface ChartTrendlineLabelFormatUpdateData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderUpdateData; + /** + * + * Represents the font attributes (font name, font size, color, etc.) for a chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + font?: Excel.Interfaces.ChartFontUpdateData; + } + /** An interface for updating data on the ChartPlotArea object, for use in "chartPlotArea.set({ ... })". */ + interface ChartPlotAreaUpdateData { + /** + * + * Represents the formatting of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartPlotAreaFormatUpdateData; + /** + * + * Represents the height value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + height?: number; + /** + * + * Represents the insideHeight value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideHeight?: number; + /** + * + * Represents the insideLeft value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideLeft?: number; + /** + * + * Represents the insideTop value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideTop?: number; + /** + * + * Represents the insideWidth value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideWidth?: number; + /** + * + * Represents the left value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * Represents the position of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + position?: Excel.ChartPlotAreaPosition | "Automatic" | "Custom"; + /** + * + * Represents the top value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the width value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + width?: number; + } + /** An interface for updating data on the ChartPlotAreaFormat object, for use in "chartPlotAreaFormat.set({ ... })". */ + interface ChartPlotAreaFormatUpdateData { + /** + * + * Represents the border attributes of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderUpdateData; + } /** An interface for updating data on the CustomXmlPartScopedCollection object, for use in "customXmlPartScopedCollection.set({ ... })". */ interface CustomXmlPartScopedCollectionUpdateData { items?: Excel.Interfaces.CustomXmlPartData[]; @@ -33744,6 +37303,205 @@ declare namespace Excel { */ name?: string; } + /** An interface for updating data on the PivotLayout object, for use in "pivotLayout.set({ ... })". */ + interface PivotLayoutUpdateData { + /** + * + * This property indicates the PivotLayoutType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + layoutType?: Excel.PivotLayoutType | "Compact" | "Tabular" | "Outline"; + /** + * + * True if the PivotTable report shows grand totals for columns. + * + * [Api set: ExcelApi 1.8] + */ + showColumnGrandTotals?: boolean; + /** + * + * True if the PivotTable report shows grand totals for rows. + * + * [Api set: ExcelApi 1.8] + */ + showRowGrandTotals?: boolean; + /** + * + * This property indicates the SubtotalLocationType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + subtotalLocation?: Excel.SubtotalLocationType | "AtTop" | "AtBottom" | "Off"; + } + /** An interface for updating data on the PivotHierarchyCollection object, for use in "pivotHierarchyCollection.set({ ... })". */ + interface PivotHierarchyCollectionUpdateData { + items?: Excel.Interfaces.PivotHierarchyData[]; + } + /** An interface for updating data on the PivotHierarchy object, for use in "pivotHierarchy.set({ ... })". */ + interface PivotHierarchyUpdateData { + /** + * + * Name of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + } + /** An interface for updating data on the RowColumnPivotHierarchyCollection object, for use in "rowColumnPivotHierarchyCollection.set({ ... })". */ + interface RowColumnPivotHierarchyCollectionUpdateData { + items?: Excel.Interfaces.RowColumnPivotHierarchyData[]; + } + /** An interface for updating data on the RowColumnPivotHierarchy object, for use in "rowColumnPivotHierarchy.set({ ... })". */ + interface RowColumnPivotHierarchyUpdateData { + /** + * + * Name of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Position of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + } + /** An interface for updating data on the FilterPivotHierarchyCollection object, for use in "filterPivotHierarchyCollection.set({ ... })". */ + interface FilterPivotHierarchyCollectionUpdateData { + items?: Excel.Interfaces.FilterPivotHierarchyData[]; + } + /** An interface for updating data on the FilterPivotHierarchy object, for use in "filterPivotHierarchy.set({ ... })". */ + interface FilterPivotHierarchyUpdateData { + /** + * + * Determines whether to allow multiple filter items. + * + * [Api set: ExcelApi 1.8] + */ + enableMultipleFilterItems?: boolean; + /** + * + * Name of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Position of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + } + /** An interface for updating data on the DataPivotHierarchyCollection object, for use in "dataPivotHierarchyCollection.set({ ... })". */ + interface DataPivotHierarchyCollectionUpdateData { + items?: Excel.Interfaces.DataPivotHierarchyData[]; + } + /** An interface for updating data on the DataPivotHierarchy object, for use in "dataPivotHierarchy.set({ ... })". */ + interface DataPivotHierarchyUpdateData { + /** + * + * Returns the PivotFields associated with the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + field?: Excel.Interfaces.PivotFieldUpdateData; + /** + * + * Name of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Number format of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * Position of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + /** + * + * Determines whether the data should be sown as a specific summary calculation or not. + * + * [Api set: ExcelApi 1.8] + */ + showAs?: Excel.ShowAsRule; + /** + * + * Determines whether to show all items of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + summarizeBy?: Excel.AggregationFunction | "Unknown" | "Automatic" | "Sum" | "Count" | "Average" | "Max" | "Min" | "Product" | "CountNumbers" | "StandardDeviation" | "StandardDeviationP" | "Variance" | "VarianceP"; + } + /** An interface for updating data on the PivotFieldCollection object, for use in "pivotFieldCollection.set({ ... })". */ + interface PivotFieldCollectionUpdateData { + items?: Excel.Interfaces.PivotFieldData[]; + } + /** An interface for updating data on the PivotField object, for use in "pivotField.set({ ... })". */ + interface PivotFieldUpdateData { + /** + * + * Name of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Determines whether to show all items of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + showAllItems?: boolean; + /** + * + * Subtotals of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + subtotals?: Excel.Subtotals; + } + /** An interface for updating data on the PivotItemCollection object, for use in "pivotItemCollection.set({ ... })". */ + interface PivotItemCollectionUpdateData { + items?: Excel.Interfaces.PivotItemData[]; + } + /** An interface for updating data on the PivotItem object, for use in "pivotItem.set({ ... })". */ + interface PivotItemUpdateData { + /** + * + * Determines whether the item is expanded to show child items or if it's collapsed and child items are hidden. + * + * [Api set: ExcelApi 1.8] + */ + isExpanded?: boolean; + /** + * + * Name of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Determines whether the PivotItem is visible or not. + * + * [Api set: ExcelApi 1.8] + */ + visible?: boolean; + } /** An interface for updating data on the DocumentProperties object, for use in "documentProperties.set({ ... })". */ interface DocumentPropertiesUpdateData { /** @@ -34379,6 +38137,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ font?: Excel.Interfaces.RangeFontUpdateData; + /** + * + * Indicates if text is automatically indented when the text alignment in a cell is set to equal distribution. + * + * [Api set: ExcelApi 1.8] + */ + autoIndent?: boolean; /** * * Indicates if the formula will be hidden when the worksheet is protected. @@ -34477,6 +38242,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ shrinkToFit?: boolean; + /** + * + * The text orientation for the style. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; /** * * Represents the vertical alignment for the style. See Excel.VerticalAlignment for details. @@ -34496,6 +38268,16 @@ declare namespace Excel { interface StyleCollectionUpdateData { items?: Excel.Interfaces.StyleData[]; } + /** An interface describing the data returned by calling "runtime.toJSON()". */ + interface RuntimeData { + /** + * + * Turn on/off JavaScript events in current taskpane or content add-in. + * + * [Api set: ExcelApi 1.8] + */ + enableEvents?: boolean; + } /** An interface describing the data returned by calling "application.toJSON()". */ interface ApplicationData { /** @@ -34592,6 +38374,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ name?: string; + /** + * + * True if the workbook is open in Read-only mode. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readOnly?: boolean; } /** An interface describing the data returned by calling "workbookProtection.toJSON()". */ interface WorkbookProtectionData { @@ -34603,6 +38392,16 @@ declare namespace Excel { */ protected?: boolean; } + /** An interface describing the data returned by calling "workbookCreated.toJSON()". */ + interface WorkbookCreatedData { + /** + * + * Returns a value that uniquely identifies the WorkbookCreated object. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + } /** An interface describing the data returned by calling "worksheet.toJSON()". */ interface WorksheetData { /** @@ -34661,6 +38460,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ position?: number; + /** + * + * Gets or sets the worksheet's gridlines flag. + This flag determines whether gridlines are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showGridlines?: boolean; + /** + * + * Gets or sets the worksheet's headings flag. + This flag determines whether headings are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showHeadings?: boolean; /** * * Returns the standard (default) height of all the rows in the worksheet, in points. Read-only. @@ -34725,6 +38540,13 @@ declare namespace Excel { conditionalFormats?: Excel.Interfaces.ConditionalFormatData[]; /** * + * Returns a data validation object. + * + * [Api set: ExcelApi 1.8] + */ + dataValidation?: Excel.Interfaces.DataValidationData; + /** + * * Returns a format object, encapsulating the range's font, fill, borders, alignment, and other properties. Read-only. * * [Api set: ExcelApi 1.1] @@ -35182,6 +39004,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ id?: string; + /** + * + * Returns a numeric id. + * + * [Api set: ExcelApi 1.8] + */ + legacyId?: string; /** * * Name of the table. @@ -35295,6 +39124,53 @@ declare namespace Excel { */ values?: any[][]; } + /** An interface describing the data returned by calling "dataValidation.toJSON()". */ + interface DataValidationData { + /** + * + * Error alert when user enters invalid data. + * + * [Api set: ExcelApi 1.8] + */ + errorAlert?: Excel.DataValidationErrorAlert; + /** + * + * Ignore blanks: no data validation will be performed on blank cells, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + ignoreBlanks?: boolean; + /** + * + * Prompt when users select a cell. + * + * [Api set: ExcelApi 1.8] + */ + prompt?: Excel.DataValidationPrompt; + /** + * + * Data Validation rule that contains different type of data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + rule?: Excel.DataValidationRule; + /** + * + * Type of the data validation, see Excel.DataValidationType for details. + * + * [Api set: ExcelApi 1.8] + */ + type?: Excel.DataValidationType | "None" | "WholeNumber" | "Decimal" | "List" | "Date" | "Time" | "TextLength" | "Custom" | "Inconsistent" | "MixedCriteria"; + /** + * + * Represents if all cell values are valid according to the data validation rules. + Returns true if all cell values are valid, or false if all cell values are invalid. + Returns null if there are both valid and invalid cell values within the range. + * + * [Api set: ExcelApi 1.8] + */ + valid?: boolean; + } /** An interface describing the data returned by calling "rangeFormat.toJSON()". */ interface RangeFormatData { /** @@ -35533,6 +39409,13 @@ declare namespace Excel { legend?: Excel.Interfaces.ChartLegendData; /** * + * Represents the plotArea for the chart. + * + * [Api set: ExcelApi 1.8] + */ + plotArea?: Excel.Interfaces.ChartPlotAreaData; + /** + * * Represents either a single series or collection of series in the chart. Read-only. * * [Api set: ExcelApi 1.1] @@ -35552,13 +39435,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.2] */ worksheet?: Excel.Interfaces.WorksheetData; + /** + * + * Returns or sets a ChartCategoryLabelLevel enumeration constant referring to + the level of where the category labels are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + categoryLabelLevel?: number; /** * * Represents the type of the chart. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + /** + * + * Returns or sets the way that blank cells are plotted on a chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + displayBlanksAs?: Excel.ChartDisplayBlanksAs | "NotPlotted" | "Zero" | "Interplotted"; /** * * Represents the height, in points, of the chart object. @@ -35587,6 +39485,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: string; + /** + * + * Returns or sets the way columns or rows are used as data series on the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotBy?: Excel.ChartPlotBy | "Rows" | "Columns"; + /** + * + * True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotVisibleOnly?: boolean; + /** + * + * Returns or sets a ChartSeriesNameLevel enumeration constant referring to + the level of where the series names are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + seriesNameLevel?: number; /** * * Represents whether to display all field buttons on a PivotChart. @@ -35594,6 +39514,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showAllFieldButtons?: boolean; + /** + * + * Represents whether to to show the data labels when the value is greater than the maximum value on the value axis. + If value axis became smaller than the size of data points, you can use this property to set whether to show the data labels. + This property applies to 2-D charts only. + * + * [Api set: ExcelApi 1.8] + */ + showDataLabelsOverMaximum?: boolean; + /** + * + * Returns or sets the chart style for the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + style?: number; /** * * Represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). @@ -35632,6 +39568,13 @@ declare namespace Excel { } /** An interface describing the data returned by calling "chartSeries.toJSON()". */ interface ChartSeriesData { + /** + * + * Represents a collection of all dataLabels in the series. + * + * [Api set: ExcelApi 1.8] + */ + dataLabels?: Excel.Interfaces.ChartDataLabelsData; /** * * Represents the formatting of a chart series, which includes fill and line formatting. Read-only. @@ -35653,13 +39596,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ trendlines?: Excel.Interfaces.ChartTrendlineData[]; + /** + * + * Returns or sets the group for the specified series. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + axisGroup?: Excel.ChartAxisGroup | "Primary" | "Secondary"; /** * * Represents the chart type of a series. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -35668,6 +39618,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ doughnutHoleSize?: number; + /** + * + * Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + explosion?: number; /** * * Boolean value representing if the series is filtered or not. Not applicable for surface charts. @@ -35675,6 +39632,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ filtered?: boolean; + /** + * + * Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + firstSliceAngle?: number; /** * * Represents the gap width of a chart series. Only valid on bar and column charts, as well as @@ -35690,6 +39654,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ hasDataLabels?: boolean; + /** + * + * True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + invertIfNegative?: boolean; /** * * Represents markers background color of a chart series. @@ -35725,6 +39696,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: string; + /** + * + * Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + overlap?: number; /** * * Represents the plot order of a chart series within the chart group. @@ -35732,6 +39710,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ plotOrder?: number; + /** + * + * Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + secondPlotSize?: number; /** * * Boolean value representing if the series has a shadow or not. @@ -35746,6 +39731,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ smooth?: boolean; + /** + * + * Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + splitType?: Excel.ChartSplitStype | "SplitByPosition" | "SplitByValue" | "SplitByPercentValue" | "SplitByCustomSplit"; + /** + * + * True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + varyByCategories?: boolean; } /** An interface describing the data returned by calling "chartSeriesFormat.toJSON()". */ interface ChartSeriesFormatData { @@ -35884,6 +39883,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ title?: Excel.Interfaces.ChartAxisTitleData; + /** + * + * Represents the alignment for the specified axis tick label. See Excel.ChartTextHorizontalAlignment for detail. + * + * [Api set: ExcelApi 1.8] + */ + alignment?: Excel.ChartTickLabelAlignment | "Center" | "Left" | "Right"; /** * * Represents the group for the specified axis. See Excel.ChartAxisGroup for details. Read-only. @@ -35940,6 +39946,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ height?: number; + /** + * + * Represents whether value axis crosses the category axis between categories. + * + * [Api set: ExcelApi 1.8] + */ + isBetweenCategories?: boolean; /** * * Represents the distance, in points, from the left edge of the axis to the left of chart area. Null if the axis is not visible. Read-only. @@ -36010,6 +40023,41 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ minorUnit?: any; + /** + * + * Represents whether an axis is multilevel or not. + * + * [Api set: ExcelApi 1.8] + */ + multiLevel?: boolean; + /** + * + * Represents the format code for the axis tick label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * Represents the distance between the levels of labels, and the distance between the first level and the axis line. The value should be an integer from 0 to 1000. + * + * [Api set: ExcelApi 1.8] + */ + offset?: number; + /** + * + * Represents the specified axis position where the other axis crosses. See Excel.ChartAxisPosition for details. + * + * [Api set: ExcelApi 1.8] + */ + position?: Excel.ChartAxisPosition | "Automatic" | "Maximum" | "Minimum" | "Custom"; + /** + * + * Represents the specified axis position where the other axis crosses at. Read Only. Set to this property should use SetPositionAt(double) method. + * + * [Api set: ExcelApi 1.8] + */ + positionAt?: number; /** * * Represents whether Microsoft Excel plots data points from last to first. @@ -36031,6 +40079,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showDisplayUnitLabel?: boolean; + /** + * + * Represents the text orientation of the axis tick label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: any; /** * * Represents the position of tick-mark labels on the specified axis. See Excel.ChartAxisTickLabelPosition for details. @@ -36124,6 +40179,13 @@ declare namespace Excel { } /** An interface describing the data returned by calling "chartAxisTitleFormat.toJSON()". */ interface ChartAxisTitleFormatData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderData; /** * * Represents the font attributes, such as font name, font size, color, etc. of chart axis title object. Read-only. @@ -36141,6 +40203,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ format?: Excel.Interfaces.ChartDataLabelFormatData; + /** + * + * Represents whether data labels automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the format code for data labels. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -36197,9 +40281,74 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ showValue?: boolean; + /** + * + * Represents the text orientation of data labels. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; } /** An interface describing the data returned by calling "chartDataLabel.toJSON()". */ interface ChartDataLabelData { + /** + * + * Represents the format of chart data label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartDataLabelFormatData; + /** + * + * Boolean value representing if data label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart data label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: string; + /** + * + * Returns the height, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + height?: number; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart data label to the left edge of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * String value that represents the format code for data label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -36256,9 +40405,52 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showValue?: boolean; + /** + * + * String representing the text of the data label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: string; + /** + * + * Represents the text orientation of chart data label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the distance, in points, from the top edge of chart data label to the top of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; + /** + * + * Returns the width, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + width?: number; } /** An interface describing the data returned by calling "chartDataLabelFormat.toJSON()". */ interface ChartDataLabelFormatData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderData; /** * * Represents the font attributes (font name, font size, color, etc.) for a chart data label. Read-only. @@ -36369,6 +40561,34 @@ declare namespace Excel { } /** An interface describing the data returned by calling "chartLegendEntry.toJSON()". */ interface ChartLegendEntryData { + /** + * + * Represents the height of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + height?: number; + /** + * + * Represents the index of the LegendEntry in the Chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + index?: number; + /** + * + * Represents the left of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * Represents the top of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; /** * * Represents the visible of a chart legend entry. @@ -36376,6 +40596,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ visible?: boolean; + /** + * + * Represents the width of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + width?: number; } /** An interface describing the data returned by calling "chartLegendEntryCollection.toJSON()". */ interface ChartLegendEntryCollectionData { @@ -36383,6 +40610,13 @@ declare namespace Excel { } /** An interface describing the data returned by calling "chartLegendFormat.toJSON()". */ interface ChartLegendFormatData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderData; /** * * Represents the font attributes such as font name, font size, color, etc. of a chart legend. Read-only. @@ -36614,6 +40848,27 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ format?: Excel.Interfaces.ChartTrendlineFormatData; + /** + * + * Represents the label of a chart trendline. + * + * [Api set: ExcelApi 1.8] + */ + label?: Excel.Interfaces.ChartTrendlineLabelData; + /** + * + * Represents the number of periods that the trendline extends backward. + * + * [Api set: ExcelApi 1.8] + */ + backwardPeriod?: number; + /** + * + * Represents the number of periods that the trendline extends forward. + * + * [Api set: ExcelApi 1.8] + */ + forwardPeriod?: number; /** * * Represents the intercept value of the trendline. Can be set to a numeric value or an empty string (for automatic values). The returned value is always a number. @@ -36642,6 +40897,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ polynomialOrder?: number; + /** + * + * True if the equation for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showEquation?: boolean; + /** + * + * True if the R-squared for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showRSquared?: boolean; /** * * Represents the type of a chart trendline. @@ -36664,6 +40933,195 @@ declare namespace Excel { */ line?: Excel.Interfaces.ChartLineFormatData; } + /** An interface describing the data returned by calling "chartTrendlineLabel.toJSON()". */ + interface ChartTrendlineLabelData { + /** + * + * Represents the format of chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartTrendlineLabelFormatData; + /** + * + * Boolean value representing if trendline label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart trendline label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: string; + /** + * + * Returns the height, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + height?: number; + /** + * + * Represents the horizontal alignment for chart trendline label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of trendline label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart trendline label to the left edge of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * String value that represents the format code for trendline label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * String representing the text of the trendline label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: string; + /** + * + * Represents the text orientation of chart trendline label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the distance, in points, from the top edge of chart trendline label to the top of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the vertical alignment of chart trendline label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of trendline label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; + /** + * + * Returns the width, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + width?: number; + } + /** An interface describing the data returned by calling "chartTrendlineLabelFormat.toJSON()". */ + interface ChartTrendlineLabelFormatData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderData; + /** + * + * Represents the font attributes (font name, font size, color, etc.) for a chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + font?: Excel.Interfaces.ChartFontData; + } + /** An interface describing the data returned by calling "chartPlotArea.toJSON()". */ + interface ChartPlotAreaData { + /** + * + * Represents the formatting of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartPlotAreaFormatData; + /** + * + * Represents the height value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + height?: number; + /** + * + * Represents the insideHeight value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideHeight?: number; + /** + * + * Represents the insideLeft value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideLeft?: number; + /** + * + * Represents the insideTop value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideTop?: number; + /** + * + * Represents the insideWidth value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideWidth?: number; + /** + * + * Represents the left value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * Represents the position of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + position?: Excel.ChartPlotAreaPosition | "Automatic" | "Custom"; + /** + * + * Represents the top value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the width value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + width?: number; + } + /** An interface describing the data returned by calling "chartPlotAreaFormat.toJSON()". */ + interface ChartPlotAreaFormatData { + /** + * + * Represents the border attributes of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderData; + } /** An interface describing the data returned by calling "tableSort.toJSON()". */ interface TableSortData { /** @@ -36729,6 +41187,48 @@ declare namespace Excel { } /** An interface describing the data returned by calling "pivotTable.toJSON()". */ interface PivotTableData { + /** + * + * The Column Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + columnHierarchies?: Excel.Interfaces.RowColumnPivotHierarchyData[]; + /** + * + * The Data Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + dataHierarchies?: Excel.Interfaces.DataPivotHierarchyData[]; + /** + * + * The Filter Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + filterHierarchies?: Excel.Interfaces.FilterPivotHierarchyData[]; + /** + * + * The Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + hierarchies?: Excel.Interfaces.PivotHierarchyData[]; + /** + * + * The PivotLayout describing the layout and visual structure of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + layout?: Excel.Interfaces.PivotLayoutData; + /** + * + * The Row Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + rowHierarchies?: Excel.Interfaces.RowColumnPivotHierarchyData[]; /** * * The worksheet containing the current PivotTable. @@ -36751,6 +41251,275 @@ declare namespace Excel { */ name?: string; } + /** An interface describing the data returned by calling "pivotLayout.toJSON()". */ + interface PivotLayoutData { + /** + * + * This property indicates the PivotLayoutType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + layoutType?: Excel.PivotLayoutType | "Compact" | "Tabular" | "Outline"; + /** + * + * True if the PivotTable report shows grand totals for columns. + * + * [Api set: ExcelApi 1.8] + */ + showColumnGrandTotals?: boolean; + /** + * + * True if the PivotTable report shows grand totals for rows. + * + * [Api set: ExcelApi 1.8] + */ + showRowGrandTotals?: boolean; + /** + * + * This property indicates the SubtotalLocationType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + subtotalLocation?: Excel.SubtotalLocationType | "AtTop" | "AtBottom" | "Off"; + } + /** An interface describing the data returned by calling "pivotHierarchyCollection.toJSON()". */ + interface PivotHierarchyCollectionData { + items?: Excel.Interfaces.PivotHierarchyData[]; + } + /** An interface describing the data returned by calling "pivotHierarchy.toJSON()". */ + interface PivotHierarchyData { + /** + * + * Returns the PivotFields associated with the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + fields?: Excel.Interfaces.PivotFieldData[]; + /** + * + * Id of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Name of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + } + /** An interface describing the data returned by calling "rowColumnPivotHierarchyCollection.toJSON()". */ + interface RowColumnPivotHierarchyCollectionData { + items?: Excel.Interfaces.RowColumnPivotHierarchyData[]; + } + /** An interface describing the data returned by calling "rowColumnPivotHierarchy.toJSON()". */ + interface RowColumnPivotHierarchyData { + /** + * + * Returns the PivotFields associated with the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + fields?: Excel.Interfaces.PivotFieldData[]; + /** + * + * Id of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Name of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Position of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + } + /** An interface describing the data returned by calling "filterPivotHierarchyCollection.toJSON()". */ + interface FilterPivotHierarchyCollectionData { + items?: Excel.Interfaces.FilterPivotHierarchyData[]; + } + /** An interface describing the data returned by calling "filterPivotHierarchy.toJSON()". */ + interface FilterPivotHierarchyData { + /** + * + * Returns the PivotFields associated with the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + fields?: Excel.Interfaces.PivotFieldData[]; + /** + * + * Determines whether to allow multiple filter items. + * + * [Api set: ExcelApi 1.8] + */ + enableMultipleFilterItems?: boolean; + /** + * + * Id of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Name of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Position of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + } + /** An interface describing the data returned by calling "dataPivotHierarchyCollection.toJSON()". */ + interface DataPivotHierarchyCollectionData { + items?: Excel.Interfaces.DataPivotHierarchyData[]; + } + /** An interface describing the data returned by calling "dataPivotHierarchy.toJSON()". */ + interface DataPivotHierarchyData { + /** + * + * Returns the PivotFields associated with the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + field?: Excel.Interfaces.PivotFieldData; + /** + * + * Id of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Name of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Number format of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * Position of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + /** + * + * Determines whether the data should be sown as a specific summary calculation or not. + * + * [Api set: ExcelApi 1.8] + */ + showAs?: Excel.ShowAsRule; + /** + * + * Determines whether to show all items of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + summarizeBy?: Excel.AggregationFunction | "Unknown" | "Automatic" | "Sum" | "Count" | "Average" | "Max" | "Min" | "Product" | "CountNumbers" | "StandardDeviation" | "StandardDeviationP" | "Variance" | "VarianceP"; + } + /** An interface describing the data returned by calling "pivotFieldCollection.toJSON()". */ + interface PivotFieldCollectionData { + items?: Excel.Interfaces.PivotFieldData[]; + } + /** An interface describing the data returned by calling "pivotField.toJSON()". */ + interface PivotFieldData { + /** + * + * Returns the PivotFields associated with the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + items?: Excel.Interfaces.PivotItemData[]; + /** + * + * Id of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Name of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Determines whether to show all items of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + showAllItems?: boolean; + /** + * + * Subtotals of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + subtotals?: Excel.Subtotals; + } + /** An interface describing the data returned by calling "pivotItemCollection.toJSON()". */ + interface PivotItemCollectionData { + items?: Excel.Interfaces.PivotItemData[]; + } + /** An interface describing the data returned by calling "pivotItem.toJSON()". */ + interface PivotItemData { + /** + * + * Id of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Determines whether the item is expanded to show child items or if it's collapsed and child items are hidden. + * + * [Api set: ExcelApi 1.8] + */ + isExpanded?: boolean; + /** + * + * Name of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Determines whether the PivotItem is visible or not. + * + * [Api set: ExcelApi 1.8] + */ + visible?: boolean; + } /** An interface describing the data returned by calling "documentProperties.toJSON()". */ interface DocumentPropertiesData { /** @@ -37428,6 +42197,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ font?: Excel.Interfaces.RangeFontData; + /** + * + * Indicates if text is automatically indented when the text alignment in a cell is set to equal distribution. + * + * [Api set: ExcelApi 1.8] + */ + autoIndent?: boolean; /** * * Indicates if the style is a built-in style. @@ -37540,6 +42316,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ shrinkToFit?: boolean; + /** + * + * The text orientation for the style. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; /** * * Represents the vertical alignment for the style. See Excel.VerticalAlignment for details. @@ -37576,6 +42359,22 @@ declare namespace Excel { */ value?: T; } + /** + * + * Represents the Excel Runtime class. + * + * [Api set: ExcelApi 1.5] + */ + interface RuntimeLoadOptions { + $all?: boolean; + /** + * + * Turn on/off JavaScript events in current taskpane or content add-in. + * + * [Api set: ExcelApi 1.8] + */ + enableEvents?: boolean; + } /** * * Represents the Excel application that manages the workbook. @@ -37642,6 +42441,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ name?: boolean; + /** + * + * True if the workbook is open in Read-only mode. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readOnly?: boolean; } /** * @@ -37709,6 +42515,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ position?: boolean; + /** + * + * Gets or sets the worksheet's gridlines flag. + This flag determines whether gridlines are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showGridlines?: boolean; + /** + * + * Gets or sets the worksheet's headings flag. + This flag determines whether headings are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showHeadings?: boolean; /** * * Returns the standard (default) height of all the rows in the worksheet, in points. Read-only. @@ -37791,6 +42613,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ position?: boolean; + /** + * + * For EACH ITEM in the collection: Gets or sets the worksheet's gridlines flag. + This flag determines whether gridlines are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showGridlines?: boolean; + /** + * + * For EACH ITEM in the collection: Gets or sets the worksheet's headings flag. + This flag determines whether headings are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showHeadings?: boolean; /** * * For EACH ITEM in the collection: Returns the standard (default) height of all the rows in the worksheet, in points. Read-only. @@ -37856,6 +42694,13 @@ declare namespace Excel { $all?: boolean; /** * + * Returns a data validation object. + * + * [Api set: ExcelApi 1.8] + */ + dataValidation?: Excel.Interfaces.DataValidationLoadOptions; + /** + * * Returns a format object, encapsulating the range's font, fill, borders, alignment, and other properties. * * [Api set: ExcelApi 1.1] @@ -38533,6 +43378,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ id?: boolean; + /** + * + * For EACH ITEM in the collection: Returns a numeric id. + * + * [Api set: ExcelApi 1.8] + */ + legacyId?: boolean; /** * * For EACH ITEM in the collection: Name of the table. @@ -38640,6 +43492,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ id?: boolean; + /** + * + * Returns a numeric id. + * + * [Api set: ExcelApi 1.8] + */ + legacyId?: boolean; /** * * Name of the table. @@ -38834,6 +43693,59 @@ declare namespace Excel { */ values?: boolean; } + /** + * + * Represents the data validation applied to the current range. + * + * [Api set: ExcelApi 1.8] + */ + interface DataValidationLoadOptions { + $all?: boolean; + /** + * + * Error alert when user enters invalid data. + * + * [Api set: ExcelApi 1.8] + */ + errorAlert?: boolean; + /** + * + * Ignore blanks: no data validation will be performed on blank cells, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + ignoreBlanks?: boolean; + /** + * + * Prompt when users select a cell. + * + * [Api set: ExcelApi 1.8] + */ + prompt?: boolean; + /** + * + * Data Validation rule that contains different type of data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + rule?: boolean; + /** + * + * Type of the data validation, see Excel.DataValidationType for details. + * + * [Api set: ExcelApi 1.8] + */ + type?: boolean; + /** + * + * Represents if all cell values are valid according to the data validation rules. + Returns true if all cell values are valid, or false if all cell values are invalid. + Returns null if there are both valid and invalid cell values within the range. + * + * [Api set: ExcelApi 1.8] + */ + valid?: boolean; + } /** * * A format object encapsulating the range's font, fill, borders, alignment, and other properties. @@ -39137,6 +44049,13 @@ declare namespace Excel { legend?: Excel.Interfaces.ChartLegendLoadOptions; /** * + * For EACH ITEM in the collection: Represents the plotArea for the chart. + * + * [Api set: ExcelApi 1.8] + */ + plotArea?: Excel.Interfaces.ChartPlotAreaLoadOptions; + /** + * * For EACH ITEM in the collection: Represents either a single series or collection of series in the chart. * * [Api set: ExcelApi 1.1] @@ -39156,6 +44075,14 @@ declare namespace Excel { * [Api set: ExcelApi 1.2] */ worksheet?: Excel.Interfaces.WorksheetLoadOptions; + /** + * + * For EACH ITEM in the collection: Returns or sets a ChartCategoryLabelLevel enumeration constant referring to + the level of where the category labels are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + categoryLabelLevel?: boolean; /** * * For EACH ITEM in the collection: Represents the type of the chart. See Excel.ChartType for details. @@ -39163,6 +44090,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ chartType?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the way that blank cells are plotted on a chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + displayBlanksAs?: boolean; /** * * For EACH ITEM in the collection: Represents the height, in points, of the chart object. @@ -39191,6 +44125,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the way columns or rows are used as data series on the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotBy?: boolean; + /** + * + * For EACH ITEM in the collection: True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotVisibleOnly?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets a ChartSeriesNameLevel enumeration constant referring to + the level of where the series names are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + seriesNameLevel?: boolean; /** * * For EACH ITEM in the collection: Represents whether to display all field buttons on a PivotChart. @@ -39198,6 +44154,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showAllFieldButtons?: boolean; + /** + * + * For EACH ITEM in the collection: Represents whether to to show the data labels when the value is greater than the maximum value on the value axis. + If value axis became smaller than the size of data points, you can use this property to set whether to show the data labels. + This property applies to 2-D charts only. + * + * [Api set: ExcelApi 1.8] + */ + showDataLabelsOverMaximum?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the chart style for the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + style?: boolean; /** * * For EACH ITEM in the collection: Represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). @@ -39251,6 +44223,13 @@ declare namespace Excel { legend?: Excel.Interfaces.ChartLegendLoadOptions; /** * + * Represents the plotArea for the chart. + * + * [Api set: ExcelApi 1.8] + */ + plotArea?: Excel.Interfaces.ChartPlotAreaLoadOptions; + /** + * * Represents either a single series or collection of series in the chart. * * [Api set: ExcelApi 1.1] @@ -39270,6 +44249,14 @@ declare namespace Excel { * [Api set: ExcelApi 1.2] */ worksheet?: Excel.Interfaces.WorksheetLoadOptions; + /** + * + * Returns or sets a ChartCategoryLabelLevel enumeration constant referring to + the level of where the category labels are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + categoryLabelLevel?: boolean; /** * * Represents the type of the chart. See Excel.ChartType for details. @@ -39277,6 +44264,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ chartType?: boolean; + /** + * + * Returns or sets the way that blank cells are plotted on a chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + displayBlanksAs?: boolean; /** * * Represents the height, in points, of the chart object. @@ -39305,6 +44299,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: boolean; + /** + * + * Returns or sets the way columns or rows are used as data series on the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotBy?: boolean; + /** + * + * True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotVisibleOnly?: boolean; + /** + * + * Returns or sets a ChartSeriesNameLevel enumeration constant referring to + the level of where the series names are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + seriesNameLevel?: boolean; /** * * Represents whether to display all field buttons on a PivotChart. @@ -39312,6 +44328,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showAllFieldButtons?: boolean; + /** + * + * Represents whether to to show the data labels when the value is greater than the maximum value on the value axis. + If value axis became smaller than the size of data points, you can use this property to set whether to show the data labels. + This property applies to 2-D charts only. + * + * [Api set: ExcelApi 1.8] + */ + showDataLabelsOverMaximum?: boolean; + /** + * + * Returns or sets the chart style for the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + style?: boolean; /** * * Represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). @@ -39360,6 +44392,13 @@ declare namespace Excel { $all?: boolean; /** * + * For EACH ITEM in the collection: Represents a collection of all dataLabels in the series. + * + * [Api set: ExcelApi 1.8] + */ + dataLabels?: Excel.Interfaces.ChartDataLabelsLoadOptions; + /** + * * For EACH ITEM in the collection: Represents the formatting of a chart series, which includes fill and line formatting. * * [Api set: ExcelApi 1.1] @@ -39372,6 +44411,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ points?: Excel.Interfaces.ChartPointsCollectionLoadOptions; + /** + * + * For EACH ITEM in the collection: Returns or sets the group for the specified series. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + axisGroup?: boolean; /** * * For EACH ITEM in the collection: Represents the chart type of a series. See Excel.ChartType for details. @@ -39387,6 +44433,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ doughnutHoleSize?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + explosion?: boolean; /** * * For EACH ITEM in the collection: Boolean value representing if the series is filtered or not. Not applicable for surface charts. @@ -39394,6 +44447,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ filtered?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + firstSliceAngle?: boolean; /** * * For EACH ITEM in the collection: Represents the gap width of a chart series. Only valid on bar and column charts, as well as @@ -39409,6 +44469,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ hasDataLabels?: boolean; + /** + * + * For EACH ITEM in the collection: True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + invertIfNegative?: boolean; /** * * For EACH ITEM in the collection: Represents markers background color of a chart series. @@ -39444,6 +44511,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: boolean; + /** + * + * For EACH ITEM in the collection: Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + overlap?: boolean; /** * * For EACH ITEM in the collection: Represents the plot order of a chart series within the chart group. @@ -39451,6 +44525,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ plotOrder?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + secondPlotSize?: boolean; /** * * For EACH ITEM in the collection: Boolean value representing if the series has a shadow or not. @@ -39465,6 +44546,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ smooth?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + splitType?: boolean; + /** + * + * For EACH ITEM in the collection: True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + varyByCategories?: boolean; } /** * @@ -39476,6 +44571,13 @@ declare namespace Excel { $all?: boolean; /** * + * Represents a collection of all dataLabels in the series. + * + * [Api set: ExcelApi 1.8] + */ + dataLabels?: Excel.Interfaces.ChartDataLabelsLoadOptions; + /** + * * Represents the formatting of a chart series, which includes fill and line formatting. * * [Api set: ExcelApi 1.1] @@ -39488,6 +44590,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ points?: Excel.Interfaces.ChartPointsCollectionLoadOptions; + /** + * + * Returns or sets the group for the specified series. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + axisGroup?: boolean; /** * * Represents the chart type of a series. See Excel.ChartType for details. @@ -39503,6 +44612,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ doughnutHoleSize?: boolean; + /** + * + * Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + explosion?: boolean; /** * * Boolean value representing if the series is filtered or not. Not applicable for surface charts. @@ -39510,6 +44626,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ filtered?: boolean; + /** + * + * Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + firstSliceAngle?: boolean; /** * * Represents the gap width of a chart series. Only valid on bar and column charts, as well as @@ -39525,6 +44648,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ hasDataLabels?: boolean; + /** + * + * True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + invertIfNegative?: boolean; /** * * Represents markers background color of a chart series. @@ -39560,6 +44690,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: boolean; + /** + * + * Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + overlap?: boolean; /** * * Represents the plot order of a chart series within the chart group. @@ -39567,6 +44704,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ plotOrder?: boolean; + /** + * + * Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + secondPlotSize?: boolean; /** * * Boolean value representing if the series has a shadow or not. @@ -39581,6 +44725,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ smooth?: boolean; + /** + * + * Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + splitType?: boolean; + /** + * + * True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + varyByCategories?: boolean; } /** * @@ -39810,6 +44968,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ title?: Excel.Interfaces.ChartAxisTitleLoadOptions; + /** + * + * Represents the alignment for the specified axis tick label. See Excel.ChartTextHorizontalAlignment for detail. + * + * [Api set: ExcelApi 1.8] + */ + alignment?: boolean; /** * * Represents the group for the specified axis. See Excel.ChartAxisGroup for details. Read-only. @@ -39866,6 +45031,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ height?: boolean; + /** + * + * Represents whether value axis crosses the category axis between categories. + * + * [Api set: ExcelApi 1.8] + */ + isBetweenCategories?: boolean; /** * * Represents the distance, in points, from the left edge of the axis to the left of chart area. Null if the axis is not visible. Read-only. @@ -39936,6 +45108,41 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ minorUnit?: boolean; + /** + * + * Represents whether an axis is multilevel or not. + * + * [Api set: ExcelApi 1.8] + */ + multiLevel?: boolean; + /** + * + * Represents the format code for the axis tick label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; + /** + * + * Represents the distance between the levels of labels, and the distance between the first level and the axis line. The value should be an integer from 0 to 1000. + * + * [Api set: ExcelApi 1.8] + */ + offset?: boolean; + /** + * + * Represents the specified axis position where the other axis crosses. See Excel.ChartAxisPosition for details. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + /** + * + * Represents the specified axis position where the other axis crosses at. Read Only. Set to this property should use SetPositionAt(double) method. + * + * [Api set: ExcelApi 1.8] + */ + positionAt?: boolean; /** * * Represents whether Microsoft Excel plots data points from last to first. @@ -39957,6 +45164,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showDisplayUnitLabel?: boolean; + /** + * + * Represents the text orientation of the axis tick label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; /** * * Represents the position of tick-mark labels on the specified axis. See Excel.ChartAxisTickLabelPosition for details. @@ -40070,6 +45284,13 @@ declare namespace Excel { $all?: boolean; /** * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderLoadOptions; + /** + * * Represents the font attributes, such as font name, font size, color, etc. of chart axis title object. * * [Api set: ExcelApi 1.1] @@ -40091,6 +45312,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ format?: Excel.Interfaces.ChartDataLabelFormatLoadOptions; + /** + * + * Represents whether data labels automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: boolean; + /** + * + * Represents the format code for data labels. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -40147,6 +45390,21 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ showValue?: boolean; + /** + * + * Represents the text orientation of data labels. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: boolean; } /** * @@ -40156,6 +45414,56 @@ declare namespace Excel { */ interface ChartDataLabelLoadOptions { $all?: boolean; + /** + * + * Represents the format of chart data label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartDataLabelFormatLoadOptions; + /** + * + * Boolean value representing if data label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart data label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: boolean; + /** + * + * Returns the height, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + height?: boolean; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: boolean; + /** + * + * Represents the distance, in points, from the left edge of chart data label to the left edge of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: boolean; + /** + * + * String value that represents the format code for data label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -40212,6 +45520,42 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showValue?: boolean; + /** + * + * String representing the text of the data label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: boolean; + /** + * + * Represents the text orientation of chart data label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; + /** + * + * Represents the distance, in points, from the top edge of chart data label to the top of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: boolean; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: boolean; + /** + * + * Returns the width, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + width?: boolean; } /** * @@ -40223,6 +45567,13 @@ declare namespace Excel { $all?: boolean; /** * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderLoadOptions; + /** + * * Represents the font attributes (font name, font size, color, etc.) for a chart data label. * * [Api set: ExcelApi 1.1] @@ -40348,6 +45699,34 @@ declare namespace Excel { */ interface ChartLegendEntryLoadOptions { $all?: boolean; + /** + * + * Represents the height of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + height?: boolean; + /** + * + * Represents the index of the LegendEntry in the Chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + index?: boolean; + /** + * + * Represents the left of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + left?: boolean; + /** + * + * Represents the top of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + top?: boolean; /** * * Represents the visible of a chart legend entry. @@ -40355,6 +45734,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ visible?: boolean; + /** + * + * Represents the width of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + width?: boolean; } /** * @@ -40364,6 +45750,34 @@ declare namespace Excel { */ interface ChartLegendEntryCollectionLoadOptions { $all?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the height of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + height?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the index of the LegendEntry in the Chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + index?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the left of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + left?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the top of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + top?: boolean; /** * * For EACH ITEM in the collection: Represents the visible of a chart legend entry. @@ -40371,6 +45785,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ visible?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the width of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + width?: boolean; } /** * @@ -40382,6 +45803,13 @@ declare namespace Excel { $all?: boolean; /** * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderLoadOptions; + /** + * * Represents the font attributes such as font name, font size, color, etc. of a chart legend. * * [Api set: ExcelApi 1.1] @@ -40653,6 +46081,27 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ format?: Excel.Interfaces.ChartTrendlineFormatLoadOptions; + /** + * + * Represents the label of a chart trendline. + * + * [Api set: ExcelApi 1.8] + */ + label?: Excel.Interfaces.ChartTrendlineLabelLoadOptions; + /** + * + * Represents the number of periods that the trendline extends backward. + * + * [Api set: ExcelApi 1.8] + */ + backwardPeriod?: boolean; + /** + * + * Represents the number of periods that the trendline extends forward. + * + * [Api set: ExcelApi 1.8] + */ + forwardPeriod?: boolean; /** * * Represents the intercept value of the trendline. Can be set to a numeric value or an empty string (for automatic values). The returned value is always a number. @@ -40681,6 +46130,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ polynomialOrder?: boolean; + /** + * + * True if the equation for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showEquation?: boolean; + /** + * + * True if the R-squared for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showRSquared?: boolean; /** * * Represents the type of a chart trendline. @@ -40704,6 +46167,27 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ format?: Excel.Interfaces.ChartTrendlineFormatLoadOptions; + /** + * + * For EACH ITEM in the collection: Represents the label of a chart trendline. + * + * [Api set: ExcelApi 1.8] + */ + label?: Excel.Interfaces.ChartTrendlineLabelLoadOptions; + /** + * + * For EACH ITEM in the collection: Represents the number of periods that the trendline extends backward. + * + * [Api set: ExcelApi 1.8] + */ + backwardPeriod?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the number of periods that the trendline extends forward. + * + * [Api set: ExcelApi 1.8] + */ + forwardPeriod?: boolean; /** * * For EACH ITEM in the collection: Represents the intercept value of the trendline. Can be set to a numeric value or an empty string (for automatic values). The returned value is always a number. @@ -40732,6 +46216,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ polynomialOrder?: boolean; + /** + * + * For EACH ITEM in the collection: True if the equation for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showEquation?: boolean; + /** + * + * For EACH ITEM in the collection: True if the R-squared for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showRSquared?: boolean; /** * * For EACH ITEM in the collection: Represents the type of a chart trendline. @@ -40756,6 +46254,219 @@ declare namespace Excel { */ line?: Excel.Interfaces.ChartLineFormatLoadOptions; } + /** + * + * This object represents the attributes for a chart trendline lable object. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartTrendlineLabelLoadOptions { + $all?: boolean; + /** + * + * Represents the format of chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartTrendlineLabelFormatLoadOptions; + /** + * + * Boolean value representing if trendline label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart trendline label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: boolean; + /** + * + * Returns the height, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + height?: boolean; + /** + * + * Represents the horizontal alignment for chart trendline label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of trendline label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: boolean; + /** + * + * Represents the distance, in points, from the left edge of chart trendline label to the left edge of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: boolean; + /** + * + * String value that represents the format code for trendline label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; + /** + * + * String representing the text of the trendline label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: boolean; + /** + * + * Represents the text orientation of chart trendline label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; + /** + * + * Represents the distance, in points, from the top edge of chart trendline label to the top of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: boolean; + /** + * + * Represents the vertical alignment of chart trendline label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of trendline label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: boolean; + /** + * + * Returns the width, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + width?: boolean; + } + /** + * + * Encapsulates the format properties for the chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartTrendlineLabelFormatLoadOptions { + $all?: boolean; + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderLoadOptions; + /** + * + * Represents the font attributes (font name, font size, color, etc.) for a chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + font?: Excel.Interfaces.ChartFontLoadOptions; + } + /** + * + * This object represents the attributes for a chart plotArea object. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartPlotAreaLoadOptions { + $all?: boolean; + /** + * + * Represents the formatting of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartPlotAreaFormatLoadOptions; + /** + * + * Represents the height value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + height?: boolean; + /** + * + * Represents the insideHeight value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideHeight?: boolean; + /** + * + * Represents the insideLeft value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideLeft?: boolean; + /** + * + * Represents the insideTop value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideTop?: boolean; + /** + * + * Represents the insideWidth value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideWidth?: boolean; + /** + * + * Represents the left value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + left?: boolean; + /** + * + * Represents the position of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + /** + * + * Represents the top value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + top?: boolean; + /** + * + * Represents the width value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + width?: boolean; + } + /** + * + * Represents the format properties for chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartPlotAreaFormatLoadOptions { + $all?: boolean; + /** + * + * Represents the border attributes of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderLoadOptions; + } /** * * Manages sorting operations on Table objects. @@ -40883,6 +46594,13 @@ declare namespace Excel { $all?: boolean; /** * + * For EACH ITEM in the collection: The PivotLayout describing the layout and visual structure of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + layout?: Excel.Interfaces.PivotLayoutLoadOptions; + /** + * * For EACH ITEM in the collection: The worksheet containing the current PivotTable. * * [Api set: ExcelApi 1.3] @@ -40913,6 +46631,13 @@ declare namespace Excel { $all?: boolean; /** * + * The PivotLayout describing the layout and visual structure of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + layout?: Excel.Interfaces.PivotLayoutLoadOptions; + /** + * * The worksheet containing the current PivotTable. * * [Api set: ExcelApi 1.3] @@ -40933,6 +46658,487 @@ declare namespace Excel { */ name?: boolean; } + /** + * + * Represents the visual layout of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotLayoutLoadOptions { + $all?: boolean; + /** + * + * This property indicates the PivotLayoutType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + layoutType?: boolean; + /** + * + * True if the PivotTable report shows grand totals for columns. + * + * [Api set: ExcelApi 1.8] + */ + showColumnGrandTotals?: boolean; + /** + * + * True if the PivotTable report shows grand totals for rows. + * + * [Api set: ExcelApi 1.8] + */ + showRowGrandTotals?: boolean; + /** + * + * This property indicates the SubtotalLocationType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + subtotalLocation?: boolean; + } + /** + * + * Represents a collection of all the PivotTables that are part of the workbook or worksheet. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotHierarchyCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Id of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + } + /** + * + * Represents the Excel PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotHierarchyLoadOptions { + $all?: boolean; + /** + * + * Id of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Name of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + } + /** + * + * Represents a collection of RowColumnPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + interface RowColumnPivotHierarchyCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Id of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Position of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + } + /** + * + * Represents the Excel RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + interface RowColumnPivotHierarchyLoadOptions { + $all?: boolean; + /** + * + * Id of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Name of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * Position of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + } + /** + * + * Represents a collection of FilterPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + interface FilterPivotHierarchyCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether to allow multiple filter items. + * + * [Api set: ExcelApi 1.8] + */ + enableMultipleFilterItems?: boolean; + /** + * + * For EACH ITEM in the collection: Id of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Position of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + } + /** + * + * Represents the Excel FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + interface FilterPivotHierarchyLoadOptions { + $all?: boolean; + /** + * + * Determines whether to allow multiple filter items. + * + * [Api set: ExcelApi 1.8] + */ + enableMultipleFilterItems?: boolean; + /** + * + * Id of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Name of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * Position of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + } + /** + * + * Represents a collection of DataPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + interface DataPivotHierarchyCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Returns the PivotFields associated with the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + field?: Excel.Interfaces.PivotFieldLoadOptions; + /** + * + * For EACH ITEM in the collection: Id of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Number format of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; + /** + * + * For EACH ITEM in the collection: Position of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether the data should be sown as a specific summary calculation or not. + * + * [Api set: ExcelApi 1.8] + */ + showAs?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether to show all items of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + summarizeBy?: boolean; + } + /** + * + * Represents the Excel DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + interface DataPivotHierarchyLoadOptions { + $all?: boolean; + /** + * + * Returns the PivotFields associated with the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + field?: Excel.Interfaces.PivotFieldLoadOptions; + /** + * + * Id of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Name of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * Number format of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; + /** + * + * Position of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + /** + * + * Determines whether the data should be sown as a specific summary calculation or not. + * + * [Api set: ExcelApi 1.8] + */ + showAs?: boolean; + /** + * + * Determines whether to show all items of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + summarizeBy?: boolean; + } + /** + * + * Represents a collection of all the PivotTables that are part of the workbook or worksheet. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotFieldCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Id of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether to show all items of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + showAllItems?: boolean; + /** + * + * For EACH ITEM in the collection: Subtotals of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + subtotals?: boolean; + } + /** + * + * Represents the Excel PivotField. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotFieldLoadOptions { + $all?: boolean; + /** + * + * Id of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Name of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * Determines whether to show all items of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + showAllItems?: boolean; + /** + * + * Subtotals of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + subtotals?: boolean; + } + /** + * + * Represents a collection of all the Pivot Items related to their parent PivotField. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotItemCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Id of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether the item is expanded to show child items or if it's collapsed and child items are hidden. + * + * [Api set: ExcelApi 1.8] + */ + isExpanded?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether the PivotItem is visible or not. + * + * [Api set: ExcelApi 1.8] + */ + visible?: boolean; + } + /** + * + * Represents the Excel PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotItemLoadOptions { + $all?: boolean; + /** + * + * Id of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Determines whether the item is expanded to show child items or if it's collapsed and child items are hidden. + * + * [Api set: ExcelApi 1.8] + */ + isExpanded?: boolean; + /** + * + * Name of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * Determines whether the PivotItem is visible or not. + * + * [Api set: ExcelApi 1.8] + */ + visible?: boolean; + } /** * * Represents workbook properties. @@ -41925,6 +48131,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ font?: Excel.Interfaces.RangeFontLoadOptions; + /** + * + * Indicates if text is automatically indented when the text alignment in a cell is set to equal distribution. + * + * [Api set: ExcelApi 1.8] + */ + autoIndent?: boolean; /** * * Indicates if the style is a built-in style. @@ -42037,6 +48250,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ shrinkToFit?: boolean; + /** + * + * The text orientation for the style. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; /** * * Represents the vertical alignment for the style. See Excel.VerticalAlignment for details. @@ -42081,6 +48301,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ font?: Excel.Interfaces.RangeFontLoadOptions; + /** + * + * For EACH ITEM in the collection: Indicates if text is automatically indented when the text alignment in a cell is set to equal distribution. + * + * [Api set: ExcelApi 1.8] + */ + autoIndent?: boolean; /** * * For EACH ITEM in the collection: Indicates if the style is a built-in style. @@ -42193,6 +48420,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ shrinkToFit?: boolean; + /** + * + * For EACH ITEM in the collection: The text orientation for the style. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; /** * * For EACH ITEM in the collection: Represents the vertical alignment for the style. See Excel.VerticalAlignment for details. @@ -53276,13 +59510,6 @@ declare namespace Word { * Executes a batch script that performs actions on the Word object model, using the RequestContext of previously-created API objects. * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared RequestContext, which means that any changes applied to these objects will be picked up by "context.sync()". * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Word application. Since the Office add-in and the Word application run in two different processes, the RequestContext is required to get access to the Word object model from the add-in. - * - * @remarks - * In addition to this signature, the method also has the following signatures: - * - * `run(batch: (context: Word.RequestContext) => Promise): Promise;` - * - * `run(objects: OfficeExtension.ClientObject[], batch: (context: Word.RequestContext) => Promise): Promise;` */ function run(objects: OfficeExtension.ClientObject[], batch: (context: Word.RequestContext) => Promise): Promise; } @@ -59499,16 +65726,16 @@ declare namespace OneNote { * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the OneNote application. Since the Office add-in and the OneNote application run in two different processes, the request context is required to get access to the OneNote object model from the add-in. */ function run(batch: (context: OneNote.RequestContext) => Promise): Promise; - /** - * Executes a batch script that performs actions on the OneNote object model, using the request context of a previously-created API object. - * @param object - A previously-created API object. The batch will use the same request context as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". - * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - */ - function run(object: OfficeExtension.ClientObject, batch: (context: OneNote.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the OneNote object model, using the request context of previously-created API objects. * @param object - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared request context, which means that any changes applied to these objects will be picked up by "context.sync()". * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + */ + function run(objects: OfficeExtension.ClientObject[], batch: (context: OneNote.RequestContext) => Promise): Promise; + /** + * Executes a batch script that performs actions on the OneNote object model, using the request context of a previously-created API object. + * @param object - A previously-created API object. The batch will use the same request context as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". + * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. * * @remarks * In addition to this signature, the method also has the following signatures: @@ -59517,7 +65744,7 @@ declare namespace OneNote { * * `run(objects: OfficeExtension.ClientObject[], batch: (context: OneNote.RequestContext) => Promise): Promise;` */ - function run(objects: OfficeExtension.ClientObject[], batch: (context: OneNote.RequestContext) => Promise): Promise; + function run(object: OfficeExtension.ClientObject, batch: (context: OneNote.RequestContext) => Promise): Promise; } @@ -62062,16 +68289,16 @@ declare namespace Visio { * @param batch - A function that takes in an Visio.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. */ function run(object: OfficeExtension.ClientObject | OfficeExtension.EmbeddedSession, batch: (context: Visio.RequestContext) => Promise): Promise; - /** - * Executes a batch script that performs actions on the Visio object model, using the RequestContext of a previously-created object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @param contextObject - A previously-created Visio.RequestContext. This context will get re-used by the batch function (instead of having a new context created). This means that the batch will be able to pick up changes made to existing API objects, if those objects were derived from this same context. - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Visio application. Since the Office add-in and the Visio application run in two different processes, the RequestContext is required to get access to the Visio object model from the add-in. - */ - function run(contextObject: OfficeExtension.ClientRequestContext, batch: (context: Visio.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the Visio object model, using the request context of previously-created API objects. * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared request context, which means that any changes applied to these objects will be picked up by "context.sync()". * @param batch - A function that takes in a Visio.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + */ + function run(objects: OfficeExtension.ClientObject[], batch: (context: Visio.RequestContext) => Promise): Promise; + /** + * Executes a batch script that performs actions on the Visio object model, using the RequestContext of a previously-created object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + * @param contextObject - A previously-created Visio.RequestContext. This context will get re-used by the batch function (instead of having a new context created). This means that the batch will be able to pick up changes made to existing API objects, if those objects were derived from this same context. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Visio application. Since the Office add-in and the Visio application run in two different processes, the RequestContext is required to get access to the Visio object model from the add-in. * * @remarks * In addition to this signature, the method also has the following signatures: @@ -62082,7 +68309,7 @@ declare namespace Visio { * * `run(objects: OfficeExtension.ClientObject[], batch: (context: Visio.RequestContext) => Promise): Promise;` */ - function run(objects: OfficeExtension.ClientObject[], batch: (context: Visio.RequestContext) => Promise): Promise; + function run(contextObject: OfficeExtension.ClientRequestContext, batch: (context: Visio.RequestContext) => Promise): Promise; } @@ -62106,4 +68333,4 @@ declare namespace Visio { //////////////////////////////////////////////////////////////// ////////////////////// End PowerPoint APIs ///////////////////// -//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/types/pixi.js/index.d.ts b/types/pixi.js/index.d.ts index 5e1ca464e2..17913f4903 100644 --- a/types/pixi.js/index.d.ts +++ b/types/pixi.js/index.d.ts @@ -290,8 +290,7 @@ declare namespace PIXI { protected onChildrenChange: (...args: any[]) => void; addChild( - child: T, - ...additionalChildren: DisplayObject[] + ...children: T[] ): T; addChildAt(child: T, index: number): T; swapChildren(child: DisplayObject, child2: DisplayObject): void; diff --git a/types/react-reconciler/ReactElementType.d.ts b/types/react-reconciler/ReactElementType.d.ts deleted file mode 100644 index f30d70586e..0000000000 --- a/types/react-reconciler/ReactElementType.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface Source { - fileName: string; - lineNumber: number; -} diff --git a/types/react-reconciler/ReactFiber.d.ts b/types/react-reconciler/ReactFiber.d.ts deleted file mode 100644 index 6ea29c798b..0000000000 --- a/types/react-reconciler/ReactFiber.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { Source } from './ReactElementType'; -import { ExpirationTime } from './ReactFiberExpirationTime'; -import { ContextDependency } from './ReactFiberNewContext'; -import { SideEffectTag } from './ReactSideEffectTags'; -import { TypeOfMode } from './ReactTypeOfMode'; -import { RefObject } from './ReactTypes'; -import { UpdateQueue } from './ReactUpdateQueue'; -import { WorkTag } from './ReactWorkTags'; - -// A Fiber is work on a Component that needs to be done or was done. There can -// be more than one per component. -export interface Fiber { - // These first fields are conceptually members of an Instance. This used to - // be split into a separate type and intersected with the other Fiber fields, - // but until Flow fixes its intersection bugs, we've merged them into a - // single type. - - // An Instance is shared between all versions of a component. We can easily - // break this out into a separate object to avoid copying so much to the - // alternate versions of the tree. We put this on a single object for now to - // minimize the number of objects created during the initial render. - - // Tag identifying the type of fiber. - tag: WorkTag; - - // Unique identifier of this child. - key: null | string; - - // The function/class/module associated with this fiber. - type: any; - - // The local state associated with this fiber. - stateNode: any; - - // Conceptual aliases - // parent : Instance -> return The parent happens to be the same as the - // return fiber since we've merged the fiber and instance. - - // Remaining fields belong to Fiber - - // The Fiber to return to after finishing processing this one. - // This is effectively the parent, but there can be multiple parents (two) - // so this is only the parent of the thing we're currently processing. - // It is conceptually the same as the return address of a stack frame. - return: Fiber | null; - - // Singly Linked List Tree Structure. - child: Fiber | null; - sibling: Fiber | null; - index: number; - - // The ref last used to attach this node. - // I'll avoid adding an owner field for prod and model that as functions. - ref: null | (((handle: any) => void) & { _stringRef: string | null | undefined }) | RefObject; - - // Input is the data coming into process this fiber. Arguments. Props. - pendingProps: any; // This type will be more specific once we overload the tag. - memoizedProps: any; // The props used to create the output. - - // A queue of state updates and callbacks. - updateQueue: UpdateQueue | null; - - // The state used to create the output - memoizedState: any; - - // A linked-list of contexts that this fiber depends on - firstContextDependency: ContextDependency | null; - - // Bitfield that describes properties about the fiber and its subtree. E.g. - // the AsyncMode flag indicates whether the subtree should be async-by- - // default. When a fiber is created, it inherits the mode of its - // parent. Additional flags can be set at creation time, but after that the - // value should remain unchanged throughout the fiber's lifetime, particularly - // before its child fibers are created. - mode: TypeOfMode; - - // Effect - effectTag: SideEffectTag; - - // Singly linked list fast path to the next fiber with side-effects. - nextEffect: Fiber | null; - - // The first and last fiber with side-effect within this subtree. This allows - // us to reuse a slice of the linked list when we reuse the work done within - // this fiber. - firstEffect: Fiber | null; - lastEffect: Fiber | null; - - // Represents a time in the future by which this work should be completed. - // Does not include work found in its subtree. - expirationTime: ExpirationTime; - - // This is used to quickly determine if a subtree has no pending changes. - childExpirationTime: ExpirationTime; - - // This is a pooled version of a Fiber. Every fiber that gets updated will - // eventually have a pair. There are cases when we can clean up pairs to save - // memory if we need to. - alternate: Fiber | null; - - // Time spent rendering this Fiber and its descendants for the current update. - // This tells us how well the tree makes use of sCU for memoization. - // It is reset to 0 each time we render and only updated when we don't bailout. - // This field is only set when the enableProfilerTimer flag is enabled. - actualDuration?: number; - - // If the Fiber is currently active in the "render" phase, - // This marks the time at which the work began. - // This field is only set when the enableProfilerTimer flag is enabled. - actualStartTime?: number; - - // Duration of the most recent render time for this Fiber. - // This value is not updated when we bailout for memoization purposes. - // This field is only set when the enableProfilerTimer flag is enabled. - selfBaseDuration?: number; - - // Sum of base times for all descedents of this Fiber. - // This value bubbles up during the "complete" phase. - // This field is only set when the enableProfilerTimer flag is enabled. - treeBaseDuration?: number; - - // Conceptual aliases - // workInProgress : Fiber -> alternate The alternate used for reuse happens - // to be the same as work in progress. - // __DEV__ only - _debugID?: number; - _debugSource?: Source | null; - _debugOwner?: Fiber | null; - _debugIsCurrentlyTiming?: boolean; -} diff --git a/types/react-reconciler/ReactFiberExpirationTime.d.ts b/types/react-reconciler/ReactFiberExpirationTime.d.ts deleted file mode 100644 index 8fb86f26ef..0000000000 --- a/types/react-reconciler/ReactFiberExpirationTime.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type ExpirationTime = number; diff --git a/types/react-reconciler/ReactFiberNewContext.d.ts b/types/react-reconciler/ReactFiberNewContext.d.ts deleted file mode 100644 index a212df9839..0000000000 --- a/types/react-reconciler/ReactFiberNewContext.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ReactContext } from './ReactTypes'; - -export interface ContextDependency { - context: ReactContext; - observedBits: number; - next: ContextDependency | null; -} diff --git a/types/react-reconciler/ReactFiberReconciler.d.ts b/types/react-reconciler/ReactFiberReconciler.d.ts deleted file mode 100644 index aa8ed61fe5..0000000000 --- a/types/react-reconciler/ReactFiberReconciler.d.ts +++ /dev/null @@ -1,255 +0,0 @@ -import { Component } from 'react'; -import { Fiber } from './ReactFiber'; -import { ExpirationTime } from './ReactFiberExpirationTime'; -import { FiberRoot } from './ReactFiberRoot'; -import { Deadline } from './ReactFiberScheduler'; -import { ReactNodeList } from './ReactTypes'; - -export type OpaqueHandle = Fiber; -export type OpaqueRoot = FiberRoot; - -export interface HostConfig { - getPublicInstance(instance: Instance | TextInstance): PublicInstance; - getRootHostContext(rootContainerInstance: Container): HostContext; - getChildHostContext(parentHostContext: HostContext, type: Type, rootContainerInstance: Container): HostContext; - - prepareForCommit(containerInfo: Container): void; - resetAfterCommit(containerInfo: Container): void; - - createInstance( - type: Type, - props: Props, - rootContainerInstance: Container, - hostContext: HostContext, - internalInstanceHandle: OpaqueHandle, - ): Instance; - appendInitialChild(parentInstance: Instance, child: Instance | TextInstance): void; - finalizeInitialChildren( - parentInstance: Instance, - type: Type, - props: Props, - rootContainerInstance: Container, - hostContext: HostContext, - ): boolean; - - prepareUpdate( - instance: Instance, - type: Type, - oldProps: Props, - newProps: Props, - rootContainerInstance: Container, - hostContext: HostContext, - ): null | UpdatePayload; - - shouldSetTextContent(type: Type, props: Props): boolean; - shouldDeprioritizeSubtree(type: Type, props: Props): boolean; - - createTextInstance( - text: string, - rootContainerInstance: Container, - hostContext: HostContext, - internalInstanceHandle: OpaqueHandle, - ): TextInstance; - - scheduleDeferredCallback( - callback: (deadline: Deadline) => void, - options?: { timeout: number }, - ): any; - cancelDeferredCallback(callbackID: any): void; - - setTimeout(handler: (...args: any[]) => void, timeout: number): TimeoutHandle | NoTimeout; - clearTimeout(handle: TimeoutHandle | NoTimeout): void; - noTimeout: NoTimeout; - - now(): number; - - // Temporary workaround for scenario where multiple renderers concurrently - // render using the same context objects. E.g. React DOM and React ART on the - // same page. DOM is the primary renderer; ART is the secondary renderer. - isPrimaryRenderer: boolean; - - supportsMutation: boolean; - supportsPersistence: boolean; - supportsHydration: boolean; - - // ------------------- - // Mutation - // (optional) - // ------------------- - appendChild?(parentInstance: Instance, child: Instance | TextInstance): void; - appendChildToContainer?(container: Container, child: Instance | TextInstance): void; - commitTextUpdate?(textInstance: TextInstance, oldText: string, newText: string): void; - commitMount?( - instance: Instance, - type: Type, - newProps: Props, - internalInstanceHandle: OpaqueHandle, - ): void; - commitUpdate?( - instance: Instance, - updatePayload: UpdatePayload, - type: Type, - oldProps: Props, - newProps: Props, - internalInstanceHandle: OpaqueHandle, - ): void; - insertBefore?(parentInstance: Instance, child: Instance | TextInstance, beforeChild: Instance | TextInstance): void; - insertInContainerBefore?( - container: Container, - child: Instance | TextInstance, - beforeChild: Instance | TextInstance, - ): void; - removeChild?(parentInstance: Instance, child: Instance | TextInstance): void; - removeChildFromContainer?(container: Container, child: Instance | TextInstance): void; - resetTextContent?(instance: Instance): void; - - // ------------------- - // Persistence - // (optional) - // ------------------- - cloneInstance?( - instance: Instance, - updatePayload: null | UpdatePayload, - type: Type, - oldProps: Props, - newProps: Props, - internalInstanceHandle: OpaqueHandle, - keepChildren: boolean, - recyclableInstance: Instance, - ): Instance; - - createContainerChildSet?(container: Container): ChildSet; - - appendChildToContainerChildSet?(childSet: ChildSet, child: Instance | TextInstance): void; - finalizeContainerChildren?(container: Container, newChildren: ChildSet): void; - - replaceContainerChildren?(container: Container, newChildren: ChildSet): void; - - // ------------------- - // Hydration - // (optional) - // ------------------- - canHydrateInstance?(instance: HydratableInstance, type: Type, props: Props): null | Instance; - canHydrateTextInstance?(instance: HydratableInstance, text: string): null | TextInstance; - getNextHydratableSibling?(instance: Instance | TextInstance | HydratableInstance): null | HydratableInstance; - getFirstHydratableChild?(parentInstance: Instance | Container): null | HydratableInstance; - hydrateInstance?( - instance: Instance, - type: Type, - props: Props, - rootContainerInstance: Container, - hostContext: HostContext, - internalInstanceHandle: OpaqueHandle, - ): null | UpdatePayload; - hydrateTextInstance?( - textInstance: TextInstance, - text: string, - internalInstanceHandle: OpaqueHandle, - ): boolean; - didNotMatchHydratedContainerTextInstance?( - parentContainer: Container, - textInstance: TextInstance, - text: string, - ): void; - didNotMatchHydratedTextInstance?( - parentType: Type, - parentProps: Props, - parentInstance: Instance, - textInstance: TextInstance, - text: string, - ): void; - didNotHydrateContainerInstance?(parentContainer: Container, instance: Instance | TextInstance): void; - didNotHydrateInstance?( - parentType: Type, - parentProps: Props, - parentInstance: Instance, - instance: Instance | TextInstance, - ): void; - didNotFindHydratableContainerInstance?( - parentContainer: Container, - type: Type, - props: Props, - ): void; - didNotFindHydratableContainerTextInstance?( - parentContainer: Container, - text: string, - ): void; - didNotFindHydratableInstance?( - parentType: Type, - parentProps: Props, - parentInstance: Instance, - type: Type, - props: Props, - ): void; - didNotFindHydratableTextInstance?( - parentType: Type, - parentProps: Props, - parentInstance: Instance, - text: string, - ): void; -} - -// 0 is PROD, 1 is DEV. -// Might add PROFILE later. -export type BundleType = 0 | 1; - -export interface DevToolsConfig { - bundleType: BundleType; - version: string; - rendererPackageName: string; - // Note: this actually *does* depend on Fiber internal fields. - // Used by "inspect clicked DOM element" in React DevTools. - findFiberByHostInstance?: (instance: Instance | TextInstance) => Fiber; - // Used by RN in-app inspector. - // This API is unfortunately RN-specific. - // TODO: Change it to accept Fiber instead and type it properly. - getInspectorDataForViewTag?: (tag: number) => object; -} - -export interface Reconciler { - updateContainerAtExpirationTime( - element: ReactNodeList, - container: OpaqueRoot, - parentComponent: Component | null | undefined, - expirationTime: ExpirationTime, - callback: () => void | null | undefined, - ): ExpirationTime; - createContainer( - containerInfo: Container, - isAsync: boolean, - hydrate: boolean, - ): OpaqueRoot; - updateContainer( - element: ReactNodeList, - container: OpaqueRoot, - parentComponent: Component | null | undefined, - callback: () => void | null | undefined, - ): ExpirationTime; - flushRoot(root: OpaqueRoot, expirationTime: ExpirationTime): void; - requestWork(root: OpaqueRoot, expirationTime: ExpirationTime): void; - computeUniqueAsyncExpiration(): ExpirationTime; - batchedUpdates(fn: () => A): A; - unbatchedUpdates(fn: () => A): A; - deferredUpdates(fn: () => A): A; - syncUpdates(fn: () => A): A; - interactiveUpdates(fn: () => A): A; - flushInteractiveUpdates(): void; - flushControlled(fn: () => any): void; - flushSync(fn: () => A): A; - - // Used to extract the return value from the initial render. Legacy API. - getPublicRootInstance( - container: OpaqueRoot, - ): Component | PublicInstance | null; - - // Use for findDOMNode/findHostNode. Legacy API. - findHostInstance(component: object): PublicInstance | null; - - // Used internally for filtering out portals. Legacy API. - findHostInstanceWithNoPortals(component: Fiber): PublicInstance | null; - injectIntoDevTools(devToolsConfig: DevToolsConfig): boolean; -} - -export default function ( - config: HostConfig, -): Reconciler; diff --git a/types/react-reconciler/ReactFiberRoot.d.ts b/types/react-reconciler/ReactFiberRoot.d.ts deleted file mode 100644 index 0117eb9d51..0000000000 --- a/types/react-reconciler/ReactFiberRoot.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Fiber } from './ReactFiber'; -import { ExpirationTime } from './ReactFiberExpirationTime'; -import { Interaction } from './Tracking'; - -// TODO: This should be lifted into the renderer. -export interface Batch { - _defer: boolean; - _expirationTime: ExpirationTime; - _onComplete: () => any; - _next: Batch | null; -} - -export type PendingInteractionMap = Map>; - -export interface BaseFiberRootProperties { - // Any additional information from the host associated with this root. - containerInfo: any; - // Used only by persistent updates. - pendingChildren: any; - // The currently active root fiber. This is the mutable root of the tree. - current: Fiber; - - // The following priority levels are used to distinguish between 1) - // uncommitted work, 2) uncommitted work that is suspended, and 3) uncommitted - // work that may be unsuspended. We choose not to track each individual - // pending level, trading granularity for performance. - // - // The earliest and latest priority levels that are suspended from committing. - earliestSuspendedTime: ExpirationTime; - latestSuspendedTime: ExpirationTime; - // The earliest and latest priority levels that are not known to be suspended. - earliestPendingTime: ExpirationTime; - latestPendingTime: ExpirationTime; - // The latest priority level that was pinged by a resolved promise and can - // be retried. - latestPingedTime: ExpirationTime; - - // If an error is thrown, and there are no more updates in the queue, we try - // rendering from the root one more time, synchronously, before handling - // the error. - didError: boolean; - - pendingCommitExpirationTime: ExpirationTime; - // A finished work-in-progress HostRoot that's ready to be committed. - finishedWork: Fiber | null; - // Timeout handle returned by setTimeout. Used to cancel a pending timeout, if - // it's superseded by a new one. - timeoutHandle: any; - // Top context object, used by renderSubtreeIntoContainer - context: object | null; - pendingContext: object | null; - // Determines if we should attempt to hydrate on the initial mount - readonly hydrate: boolean; - // Remaining expiration time on this root. - // TODO: Lift this into the renderer - nextExpirationTimeToWorkOn: ExpirationTime; - expirationTime: ExpirationTime; - // List of top-level batches. This list indicates whether a commit should be - // deferred. Also contains completion callbacks. - // TODO: Lift this into the renderer - firstBatch: Batch | null; - // Linked-list of roots - nextScheduledRoot: FiberRoot | null; -} - -// The following attributes are only used by interaction tracking builds. -// They enable interactions to be associated with their async work, -// And expose interaction metadata to the React DevTools Profiler plugin. -// Note that these attributes are only defined when the enableSchedulerTracking flag is enabled. -export interface ProfilingOnlyFiberRootProperties { - interactionThreadID: number; - memoizedInteractions: Set; - pendingInteractionMap: PendingInteractionMap; -} - -export type FiberRoot = BaseFiberRootProperties & ProfilingOnlyFiberRootProperties; diff --git a/types/react-reconciler/ReactFiberScheduler.d.ts b/types/react-reconciler/ReactFiberScheduler.d.ts deleted file mode 100644 index cfbadb016d..0000000000 --- a/types/react-reconciler/ReactFiberScheduler.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface Deadline { - timeRemaining: () => number; - didTimeout: boolean; -} diff --git a/types/react-reconciler/ReactSideEffectTags.d.ts b/types/react-reconciler/ReactSideEffectTags.d.ts deleted file mode 100644 index e2eec15313..0000000000 --- a/types/react-reconciler/ReactSideEffectTags.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type SideEffectTag = number; diff --git a/types/react-reconciler/ReactTypeOfMode.d.ts b/types/react-reconciler/ReactTypeOfMode.d.ts deleted file mode 100644 index 3e5c56b922..0000000000 --- a/types/react-reconciler/ReactTypeOfMode.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type TypeOfMode = number; diff --git a/types/react-reconciler/ReactTypes.d.ts b/types/react-reconciler/ReactTypes.d.ts deleted file mode 100644 index d962385049..0000000000 --- a/types/react-reconciler/ReactTypes.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ReactNode } from 'react'; - -export type ReactEmpty = null | undefined | boolean; - -export type ReactNodeList = ReactEmpty | ReactNode; - -export interface ReactProviderType { - $$typeof: symbol | number; - _context: ReactContext; -} - -export interface ReactContext { - $$typeof: symbol | number; - Consumer: ReactContext; - Provider: ReactProviderType; - unstable_read: () => T; - - _calculateChangedBits: ((a: T, b: T) => number) | null; - - _currentValue: T; - _currentValue2: T; - - // DEV only - _currentRenderer?: object | null; - _currentRenderer2?: object | null; -} - -export interface RefObject { - current: any; -} diff --git a/types/react-reconciler/ReactUpdateQueue.d.ts b/types/react-reconciler/ReactUpdateQueue.d.ts deleted file mode 100644 index 497ce9f0f6..0000000000 --- a/types/react-reconciler/ReactUpdateQueue.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { ExpirationTime } from './ReactFiberExpirationTime'; - -export interface Update { - expirationTime: ExpirationTime; - - tag: 0 | 1 | 2 | 3; - payload: any; - callback: (() => any) | null; - - next: Update | null; - nextEffect: Update | null; -} - -export interface UpdateQueue { - baseState: State; - - firstUpdate: Update | null; - lastUpdate: Update | null; - - firstCapturedUpdate: Update | null; - lastCapturedUpdate: Update | null; - - firstEffect: Update | null; - lastEffect: Update | null; - - firstCapturedEffect: Update | null; - lastCapturedEffect: Update | null; -} diff --git a/types/react-reconciler/ReactWorkTags.d.ts b/types/react-reconciler/ReactWorkTags.d.ts deleted file mode 100644 index fe7d38193c..0000000000 --- a/types/react-reconciler/ReactWorkTags.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type WorkTag = - | 0 - | 1 - | 2 - | 3 - | 4 - | 5 - | 6 - | 7 - | 8 - | 9 - | 10 - | 11 - | 12 - | 13 - | 14 - | 15 - | 16; diff --git a/types/react-reconciler/Tracking.d.ts b/types/react-reconciler/Tracking.d.ts deleted file mode 100644 index 145815131c..0000000000 --- a/types/react-reconciler/Tracking.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface Interaction { - __count: number; - id: number; - name: string; - timestamp: number; -} diff --git a/types/react-reconciler/index.d.ts b/types/react-reconciler/index.d.ts index 97be10b84f..3aa6a6189e 100644 --- a/types/react-reconciler/index.d.ts +++ b/types/react-reconciler/index.d.ts @@ -4,17 +4,583 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -export { default } from './ReactFiberReconciler'; +import { Component, ReactNode } from 'react'; -export * from './ReactElementType'; -export * from './ReactFiber'; -export * from './ReactFiberNewContext'; -export * from './ReactFiberReconciler'; -export * from './ReactFiberRoot'; -export * from './ReactFiberScheduler'; -export * from './ReactSideEffectTags'; -export * from './ReactTypeOfMode'; -export * from './ReactTypes'; -export * from './ReactUpdateQueue'; -export * from './ReactWorkTags'; -export * from './Tracking'; +declare function ReactReconciler( + // tslint:disable-next-line:no-unnecessary-generics + config: ReactReconciler.HostConfig, +): ReactReconciler.Reconciler; + +declare namespace ReactReconciler { + // react-ronciler/ReactFiber + + // A Fiber is work on a Component that needs to be done or was done. There can + // be more than one per component. + interface Fiber { + // These first fields are conceptually members of an Instance. This used to + // be split into a separate type and intersected with the other Fiber fields, + // but until Flow fixes its intersection bugs, we've merged them into a + // single type. + + // An Instance is shared between all versions of a component. We can easily + // break this out into a separate object to avoid copying so much to the + // alternate versions of the tree. We put this on a single object for now to + // minimize the number of objects created during the initial render. + + // Tag identifying the type of fiber. + tag: WorkTag; + + // Unique identifier of this child. + key: null | string; + + // The function/class/module associated with this fiber. + type: any; + + // The local state associated with this fiber. + stateNode: any; + + // Conceptual aliases + // parent : Instance -> return The parent happens to be the same as the + // return fiber since we've merged the fiber and instance. + + // Remaining fields belong to Fiber + + // The Fiber to return to after finishing processing this one. + // This is effectively the parent, but there can be multiple parents (two) + // so this is only the parent of the thing we're currently processing. + // It is conceptually the same as the return address of a stack frame. + return: Fiber | null; + + // Singly Linked List Tree Structure. + child: Fiber | null; + sibling: Fiber | null; + index: number; + + // The ref last used to attach this node. + // I'll avoid adding an owner field for prod and model that as functions. + ref: null | (((handle: any) => void) & { _stringRef: string | null | undefined }) | RefObject; + + // Input is the data coming into process this fiber. Arguments. Props. + pendingProps: any; // This type will be more specific once we overload the tag. + memoizedProps: any; // The props used to create the output. + + // A queue of state updates and callbacks. + updateQueue: UpdateQueue | null; + + // The state used to create the output + memoizedState: any; + + // A linked-list of contexts that this fiber depends on + firstContextDependency: ContextDependency | null; + + // Bitfield that describes properties about the fiber and its subtree. E.g. + // the AsyncMode flag indicates whether the subtree should be async-by- + // default. When a fiber is created, it inherits the mode of its + // parent. Additional flags can be set at creation time, but after that the + // value should remain unchanged throughout the fiber's lifetime, particularly + // before its child fibers are created. + mode: TypeOfMode; + + // Effect + effectTag: SideEffectTag; + + // Singly linked list fast path to the next fiber with side-effects. + nextEffect: Fiber | null; + + // The first and last fiber with side-effect within this subtree. This allows + // us to reuse a slice of the linked list when we reuse the work done within + // this fiber. + firstEffect: Fiber | null; + lastEffect: Fiber | null; + + // Represents a time in the future by which this work should be completed. + // Does not include work found in its subtree. + expirationTime: ExpirationTime; + + // This is used to quickly determine if a subtree has no pending changes. + childExpirationTime: ExpirationTime; + + // This is a pooled version of a Fiber. Every fiber that gets updated will + // eventually have a pair. There are cases when we can clean up pairs to save + // memory if we need to. + alternate: Fiber | null; + + // Time spent rendering this Fiber and its descendants for the current update. + // This tells us how well the tree makes use of sCU for memoization. + // It is reset to 0 each time we render and only updated when we don't bailout. + // This field is only set when the enableProfilerTimer flag is enabled. + actualDuration?: number; + + // If the Fiber is currently active in the "render" phase, + // This marks the time at which the work began. + // This field is only set when the enableProfilerTimer flag is enabled. + actualStartTime?: number; + + // Duration of the most recent render time for this Fiber. + // This value is not updated when we bailout for memoization purposes. + // This field is only set when the enableProfilerTimer flag is enabled. + selfBaseDuration?: number; + + // Sum of base times for all descedents of this Fiber. + // This value bubbles up during the "complete" phase. + // This field is only set when the enableProfilerTimer flag is enabled. + treeBaseDuration?: number; + + // Conceptual aliases + // workInProgress : Fiber -> alternate The alternate used for reuse happens + // to be the same as work in progress. + // __DEV__ only + _debugID?: number; + _debugSource?: Source | null; + _debugOwner?: Fiber | null; + _debugIsCurrentlyTiming?: boolean; + } + + // react-reconciler/ReactFiberExpirationTime + + type ExpirationTime = number; + + // react-reconciler/ReactFiberNewContext + + interface ContextDependency { + context: ReactContext; + observedBits: number; + next: ContextDependency | null; + } + + // react-reconciler/ReactFiberReconciler + + type OpaqueHandle = Fiber; + type OpaqueRoot = FiberRoot; + + interface HostConfig { + getPublicInstance(instance: Instance | TextInstance): PublicInstance; + getRootHostContext(rootContainerInstance: Container): HostContext; + getChildHostContext(parentHostContext: HostContext, type: Type, rootContainerInstance: Container): HostContext; + + prepareForCommit(containerInfo: Container): void; + resetAfterCommit(containerInfo: Container): void; + + createInstance( + type: Type, + props: Props, + rootContainerInstance: Container, + hostContext: HostContext, + internalInstanceHandle: OpaqueHandle, + ): Instance; + appendInitialChild(parentInstance: Instance, child: Instance | TextInstance): void; + finalizeInitialChildren( + parentInstance: Instance, + type: Type, + props: Props, + rootContainerInstance: Container, + hostContext: HostContext, + ): boolean; + + prepareUpdate( + instance: Instance, + type: Type, + oldProps: Props, + newProps: Props, + rootContainerInstance: Container, + hostContext: HostContext, + ): null | UpdatePayload; + + shouldSetTextContent(type: Type, props: Props): boolean; + shouldDeprioritizeSubtree(type: Type, props: Props): boolean; + + createTextInstance( + text: string, + rootContainerInstance: Container, + hostContext: HostContext, + internalInstanceHandle: OpaqueHandle, + ): TextInstance; + + scheduleDeferredCallback( + callback: (deadline: Deadline) => void, + options?: { timeout: number }, + ): any; + cancelDeferredCallback(callbackID: any): void; + + setTimeout(handler: (...args: any[]) => void, timeout: number): TimeoutHandle | NoTimeout; + clearTimeout(handle: TimeoutHandle | NoTimeout): void; + noTimeout: NoTimeout; + + now(): number; + + // Temporary workaround for scenario where multiple renderers concurrently + // render using the same context objects. E.g. React DOM and React ART on the + // same page. DOM is the primary renderer; ART is the secondary renderer. + isPrimaryRenderer: boolean; + + supportsMutation: boolean; + supportsPersistence: boolean; + supportsHydration: boolean; + + // ------------------- + // Mutation + // (optional) + // ------------------- + appendChild?(parentInstance: Instance, child: Instance | TextInstance): void; + appendChildToContainer?(container: Container, child: Instance | TextInstance): void; + commitTextUpdate?(textInstance: TextInstance, oldText: string, newText: string): void; + commitMount?( + instance: Instance, + type: Type, + newProps: Props, + internalInstanceHandle: OpaqueHandle, + ): void; + commitUpdate?( + instance: Instance, + updatePayload: UpdatePayload, + type: Type, + oldProps: Props, + newProps: Props, + internalInstanceHandle: OpaqueHandle, + ): void; + insertBefore?(parentInstance: Instance, child: Instance | TextInstance, beforeChild: Instance | TextInstance): void; + insertInContainerBefore?( + container: Container, + child: Instance | TextInstance, + beforeChild: Instance | TextInstance, + ): void; + removeChild?(parentInstance: Instance, child: Instance | TextInstance): void; + removeChildFromContainer?(container: Container, child: Instance | TextInstance): void; + resetTextContent?(instance: Instance): void; + + // ------------------- + // Persistence + // (optional) + // ------------------- + cloneInstance?( + instance: Instance, + updatePayload: null | UpdatePayload, + type: Type, + oldProps: Props, + newProps: Props, + internalInstanceHandle: OpaqueHandle, + keepChildren: boolean, + recyclableInstance: Instance, + ): Instance; + + createContainerChildSet?(container: Container): ChildSet; + + appendChildToContainerChildSet?(childSet: ChildSet, child: Instance | TextInstance): void; + finalizeContainerChildren?(container: Container, newChildren: ChildSet): void; + + replaceContainerChildren?(container: Container, newChildren: ChildSet): void; + + // ------------------- + // Hydration + // (optional) + // ------------------- + canHydrateInstance?(instance: HydratableInstance, type: Type, props: Props): null | Instance; + canHydrateTextInstance?(instance: HydratableInstance, text: string): null | TextInstance; + getNextHydratableSibling?(instance: Instance | TextInstance | HydratableInstance): null | HydratableInstance; + getFirstHydratableChild?(parentInstance: Instance | Container): null | HydratableInstance; + hydrateInstance?( + instance: Instance, + type: Type, + props: Props, + rootContainerInstance: Container, + hostContext: HostContext, + internalInstanceHandle: OpaqueHandle, + ): null | UpdatePayload; + hydrateTextInstance?( + textInstance: TextInstance, + text: string, + internalInstanceHandle: OpaqueHandle, + ): boolean; + didNotMatchHydratedContainerTextInstance?( + parentContainer: Container, + textInstance: TextInstance, + text: string, + ): void; + didNotMatchHydratedTextInstance?( + parentType: Type, + parentProps: Props, + parentInstance: Instance, + textInstance: TextInstance, + text: string, + ): void; + didNotHydrateContainerInstance?(parentContainer: Container, instance: Instance | TextInstance): void; + didNotHydrateInstance?( + parentType: Type, + parentProps: Props, + parentInstance: Instance, + instance: Instance | TextInstance, + ): void; + didNotFindHydratableContainerInstance?( + parentContainer: Container, + type: Type, + props: Props, + ): void; + didNotFindHydratableContainerTextInstance?( + parentContainer: Container, + text: string, + ): void; + didNotFindHydratableInstance?( + parentType: Type, + parentProps: Props, + parentInstance: Instance, + type: Type, + props: Props, + ): void; + didNotFindHydratableTextInstance?( + parentType: Type, + parentProps: Props, + parentInstance: Instance, + text: string, + ): void; + } + + // 0 is PROD, 1 is DEV. + // Might add PROFILE later. + type BundleType = 0 | 1; + + interface DevToolsConfig { + bundleType: BundleType; + version: string; + rendererPackageName: string; + // Note: this actually *does* depend on Fiber internal fields. + // Used by "inspect clicked DOM element" in React DevTools. + findFiberByHostInstance?: (instance: Instance | TextInstance) => Fiber; + // Used by RN in-app inspector. + // This API is unfortunately RN-specific. + // TODO: Change it to accept Fiber instead and type it properly. + getInspectorDataForViewTag?: (tag: number) => object; + } + + interface Reconciler { + updateContainerAtExpirationTime( + element: ReactNodeList, + container: OpaqueRoot, + parentComponent: Component | null | undefined, + expirationTime: ExpirationTime, + callback: () => void | null | undefined, + ): ExpirationTime; + createContainer( + containerInfo: Container, + isAsync: boolean, + hydrate: boolean, + ): OpaqueRoot; + updateContainer( + element: ReactNodeList, + container: OpaqueRoot, + parentComponent: Component | null | undefined, + callback: () => void | null | undefined, + ): ExpirationTime; + flushRoot(root: OpaqueRoot, expirationTime: ExpirationTime): void; + requestWork(root: OpaqueRoot, expirationTime: ExpirationTime): void; + computeUniqueAsyncExpiration(): ExpirationTime; + batchedUpdates(fn: () => A): A; + unbatchedUpdates(fn: () => A): A; + deferredUpdates(fn: () => A): A; + syncUpdates(fn: () => A): A; + interactiveUpdates(fn: () => A): A; + flushInteractiveUpdates(): void; + flushControlled(fn: () => any): void; + flushSync(fn: () => A): A; + + // Used to extract the return value from the initial render. Legacy API. + getPublicRootInstance( + container: OpaqueRoot, + ): Component | PublicInstance | null; + + // Use for findDOMNode/findHostNode. Legacy API. + findHostInstance(component: object): PublicInstance | null; + + // Used internally for filtering out portals. Legacy API. + findHostInstanceWithNoPortals(component: Fiber): PublicInstance | null; + injectIntoDevTools(devToolsConfig: DevToolsConfig): boolean; + } + + // react-reconciler/ReactFiberRoot + + // TODO: This should be lifted into the renderer. + interface Batch { + _defer: boolean; + _expirationTime: ExpirationTime; + _onComplete: () => any; + _next: Batch | null; + } + + type PendingInteractionMap = Map>; + + interface BaseFiberRootProperties { + // Any additional information from the host associated with this root. + containerInfo: any; + // Used only by persistent updates. + pendingChildren: any; + // The currently active root fiber. This is the mutable root of the tree. + current: Fiber; + + // The following priority levels are used to distinguish between 1) + // uncommitted work, 2) uncommitted work that is suspended, and 3) uncommitted + // work that may be unsuspended. We choose not to track each individual + // pending level, trading granularity for performance. + // + // The earliest and latest priority levels that are suspended from committing. + earliestSuspendedTime: ExpirationTime; + latestSuspendedTime: ExpirationTime; + // The earliest and latest priority levels that are not known to be suspended. + earliestPendingTime: ExpirationTime; + latestPendingTime: ExpirationTime; + // The latest priority level that was pinged by a resolved promise and can + // be retried. + latestPingedTime: ExpirationTime; + + // If an error is thrown, and there are no more updates in the queue, we try + // rendering from the root one more time, synchronously, before handling + // the error. + didError: boolean; + + pendingCommitExpirationTime: ExpirationTime; + // A finished work-in-progress HostRoot that's ready to be committed. + finishedWork: Fiber | null; + // Timeout handle returned by setTimeout. Used to cancel a pending timeout, if + // it's superseded by a new one. + timeoutHandle: any; + // Top context object, used by renderSubtreeIntoContainer + context: object | null; + pendingContext: object | null; + // Determines if we should attempt to hydrate on the initial mount + readonly hydrate: boolean; + // Remaining expiration time on this root. + // TODO: Lift this into the renderer + nextExpirationTimeToWorkOn: ExpirationTime; + expirationTime: ExpirationTime; + // List of top-level batches. This list indicates whether a commit should be + // deferred. Also contains completion callbacks. + // TODO: Lift this into the renderer + firstBatch: Batch | null; + // Linked-list of roots + nextScheduledRoot: FiberRoot | null; + } + + // The following attributes are only used by interaction tracking builds. + // They enable interactions to be associated with their async work, + // And expose interaction metadata to the React DevTools Profiler plugin. + // Note that these attributes are only defined when the enableSchedulerTracking flag is enabled. + interface ProfilingOnlyFiberRootProperties { + interactionThreadID: number; + memoizedInteractions: Set; + pendingInteractionMap: PendingInteractionMap; + } + + type FiberRoot = BaseFiberRootProperties & ProfilingOnlyFiberRootProperties; + + // react-reconciler/ReactFiberScheduler + + interface Deadline { + timeRemaining: () => number; + didTimeout: boolean; + } + + // react-reconciler/ReactTypeOfMode + + type TypeOfMode = number; + + // react-reconciler/ReactUpdateQueue + + interface Update { + expirationTime: ExpirationTime; + + tag: 0 | 1 | 2 | 3; + payload: any; + callback: (() => any) | null; + + next: Update | null; + nextEffect: Update | null; + } + + interface UpdateQueue { + baseState: State; + + firstUpdate: Update | null; + lastUpdate: Update | null; + + firstCapturedUpdate: Update | null; + lastCapturedUpdate: Update | null; + + firstEffect: Update | null; + lastEffect: Update | null; + + firstCapturedEffect: Update | null; + lastCapturedEffect: Update | null; + } + + // schedule/Tracking + + interface Interaction { + __count: number; + id: number; + name: string; + timestamp: number; + } + + // shared/ReactElementType + + interface Source { + fileName: string; + lineNumber: number; + } + + // shared/ReactSideEffectTags + + type SideEffectTag = number; + + // shared/ReactTypes + + type ReactEmpty = null | undefined | boolean; + + type ReactNodeList = ReactEmpty | ReactNode; + + interface ReactProviderType { + $$typeof: symbol | number; + _context: ReactContext; + } + + interface ReactContext { + $$typeof: symbol | number; + Consumer: ReactContext; + Provider: ReactProviderType; + unstable_read: () => T; + + _calculateChangedBits: ((a: T, b: T) => number) | null; + + _currentValue: T; + _currentValue2: T; + + // DEV only + _currentRenderer?: object | null; + _currentRenderer2?: object | null; + } + + interface RefObject { + current: any; + } + + // shared/ReactWorkTags + + type WorkTag = + | 0 + | 1 + | 2 + | 3 + | 4 + | 5 + | 6 + | 7 + | 8 + | 9 + | 10 + | 11 + | 12 + | 13 + | 14 + | 15 + | 16; +} + +export = ReactReconciler; diff --git a/types/react-reconciler/test/react-reconciler-tests.ts b/types/react-reconciler/test/react-reconciler-tests.ts index 9008446d6a..d29c7e2fad 100644 --- a/types/react-reconciler/test/react-reconciler-tests.ts +++ b/types/react-reconciler/test/react-reconciler-tests.ts @@ -1,4 +1,4 @@ -import ReactFiberReconciler from 'react-reconciler'; +import ReactFiberReconciler = require("react-reconciler"); import * as ReactTestHostConfig from './ReactTestHostConfig'; // $ExpectType Reconciler diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts new file mode 100644 index 0000000000..9e8776cb8f --- /dev/null +++ b/types/react-visibility-sensor/index.d.ts @@ -0,0 +1,40 @@ +// Type definitions for react-visibility-sensor 3.11 +// Project: https://github.com/joshwnj/react-visibility-sensor#readme +// Definitions by: Rasmus Bergström +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; + +export as namespace ReactVisibilitySensor; + +interface Shape { + top?: number; + left?: number; + bottom?: number; + right?: number; +} + +interface Props { + onChange: (isVisible: boolean, visibilityRect?: Shape) => void; + active?: boolean; + partialVisibility?: boolean; + offset?: Shape; + minTopValue?: number; + intervalCheck?: boolean; + intervalDelay?: number; + scrollCheck?: boolean; + scrollDelay?: number; + scrollThrottle?: number; + resizeCheck?: boolean; + resizeDelay?: number; + resizeThrottle?: number; + delayedCall?: boolean; + children?: ( + args: { isVisible: boolean; visibilityRect?: Shape } + ) => React.ReactNode; +} + +declare const ReactVisibilitySensor: React.StatelessComponent; + +export = ReactVisibilitySensor; diff --git a/types/react-visibility-sensor/react-visibility-sensor-tests.tsx b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx new file mode 100644 index 0000000000..9dca0efb34 --- /dev/null +++ b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx @@ -0,0 +1,27 @@ +import * as React from "react"; + +import * as ReactVisibilitySensor from "react-visibility-sensor"; + +const num = 1; +const bool = true; +const shape = { top: num, left: num, bottom: num, right: num }; + +const component = ( + {}} + active={bool} + partialVisibility={bool} + offset={shape} + minTopValue={num} + intervalCheck={bool} + intervalDelay={num} + scrollCheck={bool} + scrollDelay={num} + scrollThrottle={num} + resizeCheck={bool} + resizeDelay={num} + resizeThrottle={num} + delayedCall={bool}> + {({ isVisible: bool, visibilityRect: shape }) =>
} + +); diff --git a/types/react-visibility-sensor/tsconfig.json b/types/react-visibility-sensor/tsconfig.json new file mode 100644 index 0000000000..29d5985cfe --- /dev/null +++ b/types/react-visibility-sensor/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es7", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "jsx": "react", + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "react-visibility-sensor-tests.tsx"] +} diff --git a/types/react-visibility-sensor/tslint.json b/types/react-visibility-sensor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-visibility-sensor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/select2/v3/index.d.ts b/types/select2/v3/index.d.ts index 771d997384..73f1873df1 100644 --- a/types/select2/v3/index.d.ts +++ b/types/select2/v3/index.d.ts @@ -112,6 +112,14 @@ interface Select2Plugin { * @params triggerChange Should a change event be triggered */ (method: 'data', value: any, triggerChange?: boolean): any; + /** + * Whether it is open + */ + (method: 'opened'): boolean; + /** + * Whether it is in focus + */ + (method: 'isFocused'): boolean; /** * Reverts changes to DOM done by Select2. Any selection done via Select2 will be preserved. */ @@ -124,11 +132,19 @@ interface Select2Plugin { * Closes the dropdown */ (method: 'close'): JQuery; + /** + * Disables Select2 + */ + (method: 'disable'): JQuery; /** * Enables or disables Select2 and its underlying form component * @param value True if it should be enabled false if it should be disabled */ (method: 'enable', value?: boolean): JQuery; + /** + * Enable its focus + */ + (method: 'focus'): JQuery; /** * Toggles readonly mode on Select2 and its underlying form component * @param value True if it should be readonly false if it should be read write diff --git a/types/select2/v3/select2-tests.ts b/types/select2/v3/select2-tests.ts index 2d5a400352..c820a246ef 100644 --- a/types/select2/v3/select2-tests.ts +++ b/types/select2/v3/select2-tests.ts @@ -220,6 +220,10 @@ $("#e8").select2("data"); $("#e8").select2("data", { id: "CA", text: "Califoria" }); $("#e8").select2("destroy"); $("#e8").select2("open"); +$("#e8").select2("opened"); +$("#e8").select2("focus"); +$("#e8").select2("isFocused"); +$("#e8").select2("disable"); $("#e8").select2("enable", false); $("#e8").select2("readonly", false); $("#e8").select2('container'); diff --git a/types/zeit__next-typescript/zeit__next-typescript-tests.ts b/types/zeit__next-typescript/zeit__next-typescript-tests.ts index a7b58c46fc..6a9a87ac50 100644 --- a/types/zeit__next-typescript/zeit__next-typescript-tests.ts +++ b/types/zeit__next-typescript/zeit__next-typescript-tests.ts @@ -1,3 +1,3 @@ import withTypescript = require('@zeit/next-typescript'); -withTypescript({}); // $ExpectType ServerConfig +withTypescript({}); // $ExpectType NextConfig