diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f9324d1bdd..9084f165aa 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2645,8 +2645,8 @@ /types/node/v4/ @eps1lon /types/node/v6/ @WilcoBakker @inlined @eps1lon @Alorel /types/node/v7/ @parambirs @tellnes @WilcoBakker @eps1lon -/types/node/v8/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e -/types/node/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e +/types/node/v8/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e +/types/node/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e /types/node-7z/ @erkie /types/node-array-ext/ @Beng89 /types/node-cache/ @chrootsu @dthunell @useltmann diff --git a/README.md b/README.md index 554316e52a..8e582f05b4 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ Your package should have this structure: | tsconfig.json | This allows you to run `tsc` within the package. | | tslint.json | Enables linting. | -Generate these by running `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --template module`. +Generate these by running `npx dts-gen --dt --name my-package-name --template module` if you have npm ≥ 5.2.0, `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --template module` otherwise. See all options at [dts-gen](https://github.com/Microsoft/dts-gen). You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option. diff --git a/notNeededPackages.json b/notNeededPackages.json index dd5523d102..4fb2ecedb3 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1158,6 +1158,12 @@ "sourceRepoURL": "https://github.com/react-ga/react-ga", "asOfVersion": "2.3.0" }, + { + "libraryName": "react-monaco-editor", + "typingsPackageName": "react-monaco-editor", + "sourceRepoURL": "https://github.com/superRaytin/react-monaco-editor", + "asOfVersion": "0.16.0" + }, { "libraryName": "react-native-collapsible", "typingsPackageName": "react-native-collapsible", diff --git a/package.json b/package.json index 37d1f4d48b..c5b1b03057 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,27 @@ { - "private": true, - "name": "definitely-typed", - "version": "0.0.2", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "engines": { - "node": ">=7.8.0" - }, - "scripts": { - "compile-scripts": "tsc -p scripts", - "not-needed": "node scripts/not-needed.js", - "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed", - "lint": "dtslint types" - }, - "devDependencies": { - "dtslint": "github:Microsoft/dtslint#production", - "types-publisher": "Microsoft/types-publisher#production" - } + "private": true, + "name": "definitely-typed", + "version": "0.0.2", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped", + "repository": { + "type": "git", + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "engines": { + "node": ">=7.8.0" + }, + "scripts": { + "compile-scripts": "tsc -p scripts", + "not-needed": "node scripts/not-needed.js", + "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed", + "lint": "dtslint types" + }, + "devDependencies": { + "dtslint": "github:Microsoft/dtslint#production", + "types-publisher": "Microsoft/types-publisher#production" + } } diff --git a/types/ace-diff/ace-diff-tests.ts b/types/ace-diff/ace-diff-tests.ts new file mode 100644 index 0000000000..52e64589a3 --- /dev/null +++ b/types/ace-diff/ace-diff-tests.ts @@ -0,0 +1,22 @@ +import AceDiff = require('ace-diff'); + +new AceDiff(); // $ExpectError + +const aceDiffConstructorOpts = { + element: '.acediff', + left: { content: 'left content' }, + right: { content: 'right content' }, +}; +new AceDiff(aceDiffConstructorOpts); // $ExpectType AceDiff + +const differ = new AceDiff(aceDiffConstructorOpts); + +differ.getEditors(); // $ExpectType { left: any; right: any; } +differ.setOptions(); // $ExpectError +const aceDiffOpts = { + diffGranularity: 'broad' as 'broad', // workaround: cast to avoid https://github.com/Microsoft/TypeScript/issues/11465#issuecomment-252453037 +}; +differ.setOptions(aceDiffOpts); // $ExpectType void +differ.getNumDiffs(); // $ExpectType number +differ.diff(); // $ExpectType void +differ.destroy(); // $ExpectType void diff --git a/types/ace-diff/index.d.ts b/types/ace-diff/index.d.ts new file mode 100644 index 0000000000..b59b3d25e2 --- /dev/null +++ b/types/ace-diff/index.d.ts @@ -0,0 +1,52 @@ +// Type definitions for ace-diff 2.1 +// Project: https://ace-diff.github.io/ace-diff/ +// Definitions by: Mike Dodge +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace AceDiff; + +export = AceDiff; + +declare class AceDiff { + constructor(opts: AceDiff.AceDiffConstructorOpts); + getEditors(): { + left: any; + right: any; + }; + setOptions(options: AceDiff.AceDiffOpts): void; + getNumDiffs(): number; + diff(): void; + destroy(): void; +} +declare namespace AceDiff { + interface AceDiffLROpts { + content?: string | null; + mode?: string; + theme?: string; + editable?: boolean; + copyLinkEnabled?: boolean; + } + + interface AceDiffConstructorOpts extends AceDiffOpts { + element: string | HTMLElement; + left: AceDiffLROpts; + right: AceDiffLROpts; + } + + interface AceDiffOpts { + mode?: string; + theme?: string; + diffGranularity?: 'specific' | 'broad'; + showDiffs?: boolean; + showConnectors?: boolean; + maxDiffs?: number; + left?: AceDiffLROpts; + right?: AceDiffLROpts; + classes?: { + diff: string; + connector: string; + newCodeConnectorLinkContent: string; + deletedCodeConnectorLinkContent: string; + }; + } +} diff --git a/types/ace-diff/tsconfig.json b/types/ace-diff/tsconfig.json new file mode 100644 index 0000000000..00fb70bbcd --- /dev/null +++ b/types/ace-diff/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ace-diff-tests.ts" + ] +} diff --git a/types/react-monaco-editor/tslint.json b/types/ace-diff/tslint.json similarity index 100% rename from types/react-monaco-editor/tslint.json rename to types/ace-diff/tslint.json diff --git a/types/activex-access/activex-access-tests.ts b/types/activex-access/activex-access-tests.ts index f224b92d70..3992ba34fd 100644 --- a/types/activex-access/activex-access-tests.ts +++ b/types/activex-access/activex-access-tests.ts @@ -1,3 +1,5 @@ +/// + let app = new ActiveXObject('Access.Application'); app.UserControl = true; @@ -6,7 +8,7 @@ app.DoCmd.OpenForm('MyForm', Access.AcFormView.acNormal, '', 'LastName="Smith"') // change the contents of a textbox // tslint:disable-next-line:no-unnecessary-type-assertion -let textbox = app.Forms.Item('MyForm').Controls.Item('MyTextBox') as Access.TextBox; +let textbox = app.Forms('MyForm').Controls('MyTextBox') as Access.TextBox; textbox.Text = 'Not Smith'; // save the current record on the active form diff --git a/types/activex-access/index.d.ts b/types/activex-access/index.d.ts index 2529538cad..d0bf798652 100644 --- a/types/activex-access/index.d.ts +++ b/types/activex-access/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// /// /// /// @@ -929,6 +930,14 @@ declare namespace Access { acFormReadOnly = 2, } + const enum AcFormSection { + acDetail = 0, + acFooter = 2, + acHeader = 1, + acPageFooter = 4, + acPageHeader = 3, + } + const enum AcFormView { acDesign = 1, acFormDS = 3, @@ -987,6 +996,13 @@ declare namespace Access { acLayoutTabular = 1, } + const enum AcSetMenuItemState { + acMenuCheck = 3, + acMenuGray = 1, + acMenuUncheck = 2, + acMenuUngray = 0, + } + const enum AcModuleType { acClassModule = 1, acStandardModule = 0, @@ -1027,6 +1043,21 @@ declare namespace Access { acReadOnly = 2, } + const enum AcOutputFormat { + acFormatASP = 'Microsoft Active Server Pages (*.asp)', + acFormatDAP = 'Microsoft Access Data Access Page (*.htm; *.html)', + acFormatHTML = 'HTML (*.html)', + acFormatIIS = 'Microsoft IIS (*.htx; *.idc)', + acFormatPDF = 'PDF Format (*.pdf)', + acFormatRTF = 'Rich Text Format (*.rtf)', + acFormatSNP = 'Snapshot Format (*.snp)', + acFormatTXT = 'MS-DOS Text (*.txt)', + acFormatXLS = 'Microsoft Excel (*.xls)', + acFormatXLSB = 'Microsoft Excel Binary Workbook (*.xlsb)', + acFormatXLSX = 'Microsoft Excel Workbook (*.xlsx)', + acFormatXPS = 'XPS Format (*.xps)' + } + const enum AcOutputObjectType { acOutputDataAccessPage = 6, acOutputForm = 2, @@ -1185,18 +1216,7 @@ declare namespace Access { acPrevious = 0, } - const enum AcResourceType { - acResourceImage = 1, - acResourceTheme = 0, - } - - const enum AcSearchDirection { - acDown = 1, - acSearchAll = 2, - acUp = 0, - } - - const enum AcSection { + const enum AcReportSection { acDetail = 0, acFooter = 2, acGroupLevel1Footer = 6, @@ -1208,6 +1228,17 @@ declare namespace Access { acPageHeader = 3, } + const enum AcResourceType { + acResourceImage = 1, + acResourceTheme = 0, + } + + const enum AcSearchDirection { + acDown = 1, + acSearchAll = 2, + acUp = 0, + } + const enum AcSendObjectType { acSendDataAccessPage = 6, acSendForm = 2, @@ -1864,19 +1895,9 @@ declare namespace Access { TypeLib = 0, } - class _AccessProperty { - private 'Access._AccessProperty_typekey': _AccessProperty; - private constructor(); - readonly Application: Application; - readonly Category: number; - readonly Inherited: boolean; - IsMemberSafe(dispid: number): boolean; - Name: string; - readonly Parent: any; - readonly Properties: DAO.Properties; - Type: number; - Value: any; - } + type ByteArray = SafeArray; + + type DatabaseType = 'Microsoft Access (default)' | 'Jet 2.x' | 'Jet 3.x' | 'dBase III' | 'dBase IV' | 'dBase 5.0' | 'Paradox 3.x' | 'Paradox 4.x' | 'Paradox 5.x' | 'Paradox 7.x' | 'ODBC Database' | 'WSS'; class _CheckBoxInOption { private 'Access._CheckBoxInOption_typekey': _CheckBoxInOption; @@ -1957,7 +1978,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -2094,7 +2115,7 @@ declare namespace Access { LeftMargin: number; LeftPadding: number; LineSpacing: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NumeralShapes: number; OldBorderStyle: number; @@ -2161,7 +2182,7 @@ declare namespace Access { readonly Layout: AcLayoutType; readonly LayoutID: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectVerbs(Index: number): string; @@ -2249,7 +2270,7 @@ declare namespace Access { LeftPadding: number; Locked: boolean; LpOleObject: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectPalette: any; @@ -2290,12 +2311,11 @@ declare namespace Access { Width: number; } - class _ItemsSelected { - private 'Access._ItemsSelected_typekey': _ItemsSelected; - private constructor(); + interface _ItemsSelected { readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): number; + (Index: any): number; } class _OptionButtonInOption { @@ -2377,7 +2397,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -2645,7 +2665,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; ObjectPalette: any; readonly OldValue: any; @@ -2745,16 +2765,15 @@ declare namespace Access { readonly Type: AcObjectType; } - class AccessObjectProperties { - private 'Access.AccessObjectProperties_typekey': AccessObjectProperties; - private constructor(); + interface AccessObjectProperties { Add(PropertyName: string, Value: any): void; readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): AccessObjectProperty; + Item(Index: number | string): AccessObjectProperty; readonly Parent: any; - Remove(Item: any): void; + Remove(Item: number | string): void; + (Index: number | string): AccessObjectProperty; } class AccessObjectProperty { @@ -2766,130 +2785,42 @@ declare namespace Access { Value: any; } - class AdditionalData { - private 'Access.AdditionalData_typekey': AdditionalData; + interface AccessObjects { + readonly Application: Application; + readonly Count: number; + IsMemberSafe(dispid: number): boolean; + Item(var_0: number | string): AccessObject; + readonly Parent: any; + (var_0: number | string): AccessObject; + } + + class AccessProperty { + private 'Access._AccessProperty_typekey': AccessProperty; private constructor(); + readonly Application: Application; + readonly Category: number; + readonly Inherited: boolean; + IsMemberSafe(dispid: number): boolean; + Name: string; + readonly Parent: any; + readonly Properties: DAO.Properties; + Type: number; + Value: any; + } + + interface AdditionalData { Add(var_0: string): AdditionalData; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): AdditionalData; + Item(Index: number | string): AdditionalData; Name: string; - } - - class AllDataAccessPages { - private 'Access.AllDataAccessPages_typekey': AllDataAccessPages; - private constructor(); - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - } - - class AllDatabaseDiagrams { - private 'Access.AllDatabaseDiagrams_typekey': AllDatabaseDiagrams; - private constructor(); - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - } - - class AllForms { - private 'Access.AllForms_typekey': AllForms; - private constructor(); - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - } - - class AllFunctions { - private 'Access.AllFunctions_typekey': AllFunctions; - private constructor(); - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - } - - class AllMacros { - private 'Access.AllMacros_typekey': AllMacros; - private constructor(); - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - } - - class AllModules { - private 'Access.AllModules_typekey': AllModules; - private constructor(); - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - } - - class AllQueries { - private 'Access.AllQueries_typekey': AllQueries; - private constructor(); - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - } - - class AllReports { - private 'Access.AllReports_typekey': AllReports; - private constructor(); - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - } - - class AllStoredProcedures { - private 'Access.AllStoredProcedures_typekey': AllStoredProcedures; - private constructor(); - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - } - - class AllTables { - private 'Access.AllTables_typekey': AllTables; - private constructor(); - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - } - - class AllViews { - private 'Access.AllViews_typekey': AllViews; - private constructor(); - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; + (Index: number | string): AdditionalData; } class Application { private 'Access.Application_typekey': Application; private constructor(); - AccessError(ErrorNumber: any): any; + AccessError(ErrorNumber: number): string; AddAutoCorrect(ChangeFrom: string, ChangeTo: string): void; AddToFavorites(): void; readonly ADOConnectString: string; @@ -2914,46 +2845,42 @@ declare namespace Access { readonly COMAddIns: Office.COMAddIns; readonly CommandBars: Office.CommandBars; - /** @param boolean [LogFile=false] */ + /** @param LogFile [LogFile=false] */ CompactRepair(SourceFile: string, DestinationFile: string, LogFile?: boolean): boolean; ConvertAccessProject(SourceFilename: string, DestinationFilename: string, DestinationFileFormat: AcFileFormat): void; - CreateAccessProject(filepath: string, Connect?: any): void; + CreateAccessProject(filepath: string, Connect?: string): void; CreateAdditionalData(): AdditionalData; - /** @param Access.AcSection [Section=0] */ - CreateControl(FormName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; - CreateControlEx( - FormName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlSource: string, Left: number, Top: number, Width: number, Height: number): Control; - CreateControlExOld( - FormName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlSource: string, Left: number, Top: number, Width: number, Height: number): Control; + /** @param Section [Section=0] */ + CreateControl(FormName: string, ControlType: AcControlType, Section?: AcFormSection, Parent?: string, ColumnName?: string, Left?: number, Top?: number, Width?: number, Height?: number): Control; + CreateControlEx(FormName: string, ControlType: AcControlType, Section: AcFormSection, Parent: string, ControlSource: string, Left: number, Top: number, Width: number, Height: number): Control; + CreateControlExOld(FormName: string, ControlType: AcControlType, Section: AcFormSection, Parent: string, ControlSource: string, Left: number, Top: number, Width: number, Height: number): Control; - /** @param Access.AcSection [Section=0] */ - CreateControlOld(FormName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; + /** @param Section [Section=0] */ + CreateControlOld(FormName: string, ControlType: AcControlType, Section?: AcFormSection, Parent?: string, ColumnName?: string, Left?: number, Top?: number, Width?: number, Height?: number): Control; - /** @param boolean [CreateNewFile=true] */ - CreateDataAccessPage(FileName: any, CreateNewFile?: boolean): DataAccessPage; - CreateForm(Database?: any, FormTemplate?: any): Form; + /** @param CreateNewFile [CreateNewFile=true] */ + CreateDataAccessPage(FileName: string, CreateNewFile?: boolean): DataAccessPage; + CreateForm(Database?: string, FormTemplate?: string): Form; CreateGroupLevel(ReportName: string, Expression: string, Header: number, Footer: number): number; /** - * @param string [Path=' '] - * @param string [Name=' '] - * @param string [Company=' '] - * @param string [WorkgroupID=' '] - * @param boolean [Replace=false] + * @param Path [Path=' '] + * @param Name [Name=' '] + * @param Company [Company=' '] + * @param WorkgroupID [WorkgroupID=' '] + * @param Replace [Replace=false] */ CreateNewWorkgroupFile(Path?: string, Name?: string, Company?: string, WorkgroupID?: string, Replace?: boolean): void; - CreateReport(Database?: any, ReportTemplate?: any): Report; + CreateReport(Database?: string, ReportTemplate?: string): Report; - /** @param Access.AcSection [Section=0] */ - CreateReportControl(ReportName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; - CreateReportControlEx( - ReportName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlName: string, Left: number, Top: number, Width: number, Height: number): Control; - CreateReportControlExOld( - ReportName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlName: string, Left: number, Top: number, Width: number, Height: number): Control; + /** @param Section [Section=0] */ + CreateReportControl(ReportName: string, ControlType: AcControlType, Section?: AcReportSection, Parent?: string, ColumnName?: string, Left?: number, Top?: number, Width?: number, Height?: number): Control; + CreateReportControlEx(ReportName: string, ControlType: AcControlType, Section: AcReportSection, Parent: string, ControlName: string, Left: number, Top: number, Width: number, Height: number): Control; + CreateReportControlExOld(ReportName: string, ControlType: AcControlType, Section: AcReportSection, Parent: string, ControlName: string, Left: number, Top: number, Width: number, Height: number): Control; - /** @param Access.AcSection [Section=0] */ - CreateReportControlOld(ReportName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; + /** @param Section [Section=0] */ + CreateReportControlOld(ReportName: string, ControlType: AcControlType, Section?: AcReportSection, Parent?: string, ColumnName?: string, Left?: number, Top?: number, Width?: number, Height?: number): Control; readonly CurrentData: CurrentData; CurrentDb(): DAO.Database; readonly CurrentObjectName: string; @@ -2963,97 +2890,99 @@ declare namespace Access { CurrentWebUser(DisplayOption: AcWebUserDisplay): any; CurrentWebUserGroups(DisplayOption: AcWebUserGroupsDisplay): any; readonly DataAccessPages: DataAccessPages; - DAvg(Expr: string, Domain: string, Criteria?: any): any; + DAvg(Expr: string, Domain: string, Criteria?: string): number | null; readonly DBEngine: DAO.DBEngine; - DCount(Expr: string, Domain: string, Criteria?: any): any; - DDEExecute(ChanNum: any, Command: string): void; - DDEInitiate(Application: string, Topic: string): any; - DDEPoke(ChanNum: any, Item: string, Data: string): void; - DDERequest(ChanNum: any, Item: string): string; - DDETerminate(ChanNum: any): void; + DCount(Expr: string, Domain: string, Criteria?: string): number | null; + DDEExecute(ChanNum: number, Command: string): void; + DDEInitiate(Application: string, Topic: string): number; + DDEPoke(ChanNum: number, Item: string, Data: string): void; + DDERequest(ChanNum: number, Item: string): string; + DDETerminate(ChanNum: number): void; DDETerminateAll(): void; readonly DefaultWebOptions: DefaultWebOptions; DefaultWorkspaceClone(): DAO.Workspace; DelAutoCorrect(ChangeFrom: string): void; DeleteControl(FormName: string, ControlName: string): void; DeleteReportControl(ReportName: string, ControlName: string): void; - DFirst(Expr: string, Domain: string, Criteria?: any): any; + DFirst(Expr: string, Domain: string, Criteria?: string): any; DirtyObject(ObjectType: AcObjectType, ObjectName: string): void; - DLast(Expr: string, Domain: string, Criteria?: any): any; - DLookup(Expr: string, Domain: string, Criteria?: any): any; - DMax(Expr: string, Domain: string, Criteria?: any): any; - DMin(Expr: string, Domain: string, Criteria?: any): any; + DLast(Expr: string, Domain: string, Criteria?: string): any; + DLookup(Expr: string, Domain: string, Criteria?: string): any; + DMax(Expr: string, Domain: string, Criteria?: string): any; + DMin(Expr: string, Domain: string, Criteria?: string): any; readonly DoCmd: DoCmd; - DStDev(Expr: string, Domain: string, Criteria?: any): any; - DStDevP(Expr: string, Domain: string, Criteria?: any): any; - DSum(Expr: string, Domain: string, Criteria?: any): any; - DVar(Expr: string, Domain: string, Criteria?: any): any; - DVarP(Expr: string, Domain: string, Criteria?: any): any; + DStDev(Expr: string, Domain: string, Criteria?: string): number | null; + DStDevP(Expr: string, Domain: string, Criteria?: string): number | null; + DSum(Expr: string, Domain: string, Criteria?: string): number | null; + DVar(Expr: string, Domain: string, Criteria?: string): number | null; + DVarP(Expr: string, Domain: string, Criteria?: string): number | null; - /** @param string [bstrStatusBarText=''] */ + /** @param bstrStatusBarText [bstrStatusBarText=''] */ Echo(EchoOn: number, bstrStatusBarText?: string): void; - EuroConvert(Number: number, SourceCurrency: string, TargetCurrency: string, FullPrecision?: any, TriangulationPrecision?: any): number; + EuroConvert(Number: number, SourceCurrency: string, TargetCurrency: string, FullPrecision?: boolean, TriangulationPrecision?: number): number; Eval(StringExpr: string): any; /** - * @param boolean [SelectedRecords=false] - * @param number [FromPage=1] - * @param number [ToPage=-1] + * @param SelectedRecords [SelectedRecords=false] + * @param FromPage [FromPage=1] + * @param ToPage [ToPage=-1] */ - ExportCustomFixedFormat( - ExternalExporter: any, OutputFileName: string, ObjectName: string, ObjectType: AcOutputObjectType, SelectedRecords?: boolean, FromPage?: number, ToPage?: number): void; + ExportCustomFixedFormat(ExternalExporter: any, OutputFileName: string, ObjectName: string, ObjectType: AcOutputObjectType, SelectedRecords?: boolean, FromPage?: number, ToPage?: number): void; ExportNavigationPane(Path: string): void; /** - * @param string [DataTarget=''] - * @param string [SchemaTarget=''] - * @param string [PresentationTarget=''] - * @param string [ImageTarget=''] - * @param Access.AcExportXMLEncoding [Encoding=0] - * @param Access.AcExportXMLOtherFlags [OtherFlags=0] - * @param string [WhereCondition=''] + * @param DataTarget [DataTarget=''] + * @param SchemaTarget [SchemaTarget=''] + * @param PresentationTarget [PresentationTarget=''] + * @param ImageTarget [ImageTarget=''] + * @param Encoding [Encoding=0] + * @param OtherFlags [OtherFlags=0] + * @param WhereCondition [WhereCondition=''] */ - ExportXML( - ObjectType: AcExportXMLObjectType, DataSource: string, DataTarget?: string, SchemaTarget?: string, PresentationTarget?: string, ImageTarget?: string, - Encoding?: AcExportXMLEncoding, OtherFlags?: AcExportXMLOtherFlags, WhereCondition?: string, AdditionalData?: any): void; + ExportXML(ObjectType: AcExportXMLObjectType, DataSource: string, DataTarget?: string, SchemaTarget?: string, PresentationTarget?: string, ImageTarget?: string, Encoding?: AcExportXMLEncoding, OtherFlags?: AcExportXMLOtherFlags, WhereCondition?: string, AdditionalData?: AdditionalData): void; /** - * @param string [DataTarget=''] - * @param string [SchemaTarget=''] - * @param string [PresentationTarget=''] - * @param string [ImageTarget=''] - * @param Access.AcExportXMLEncoding [Encoding=0] - * @param number [OtherFlags=0] + * @param DataTarget [DataTarget=''] + * @param SchemaTarget [SchemaTarget=''] + * @param PresentationTarget [PresentationTarget=''] + * @param ImageTarget [ImageTarget=''] + * @param Encoding [Encoding=0] + * @param OtherFlags [OtherFlags=0] */ - ExportXMLOld( - ObjectType: AcExportXMLObjectType, DataSource: string, DataTarget?: string, SchemaTarget?: string, PresentationTarget?: string, ImageTarget?: string, - Encoding?: AcExportXMLEncoding, OtherFlags?: number): void; + ExportXMLOld(ObjectType: AcExportXMLObjectType, DataSource: string, DataTarget?: string, SchemaTarget?: string, PresentationTarget?: string, ImageTarget?: string, Encoding?: AcExportXMLEncoding, OtherFlags?: number): void; FeatureInstall: Office.MsoFeatureInstall; FileDialog(dialogType: Office.MsoFileDialogType): Office.FileDialog; readonly FileSearch: Office.FileSearch; /** - * @param string [SubAddress=''] - * @param boolean [NewWindow=false] - * @param boolean [AddHistory=true] - * @param Office.MsoExtraInfoMethod [Method=0] - * @param string [HeaderInfo=''] + * @param SubAddress [SubAddress=''] + * @param NewWindow [NewWindow=false] + * @param AddHistory [AddHistory=true] + * @param Method [Method=0] + * @param HeaderInfo [HeaderInfo=''] */ - FollowHyperlink(Address: string, SubAddress?: string, NewWindow?: boolean, AddHistory?: boolean, ExtraInfo?: any, Method?: Office.MsoExtraInfoMethod, HeaderInfo?: string): void; + FollowHyperlink(Address: string, SubAddress?: string, NewWindow?: boolean, AddHistory?: boolean, ExtraInfo?: string | ByteArray, Method?: Office.MsoExtraInfoMethod, HeaderInfo?: string): void; readonly Forms: Forms; GetHiddenAttribute(ObjectType: AcObjectType, ObjectName: string): boolean; - GetOption(OptionName: string): any; - GUIDFromString(String: any): any; - HtmlEncode(PlainText: any, Length?: any): string; + + /** + * Returns different types of values based on how the options are set: + * * If by selecting / clearing a checkbox, returns `boolean` + * * If by typing a string or numeric value, returns `string` or `number` + * * If by choosing from a list, will return the 0-based index of the selected item + */ + GetOption(OptionName: string): boolean | string | number; + GUIDFromString(String: string): ByteArray; + HtmlEncode(PlainText: string, Length?: number): string; hWndAccessApp(): number; - /** @param Access.AcHyperlinkPart [Part=0] */ + /** @param Part [Part=0] */ HyperlinkPart(Hyperlink: any, Part?: AcHyperlinkPart): string; - /** @param boolean [fAppendOnly=false] */ + /** @param fAppendOnly [fAppendOnly=false] */ ImportNavigationPane(Path: string, fAppendOnly?: boolean): void; - /** @param Access.AcImportXMLOption [ImportOptions=1] */ + /** @param ImportOptions [ImportOptions=1] */ ImportXML(DataSource: string, ImportOptions?: AcImportXMLOption): void; InsertText(Text: string, ModuleName: string): void; InstantiateTemplate(Path: string): void; @@ -3072,36 +3001,36 @@ declare namespace Access { readonly Modules: Modules; readonly MsoDebugOptions: Office.MsoDebugOptions; readonly Name: string; - NewAccessProject(filepath: string, Connect?: any): void; + NewAccessProject(filepath: string, Connect?: string): void; /** - * @param Access.AcNewDatabaseFormat [FileFormat=0] - * @param string [SiteAddress=''] - * @param string [ListID=''] + * @param FileFormat [FileFormat=0] + * @param SiteAddress [SiteAddress=''] + * @param ListID [ListID=''] */ - NewCurrentDatabase(filepath: string, FileFormat?: AcNewDatabaseFormat, Template?: any, SiteAddress?: string, ListID?: string): void; + NewCurrentDatabase(filepath: string, FileFormat?: AcNewDatabaseFormat, Template?: string, SiteAddress?: string, ListID?: string): void; NewCurrentDatabaseOld(filepath: string): void; readonly NewFileTaskPane: Office.NewFile; Nz(Value: any, ValueIfNull?: any): any; - /** @param boolean [Exclusive=false] */ + /** @param Exclusive [Exclusive=false] */ OpenAccessProject(filepath: string, Exclusive?: boolean): void; /** - * @param boolean [Exclusive=false] - * @param string [bstrPassword=''] + * @param Exclusive [Exclusive=false] + * @param bstrPassword [bstrPassword=''] */ OpenCurrentDatabase(filepath: string, Exclusive?: boolean, bstrPassword?: string): void; - /** @param boolean [Exclusive=false] */ + /** @param Exclusive [Exclusive=false] */ OpenCurrentDatabaseOld(filepath: string, Exclusive?: boolean): void; readonly Parent: any; - PlainText(RichText: any, Length?: any): string; + PlainText(RichText: string, Length?: number): string; Printer: Printer; readonly Printers: Printers; readonly ProductCode: string; - /** @param Access.AcQuitOption [Option=1] */ + /** @param Option [Option=1] */ Quit(Option?: AcQuitOption): void; readonly References: References; RefreshDatabaseWindow(): void; @@ -3110,29 +3039,35 @@ declare namespace Access { ReplaceModule(objtyp: number, ModuleName: string, FileName: string, token: number): void; readonly Reports: Reports; readonly ReturnVars: ReturnVars; - Run( - Procedure: string, Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, - Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, - Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + Run(Procedure: string, Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; RunCommand(Command: AcCommand): void; SaveAsAXL(ObjectType: AcObjectType, ObjectName: string, FileName: string): void; - SaveAsTemplate( - Path: string, Title: string, IconPath: string, CoreTable: string, Category: string, PreviewPath?: any, Description?: any, InstantiationForm?: any, - ApplicationPart?: any, IncludeData?: any, Variation?: any): void; + SaveAsTemplate(Path: string, Title: string, IconPath: string, CoreTable: string, Category: string, PreviewPath?: any, Description?: string, InstantiationForm?: string, ApplicationPart?: boolean, IncludeData?: boolean, Variation?: any): void; SaveAsText(ObjectType: AcObjectType, ObjectName: string, FileName: string): void; readonly Screen: Screen; SetDefaultWorkgroupFile(Path: string): void; SetHiddenAttribute(ObjectType: AcObjectType, ObjectName: string, fHidden: boolean): void; - SetOption(OptionName: string, Setting: any): void; + + /** + * Pass different types of values based on how the option is set in the UI + * * If by selecting / clearing a checkbox, pass a `boolean` + * * If by typing a string or numeric value, pass a `string` or `number` + * * If by choosing from a list, pass the 0-based index of the tiem to select + */ + SetOption(OptionName: string, Setting: boolean | string | number): void; SetUndoRecording(yesno: number): void; ShortcutMenuBar: string; - StringFromGUID(Guid: any): any; - SysCmd(Action: AcSysCmdAction, Argument2?: any, Argument3?: any): any; + StringFromGUID(Guid: ByteArray): string; + SysCmd(Action: AcSysCmdAction.acSysCmdInitMeter, StatusText: string, MaxValue: number): null; + SysCmd(Action: AcSysCmdAction.acSysCmdUpdateMeter, CurrentValue: number): null; + SysCmd(Action: AcSysCmdAction.acSysCmdSetStatus, StatusText: string): null; + SysCmd(Action: AcSysCmdAction.acSysCmdGetObjectState, Argument2: AcObjectType, Argument3: string): Constants.acObjStateDirty | Constants.acObjStateNew | Constants.acObjStateOpen; + SysCmd(Acton: AcSysCmdAction.acSysCmdAccessDir | AcSysCmdAction.acSysCmdAccessVer | AcSysCmdAction.acSysCmdClearHelpTopic | AcSysCmdAction.acSysCmdClearStatus | AcSysCmdAction.acSysCmdGetWorkgroupFile | AcSysCmdAction.acSysCmdIniFile | AcSysCmdAction.acSysCmdProfile | AcSysCmdAction.acSysCmdRemoveMeter | AcSysCmdAction.acSysCmdRuntime): null; readonly TempVars: TempVars; /** - * @param boolean [WellFormedXMLOutput=false] - * @param Access.AcTransformXMLScriptOption [ScriptOption=1] + * @param WellFormedXMLOutput [WellFormedXMLOutput=false] + * @param ScriptOption [ScriptOption=1] */ TransformXML(DataSource: string, TransformSource: string, OutputTarget: string, WellFormedXMLOutput?: boolean, ScriptOption?: AcTransformXMLScriptOption): void; UserControl: boolean; @@ -3206,9 +3141,9 @@ declare namespace Access { Enabled: boolean; EventProcPrefix: string; FileData(var_0?: any): any; - FileName(var_0?: any): string; - FileType(var_0?: any): string; - FileURL(var_0?: any): string; + FileName(var_0?: number | string): string; + FileType(var_0?: number | string): string; + FileURL(var_0?: number | string): string; Forward(): void; Goto(): void; GridlineColor: number; @@ -3238,7 +3173,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: null): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -3390,7 +3325,7 @@ declare namespace Access { LeftPadding: number; Locked: boolean; LpOleObject: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectPalette: any; @@ -3533,7 +3468,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -3588,12 +3523,13 @@ declare namespace Access { Width: number; } - class Children { - private 'Access.Children_typekey': Children; - private constructor(); + interface Children { readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): any; + // tslint:disable-next-line:no-unnecessary-generics + Item(Index: number | string): T; + // tslint:disable-next-line:no-unnecessary-generics + (Index: number | string): T; } class Class { @@ -3604,12 +3540,12 @@ declare namespace Access { class CodeData { private 'Access.CodeData_typekey': CodeData; private constructor(); - readonly AllDatabaseDiagrams: AllDatabaseDiagrams; - readonly AllFunctions: AllFunctions; - readonly AllQueries: AllQueries; - readonly AllStoredProcedures: AllStoredProcedures; - readonly AllTables: AllTables; - readonly AllViews: AllViews; + readonly AllDatabaseDiagrams: AccessObjects; + readonly AllFunctions: AccessObjects; + readonly AllQueries: AccessObjects; + readonly AllStoredProcedures: AccessObjects; + readonly AllTables: AccessObjects; + readonly AllViews: AccessObjects; IsMemberSafe(dispid: number): boolean; } @@ -3618,11 +3554,11 @@ declare namespace Access { private constructor(); readonly AccessConnection: ADODB.Connection; AddSharedImage(SharedImageName: string, FileName: string): void; - readonly AllDataAccessPages: AllDataAccessPages; - readonly AllForms: AllForms; - readonly AllMacros: AllMacros; - readonly AllModules: AllModules; - readonly AllReports: AllReports; + readonly AllDataAccessPages: AccessObjects; + readonly AllForms: AccessObjects; + readonly AllMacros: AccessObjects; + readonly AllModules: AccessObjects; + readonly AllReports: AccessObjects; readonly Application: Application; readonly BaseConnectionString: string; CloseConnection(): void; @@ -3635,7 +3571,7 @@ declare namespace Access { readonly IsTrusted: boolean; readonly IsWeb: boolean; readonly Name: string; - OpenConnection(BaseConnectionString?: any, UserID?: any, Password?: any): void; + OpenConnection(BaseConnectionString?: string, UserID?: string, Password?: string): void; readonly Parent: any; readonly Path: string; readonly ProjectType: AcProjectType; @@ -3671,7 +3607,7 @@ declare namespace Access { accState(varChild?: any): any; accValue(varChild?: any): string; AddColon: boolean; - AddItem(Item: string, Index?: any): void; + AddItem(Item: string, Index?: number): void; AfterUpdate: string; AfterUpdateMacro: string; AllowAutoCorrect: boolean; @@ -3700,7 +3636,7 @@ declare namespace Access { CanGrow: boolean; CanShrink: boolean; Coltyp: number; - Column(Index: number, Row?: any): any; + Column(Index: number, Row?: number): any; ColumnCount: number; ColumnHeads: boolean; ColumnHidden: boolean; @@ -3777,7 +3713,7 @@ declare namespace Access { ListRows: number; ListWidth: string; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NumeralShapes: number; OldBorderStyle: number; @@ -3815,8 +3751,8 @@ declare namespace Access { readonly Parent: any; readonly Properties: Properties; ReadingOrder: number; - Recordset: any; - RemoveItem(Index: any): void; + Recordset: DAO.Recordset | ADODB.Recordset; + RemoveItem(Index: number | string): void; Requery(): void; RightMargin: number; RightPadding: number; @@ -3961,7 +3897,7 @@ declare namespace Access { readonly LayoutID: number; Left: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; ObjectPalette: any; readonly OldValue: any; @@ -4039,7 +3975,7 @@ declare namespace Access { _Name: string; readonly Application: Application; BottomPadding: number; - Column(Index: number, Row?: any): any; + Column(Index: number, Row?: number): any; readonly Controls: Children; Dropdown(): void; readonly Form: Form; @@ -4061,7 +3997,7 @@ declare namespace Access { readonly Layout: AcLayoutType; readonly LayoutID: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectVerbs(Index: number): string; @@ -4081,27 +4017,26 @@ declare namespace Access { VerticalAnchor: AcVerticalAnchor; } - class Controls { - private 'Access.Controls_typekey': Controls; - private constructor(); + interface Controls { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; // tslint:disable-next-line:no-unnecessary-generics - Item(index: number | string): T; - Item(Index: number | string): Control; + Item(Index: number | string): T; readonly Parent: any; + // tslint:disable-next-line:no-unnecessary-generics + (Index: number | string): T; } class CurrentData { private 'Access.CurrentData_typekey': CurrentData; private constructor(); - readonly AllDatabaseDiagrams: AllDatabaseDiagrams; - readonly AllFunctions: AllFunctions; - readonly AllQueries: AllQueries; - readonly AllStoredProcedures: AllStoredProcedures; - readonly AllTables: AllTables; - readonly AllViews: AllViews; + readonly AllDatabaseDiagrams: AccessObjects; + readonly AllFunctions: AccessObjects; + readonly AllQueries: AccessObjects; + readonly AllStoredProcedures: AccessObjects; + readonly AllTables: AccessObjects; + readonly AllViews: AccessObjects; IsMemberSafe(dispid: number): boolean; } @@ -4110,11 +4045,11 @@ declare namespace Access { private constructor(); readonly AccessConnection: ADODB.Connection; AddSharedImage(SharedImageName: string, FileName: string): void; - readonly AllDataAccessPages: AllDataAccessPages; - readonly AllForms: AllForms; - readonly AllMacros: AllMacros; - readonly AllModules: AllModules; - readonly AllReports: AllReports; + readonly AllDataAccessPages: AccessObjects; + readonly AllForms: AccessObjects; + readonly AllMacros: AccessObjects; + readonly AllModules: AccessObjects; + readonly AllReports: AccessObjects; readonly Application: Application; readonly BaseConnectionString: string; CloseConnection(): void; @@ -4127,7 +4062,7 @@ declare namespace Access { readonly IsTrusted: boolean; readonly IsWeb: boolean; readonly Name: string; - OpenConnection(BaseConnectionString?: any, UserID?: any, Password?: any): void; + OpenConnection(BaseConnectionString?: string, UserID?: string, Password?: string): void; readonly Parent: any; readonly Path: string; readonly ProjectType: AcProjectType; @@ -4206,7 +4141,7 @@ declare namespace Access { LeftPadding: number; Locked: boolean; LpOleObject: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectPalette: any; @@ -4271,14 +4206,13 @@ declare namespace Access { readonly WindowWidth: number; } - class DataAccessPages { - private 'Access.DataAccessPages_typekey': DataAccessPages; - private constructor(); + interface DataAccessPages { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): DataAccessPage; readonly Parent: any; + (var_0: any): DataAccessPage; } class DefaultWebOptions { @@ -4313,192 +4247,231 @@ declare namespace Access { readonly UnsupportedObjects: DependencyObjects; } - class DependencyObjects { - private 'Access.DependencyObjects_typekey': DependencyObjects; - private constructor(); + interface DependencyObjects { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): AccessObject; + Item(Index: number | string): AccessObject; readonly Parent: any; + (Index: number | string): AccessObject; } class DoCmd { private 'Access.DoCmd_typekey': DoCmd; private constructor(); - AddMenu(MenuName: any, MenuMacroName: any, StatusBarText?: any): void; - ApplyFilter(FilterName?: any, WhereCondition?: any, ControlName?: any): void; - ApplyFilterOld0(FilterName?: any, WhereCondition?: any): void; + AddMenu(MenuName: string, MenuMacroName: string, StatusBarText?: string): void; + ApplyFilter(FilterName?: string, WhereCondition?: string, ControlName?: any): void; + ApplyFilterOld0(FilterName?: string, WhereCondition?: string): void; Beep(): void; - /** @param Access.AcFormOpenDataMode [DataMode=1] */ - BrowseTo(ObjectType: AcBrowseToObjectType, ObjectName: any, PathtoSubformControl: any, WhereCondition: any, Page: any, DataMode?: AcFormOpenDataMode): void; + /** @param DataMode [DataMode=1] */ + BrowseTo(ObjectType: AcBrowseToObjectType, ObjectName: string, PathtoSubformControl?: string, WhereCondition?: string, Page?: string, DataMode?: AcFormOpenDataMode): void; CancelEvent(): void; ClearMacroError(): void; /** - * @param Access.AcObjectType [ObjectType=-1] - * @param Access.AcCloseSave [Save=0] + * @param ObjectType [ObjectType=-1] + * @param Save [Save=0] */ - Close(ObjectType: AcObjectType, ObjectName: any, Save?: AcCloseSave): void; + Close(ObjectType: AcObjectType, ObjectName: string, Save?: AcCloseSave): void; Close(): void; CloseDatabase(): void; - CopyDatabaseFile(DatabaseFileName: any, OverwriteExistingFile?: any, DisconnectAllUsers?: any): void; + CopyDatabaseFile(DatabaseFileName: string, OverwriteExistingFile?: boolean, DisconnectAllUsers?: boolean): void; - /** @param Access.AcObjectType [SourceObjectType=-1] */ - CopyObject(DestinationDatabase: any, NewName: any, SourceObjectType?: AcObjectType, SourceObjectName?: any): void; + /** @param SourceObjectType [SourceObjectType=-1] */ + CopyObject(DestinationDatabase: string, NewName: string, SourceObjectType?: AcObjectType, SourceObjectName?: string): void; - /** @param Access.AcObjectType [ObjectType=-1] */ - DeleteObject(ObjectType?: AcObjectType, ObjectName?: any): void; - DoMenuItem(MenuBar: any, MenuName: any, Command: any, Subcommand?: any, Version?: any): void; - Echo(EchoOn: any, StatusBarText?: any): void; + /** @param ObjectType [ObjectType=-1] */ + DeleteObject(ObjectType?: AcObjectType, ObjectName?: string): void; + + /** @deprecated Use the **RunCommand** method */ + DoMenuItem(MenuBar: Constants.acFormBar | number, MenuName: Constants.acFile | Constants.acEditMenu | Constants.acRecordsMenu | number, Command: Constants.acNew | Constants.acSaveForm | Constants.acSaveFormAs | Constants.acSaveRecord | Constants.acUndo | Constants.acCut | Constants.acCopy | Constants.acPaste | Constants.acDelete | Constants.acSelectRecord | Constants.acSelectAllRecords | Constants.acRefresh | number, Subcommand?: Constants.acObjectVerb | Constants.acObjectUpdate | number, Version?: Constants.acMenuVer70 | Constants.acMenuVer20 | Constants.acMenuVer1X): void; + Echo(EchoOn: boolean, StatusBarText?: string): void; FindNext(): void; /** - * @param Access.AcFindMatch [Match=1] - * @param Access.AcSearchDirection [Search=2] - * @param Access.AcFindField [OnlyCurrentField=-1] + * @param Match [Match=1] + * @param MatchCase [MatchCase=false] + * @param Search [Search=2] + * @param SearchAsFormatted [SearchAsFormatted=false] + * @param OnlyCurrentField [OnlyCurrentField=-1] */ - FindRecord(FindWhat: any, Match?: AcFindMatch, MatchCase?: any, Search?: AcSearchDirection, SearchAsFormatted?: any, OnlyCurrentField?: AcFindField, FindFirst?: any): void; - GoToControl(ControlName: any): void; - GoToPage(PageNumber: any, Right?: any, Down?: any): void; + FindRecord(FindWhat: string | number | VarDate, Match?: AcFindMatch, MatchCase?: boolean, Search?: AcSearchDirection, SearchAsFormatted?: boolean, OnlyCurrentField?: AcFindField, FindFirst?: boolean): void; + GoToControl(ControlName: string): void; + GoToPage(PageNumber: number, Right?: number, Down?: number): void; /** - * @param Access.AcDataObjectType [ObjectType=-1] - * @param Access.AcRecord [Record=1] + * @param ObjectType [ObjectType=-1] + * @param Record [Record=1] */ - GoToRecord(ObjectType?: AcDataObjectType, ObjectName?: any, Record?: AcRecord, Offset?: any): void; - Hourglass(HourglassOn: any): void; - LockNavigationPane(Lock: any): void; + GoToRecord(ObjectType?: AcDataObjectType, ObjectName?: string, Record?: AcRecord.acFirst | AcRecord.acLast | AcRecord.acNewRec): void; + + /** + * @param ObjectType [ObjectType=-1] + * @param Record [Record=1] + */ + GoToRecord(ObjectType?: AcDataObjectType, ObjectName?: string, Record?: AcRecord, Offset?: AcRecord.acNext | AcRecord.acPrevious | AcRecord.acGoTo): void; + Hourglass(HourglassOn: boolean): void; + LockNavigationPane(Lock: boolean): void; Maximize(): void; Minimize(): void; - MoveSize(Right?: any, Down?: any, Width?: any, Height?: any): void; + MoveSize(Right?: number, Down?: number, Width?: number, Height?: number): void; NavigateTo(Category?: any, Group?: any): void; - /** @param Access.AcDataAccessPageView [View=0] */ - OpenDataAccessPage(DataAccessPageName: any, View?: AcDataAccessPageView): void; - OpenDiagram(DiagramName: any): void; + /** @param View [View=0] */ + OpenDataAccessPage(DataAccessPageName: string, View?: AcDataAccessPageView): void; + OpenDiagram(DiagramName: string): void; /** - * @param Access.AcFormView [View=0] - * @param Access.AcFormOpenDataMode [DataMode=-1] - * @param Access.AcWindowMode [WindowMode=0] + * @param View [View=0] + * @param DataMode [DataMode=-1] + * @param WindowMode [WindowMode=0] */ - OpenForm(FormName: any, View?: AcFormView, FilterName?: string, WhereCondition?: string, DataMode?: AcFormOpenDataMode, WindowMode?: AcWindowMode, OpenArgs?: string): void; + OpenForm(FormName: string, View?: AcFormView, FilterName?: string, WhereCondition?: string, DataMode?: AcFormOpenDataMode, WindowMode?: AcWindowMode, OpenArgs?: string): void; /** - * @param Access.AcView [View=0] - * @param Access.AcOpenDataMode [DataMode=1] + * @param View [View=0] + * @param DataMode [DataMode=1] */ - OpenFunction(FunctionName: any, View?: AcView, DataMode?: AcOpenDataMode): void; - OpenModule(ModuleName?: any, ProcedureName?: any): void; + OpenFunction(FunctionName: string, View?: AcView, DataMode?: AcOpenDataMode): void; + OpenModule(ModuleName?: string, ProcedureName?: string): void; /** - * @param Access.AcView [View=0] - * @param Access.AcOpenDataMode [DataMode=1] + * @param View [View=0] + * @param DataMode [DataMode=1] */ - OpenQuery(QueryName: any, View?: AcView, DataMode?: AcOpenDataMode): void; + OpenQuery(QueryName: string, View?: AcView, DataMode?: AcOpenDataMode): void; /** - * @param Access.AcView [View=0] - * @param Access.AcWindowMode [WindowMode=0] + * @param View [View=0] + * @param WindowMode [WindowMode=0] */ - OpenReport(ReportName: any, View?: AcView, FilterName?: string, WhereCondition?: string, WindowMode?: AcWindowMode, OpenArgs?: string): void; + OpenReport(ReportName: string, View?: AcView, FilterName?: string, WhereCondition?: string, WindowMode?: AcWindowMode, OpenArgs?: string): void; - /** @param Access.AcView [View=0] */ + /** @param View [View=0] */ OpenReportOld0(ReportName: any, View?: AcView, FilterName?: any, WhereCondition?: any): void; /** - * @param Access.AcView [View=0] - * @param Access.AcOpenDataMode [DataMode=1] + * @param View [View=0] + * @param DataMode [DataMode=1] */ - OpenStoredProcedure(ProcedureName: any, View?: AcView, DataMode?: AcOpenDataMode): void; + OpenStoredProcedure(ProcedureName: string, View?: AcView, DataMode?: AcOpenDataMode): void; /** - * @param Access.AcView [View=0] - * @param Access.AcOpenDataMode [DataMode=1] + * @param View [View=0] + * @param DataMode [DataMode=1] */ - OpenTable(TableName: any, View?: AcView, DataMode?: AcOpenDataMode): void; + OpenTable(TableName: string, View?: AcView, DataMode?: AcOpenDataMode): void; /** - * @param Access.AcView [View=0] - * @param Access.AcOpenDataMode [DataMode=1] + * @param View [View=0] + * @param DataMode [DataMode=1] */ - OpenView(ViewName: any, View?: AcView, DataMode?: AcOpenDataMode): void; + OpenView(ViewName: string, View?: AcView, DataMode?: AcOpenDataMode): void; - /** @param Access.AcExportQuality [OutputQuality=0] */ - OutputTo(ObjectType: AcOutputObjectType, ObjectName: any, OutputFormat: any, OutputFile: any, AutoStart: any, TemplateFile: any, Encoding: any, OutputQuality?: AcExportQuality): void; + /** @param OutputQuality [OutputQuality=0] */ + OutputTo(ObjectType: AcOutputObjectType.acOutputModule, ObjectName: string, OutputFormat: AcOutputFormat.acFormatTXT, OutputFile: string, AutoStart: boolean, TemplateFile: string, Encoding: any, OutputQuality?: AcExportQuality): void; + + /** @param OutputQuality [OutputQuality=0] */ + OutputTo(ObjectType: AcOutputObjectType, ObjectName?: string, OutputFormat?: AcOutputFormat, OutputFile?: string, AutoStart?: boolean, TemplateFile?: string, Encoding?: any, OutputQuality?: AcExportQuality): void; OutputToOld0(ObjectType: AcOutputObjectType, ObjectName?: any, OutputFormat?: any, OutputFile?: any, AutoStart?: any, TemplateFile?: any): void; OutputToOld1(ObjectType: AcOutputObjectType, ObjectName?: any, OutputFormat?: any, OutputFile?: any, AutoStart?: any, TemplateFile?: any, Encoding?: any): void; /** - * @param Access.AcPrintRange [PrintRange=0] - * @param Access.AcPrintQuality [PrintQuality=0] + * @param PrintRange [PrintRange=0] + * @param PrintQuality [PrintQuality=0] + * @param Copies [Copies=1] + * @param CollateCopies [CollateCopies=true] */ - PrintOut(PrintRange?: AcPrintRange, PageFrom?: any, PageTo?: any, PrintQuality?: AcPrintQuality, Copies?: any, CollateCopies?: any): void; + PrintOut(PrintRange: AcPrintRange.acPages, PageFrom?: number, PageTo?: number, PrintQuality?: AcPrintQuality, Copies?: number, CollateCopies?: boolean): void; - /** @param Access.AcQuitOption [Options=1] */ + /** + * @param PrintRange [PrintRange=0] + * @param PrintQuality [PrintQuality=0] + * @param Copies [Copies=1] + * @param CollateCopies [CollateCopies=true] + */ + PrintOut(PrintRange?: AcPrintRange, PageFrom?: undefined, PageTo?: undefined, PrintQuality?: AcPrintQuality, Copies?: number, CollateCopies?: boolean): void; + + /** @param Options [Options=1] */ Quit(Options?: AcQuitOption): void; RefreshRecord(): void; - /** @param Access.AcObjectType [ObjectType=-1] */ - Rename(NewName: any, ObjectType?: AcObjectType, OldName?: any): void; + /** @param ObjectType [ObjectType=-1] */ + Rename(NewName: string, ObjectType: AcObjectType, OldName: string): void; + Rename(NewName: string): void; - /** @param Access.AcObjectType [ObjectType=-1] */ - RepaintObject(ObjectType?: AcObjectType, ObjectName?: any): void; - Requery(ControlName?: any): void; + /** @param ObjectType [ObjectType=-1] */ + RepaintObject(ObjectType: AcObjectType, ObjectName: string): void; + RepaintObject(): void; + + Requery(ControlName?: string): void; Restore(): void; RunCommand(Command: AcCommand): void; - RunDataMacro(MacroName: any): void; - RunMacro(MacroName: any, RepeatCount?: any, RepeatExpression?: any): void; - RunSavedImportExport(SavedImportExportName: any): void; - RunSQL(SQLStatement: any, UseTransaction?: any): void; + RunDataMacro(MacroName: string): void; + RunMacro(MacroName: string, RepeatCount?: number, RepeatExpression?: string): void; + RunSavedImportExport(SavedImportExportName: string): void; + RunSQL(SQLStatement: string, UseTransaction?: boolean): void; - /** @param Access.AcObjectType [ObjectType=-1] */ - Save(ObjectType?: AcObjectType, ObjectName?: any): void; + /** @param ObjectType [ObjectType=-1] */ + Save(ObjectType: AcObjectType | undefined, ObjectName: string): void; + Save(): void; /** - * @param Access.AcDataObjectType [ObjectType=-1] - * @param Access.AcRecord [Record=2] + * @param ObjectType [ObjectType=-1] + * @param Record [Record=2] */ - SearchForRecord(ObjectType?: AcDataObjectType, ObjectName?: any, Record?: AcRecord, WhereCondition?: any): void; - SelectObject(ObjectType: AcObjectType, ObjectName?: any, InDatabaseWindow?: any): void; + SearchForRecord(ObjectType?: AcDataObjectType, ObjectName?: string, Record?: AcRecord, WhereCondition?: string): void; + SelectObject(ObjectType: AcObjectType, ObjectName: string | undefined, InDatabaseWindow: true): void; + SelectObject(ObjectType: AcObjectType, ObjectName: string): void; - /** @param Access.AcSendObjectType [ObjectType=-1] */ - SendObject( - ObjectType?: AcSendObjectType, ObjectName?: any, OutputFormat?: any, To?: any, Cc?: any, Bcc?: any, Subject?: any, MessageText?: any, EditMessage?: any, TemplateFile?: any): void; - SetDisplayedCategories(Show: any, Category?: any): void; - SetFilter(FilterName?: any, WhereCondition?: any, ControlName?: any): void; - SetMenuItem(MenuIndex: any, CommandIndex?: any, SubcommandIndex?: any, Flag?: any): void; - SetOrderBy(OrderBy: any, ControlName?: any): void; - SetParameter(Name: any, Expression: any): void; + /** @param ObjectType [ObjectType=-1] */ + SendObject(ObjectType?: AcSendObjectType, ObjectName?: string, OutputFormat?: AcOutputFormat, To?: string, Cc?: string, Bcc?: string, Subject?: string, MessageText?: string, EditMessage?: boolean, TemplateFile?: string): void; + SetDisplayedCategories(Show: boolean, Category?: string): void; + SetFilter(FilterName?: string, WhereCondition?: string, ControlName?: string): void; + SetMenuItem(MenuIndex: number, CommandIndex?: number, SubcommandIndex?: number, Flag?: AcSetMenuItemState): void; + SetOrderBy(OrderBy: string, ControlName?: string): void; + SetParameter(Name: string, Expression: any): void; - /** @param Access.AcProperty [Property=0] */ - SetProperty(ControlName: any, Property?: AcProperty, Value?: any): void; - SetWarnings(WarningsOn: any): void; + /** @param Property [Property=0] */ + SetProperty(ControlName: string, Property?: AcProperty, Value?: any): void; + SetWarnings(WarningsOn: boolean): void; ShowAllRecords(): void; - /** @param Access.AcShowToolbar [Show=0] */ - ShowToolbar(ToolbarName: any, Show?: AcShowToolbar): void; + /** @param Show [Show=0] */ + ShowToolbar(ToolbarName: string, Show?: AcShowToolbar): void; SingleStep(): void; /** - * @param Access.AcDataTransferType [TransferType=0] - * @param Access.AcObjectType [ObjectType=0] + * @param TransferType [TransferType=0] + * @param ObjectType [ObjectType=0] + * @param StructureOnly [StructureOnly=false\] + * @param StoreLogin [StoreLogin=false] */ - TransferDatabase( - TransferType?: AcDataTransferType, DatabaseType?: any, DatabaseName?: any, ObjectType?: AcObjectType, Source?: any, Destination?: any, StructureOnly?: any, StoreLogin?: any): void; - TransferSharePointList(TransferType: AcSharePointListTransferType, SiteAddress: any, ListID: any, ViewID?: any, TableName?: any, GetLookupDisplayValues?: any): void; + TransferDatabase(TransferType?: AcDataTransferType, DatabaseType?: DatabaseType, DatabaseName?: string, ObjectType?: AcObjectType, Source?: string, Destination?: string, StructureOnly?: boolean, StoreLogin?: boolean): void; + TransferSharePointList(TransferType: AcSharePointListTransferType, SiteAddress: string, ListID: string, ViewID?: string, TableName?: string, GetLookupDisplayValues?: boolean): void; /** - * @param Access.AcDataTransferType [TransferType=0] - * @param Access.AcSpreadSheetType [SpreadsheetType=10] + * @param TransferType [TransferType=0] + * @param SpreadsheetType [SpreadsheetType=10] + * @param HasFieldNames [HasFieldNames=false] */ - TransferSpreadsheet(TransferType?: AcDataTransferType, SpreadsheetType?: AcSpreadSheetType, TableName?: any, FileName?: any, HasFieldNames?: any, Range?: any, UseOA?: any): void; - TransferSQLDatabase(Server: any, Database: any, UseTrustedConnection?: any, Login?: any, Password?: any, TransferCopyData?: any): void; + TransferSpreadsheet(TransferType: AcDataTransferType.acImport, SpreadsheetType?: AcSpreadSheetType, TableName?: string, FileName?: string, HasFieldNames?: boolean, Range?: any): void; - /** @param Access.AcTextTransferType [TransferType=0] */ - TransferText(TransferType?: AcTextTransferType, SpecificationName?: any, TableName?: any, FileName?: any, HasFieldNames?: any, HTMLTableName?: any, CodePage?: any): void; + /** + * @param TransferType [TransferType=0] + * @param SpreadsheetType [SpreadsheetType=10] + * @param HasFieldNames [HasFieldNames=false] + */ + TransferSpreadsheet(TransferType?: AcDataTransferType, SpreadsheetType?: AcSpreadSheetType, TableName?: string, FileName?: string, HasFieldNames?: boolean): void; + TransferSQLDatabase(Server: string, Database: string, UseTrustedConnection?: boolean, Login?: string, Password?: string, TransferCopyData?: boolean): void; + + /** + * @param TransferType [TransferType=0] + * @param Encoding For valid values see https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx + */ + TransferText(TransferType?: AcTextTransferType.acExportHTML | AcTextTransferType.acImportHTML, SpecificationName?: string, TableName?: string, FileName?: string, HasFieldNames?: boolean, HTMLTableName?: string, CodePage?: number): void; + TransferText(TransferType?: AcTextTransferType, SpecificationName?: string, TableName?: string, FileName?: string, HasFieldNames?: boolean, HTMLTableName?: undefined, CodePage?: number): void; } class EmptyCell { @@ -4559,7 +4532,7 @@ declare namespace Access { readonly LayoutID: number; Left: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Parent: any; readonly Properties: Properties; @@ -4577,13 +4550,12 @@ declare namespace Access { Width: number; } - class Entities { - private 'Access.Entities_typekey': Entities; - private constructor(); + interface Entities { readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): Entity; readonly Parent: any; + (Index: any): Entity; } class Entity { @@ -4671,7 +4643,7 @@ declare namespace Access { BeforeUpdateMacro: string; BeginBatchEdit: string; BeginBatchEditMacro: string; - Bookmark: any; + Bookmark: ADODB.Bookmark | DAO.Bookmark; BorderStyle: number; Caption: string; readonly ChartSpace: any; @@ -4732,8 +4704,8 @@ declare namespace Access { FrozenColumns: number; /** - * @param number [Right=0] - * @param number [Down=0] + * @param Right [Right=0] + * @param Down [Down=0] */ GoToPage(PageNumber: number, Right?: number, Down?: number): void; GridX: number; @@ -4760,7 +4732,7 @@ declare namespace Access { readonly Module: Module; MouseWheel: string; MouseWheelMacro: string; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Moveable: boolean; Name: string; NavigationButtons: boolean; @@ -4824,7 +4796,7 @@ declare namespace Access { OnUndoMacro: string; OnUnload: string; OnUnloadMacro: string; - OpenArgs: any; + OpenArgs: string; OrderBy: string; OrderByOn: boolean; OrderByOnLoad: boolean; @@ -4856,8 +4828,8 @@ declare namespace Access { Recalc(): void; RecordLocks: number; RecordSelectors: boolean; - Recordset: any; - readonly RecordsetClone: any; + Recordset: DAO.Recordset | ADODB.Recordset | null; + readonly RecordsetClone: DAO.Recordset | ADODB.Recordset; RecordsetType: number; RecordSource: string; RecordSourceQualifier: string; @@ -4870,7 +4842,7 @@ declare namespace Access { RollbackTransactionMacro: string; RowHeight: number; ScrollBars: number; - Section(Index: any): Section; + Section(Index: AcFormSection | string): Section; SectionOld(Index: any): Section; SelectionChange: string; SelectionChangeMacro: string; @@ -4932,8 +4904,15 @@ declare namespace Access { LongestBarLimit: AcFormatBarLimits; LongestBarValue: string; - /** @param Access.AcFormatConditionOperator [Operator=0] */ - Modify(Type: AcFormatConditionType, Operator?: AcFormatConditionOperator, Expression1?: any, Expression2?: any): void; + /** @param Operator [Operator=0] */ + Modify(Type: AcFormatConditionType.acExpression, Operator: undefined, Expression1: string | number | boolean): void; + + /** @param Operator [Operator=0] */ + Modify(Type: AcFormatConditionType, Operator: AcFormatConditionOperator.acBetween | AcFormatConditionOperator.acNotBetween, Expression1: string | number | boolean, Expression2: string | number | boolean): void; + + /** @param Operator [Operator=0] */ + Modify(Type: AcFormatConditionType, Operator?: AcFormatConditionOperator, Expression1?: string | number | boolean): void; + readonly Operator: AcFormatConditionOperator; ShortestBarLimit: AcFormatBarLimits; ShortestBarValue: string; @@ -4941,475 +4920,32 @@ declare namespace Access { readonly Type: AcFormatConditionType; } - class FormatConditions { - private 'Access.FormatConditions_typekey': FormatConditions; - private constructor(); + interface FormatConditions { + /** @param Operator [Operator=0] */ + Add(Type: AcFormatConditionType.acExpression, Operator: undefined, Expression1: string | number | boolean): FormatCondition; + + /** @param Operator [Operator=0] */ + Add(Type: AcFormatConditionType, Operator: AcFormatConditionOperator.acBetween | AcFormatConditionOperator.acNotBetween, Expression1: string | number | boolean, Expression2: string | number | boolean): FormatCondition; + + /** @param Operator [Operator=0] */ + Add(Type: AcFormatConditionType, Operator?: AcFormatConditionOperator, Expression1?: string | number | boolean): FormatCondition; - /** @param Access.AcFormatConditionOperator [Operator=0] */ - Add(Type: AcFormatConditionType, Operator?: AcFormatConditionOperator, Expression1?: any, Expression2?: any): FormatCondition; readonly Application: Application; readonly Count: number; Delete(): void; IsMemberSafe(dispid: number): boolean; - Item(Index: any): FormatCondition; + Item(Index: number): FormatCondition; readonly Parent: any; + (Index: number): FormatCondition; } - class FormOld { - private 'Access.FormOld_typekey': FormOld; - private constructor(); - _Evaluate(bstrExpr: string, ...ppsa: any[]): any; - _Name: string; - accChild(varChild: any): any; - readonly accChildCount: number; - accDefaultAction(varChild?: any): string; - accDescription(varChild?: any): string; - accDoDefaultAction(varChild?: any): void; - readonly accFocus: any; - accHelp(varChild?: any): string; - accHelpTopic(pszHelpFile: string, varChild?: any): number; - accHitTest(xLeft: number, yTop: number): any; - accKeyboardShortcut(varChild?: any): string; - accLocation(pxLeft: number, pyTop: number, pcxWidth: number, pcyHeight: number, varChild?: any): void; - accName(varChild?: any): string; - accNavigate(navDir: number, varStart?: any): any; - readonly accParent: any; - accRole(varChild?: any): any; - accSelect(flagsSelect: number, varChild?: any): void; - readonly accSelection: any; - accState(varChild?: any): any; - accValue(varChild?: any): string; - acHiddenCurrentPage: number; - readonly ActiveControl: Control; - AfterDelConfirm: string; - AfterInsert: string; - AfterUpdate: string; - AllowAdditions: boolean; - AllowDeletions: boolean; - AllowDesignChanges: boolean; - AllowEditing: boolean; - AllowEdits: boolean; - AllowFilters: boolean; - AllowUpdating: number; - readonly Application: Application; - AutoCenter: boolean; - AutoResize: boolean; - BeforeDelConfirm: string; - BeforeInsert: string; - BeforeUpdate: string; - Bookmark: any; - BorderStyle: number; - Caption: string; - CloseButton: boolean; - readonly ConnectControl: Control; - ConnectSynch: number; - ControlBox: boolean; - readonly Controls: Controls; - Count: number; - CurrentRecord: number; - CurrentSectionLeft: number; - CurrentSectionTop: number; - CurrentView: number; - Cycle: number; - DataEntry: boolean; - DatasheetBackColor: number; - DatasheetCellsEffect: number; - DatasheetFontHeight: number; - DatasheetFontItalic: boolean; - DatasheetFontName: string; - DatasheetFontUnderline: boolean; - DatasheetFontWeight: number; - DatasheetForeColor: number; - DatasheetGridlinesBehavior: number; - DatasheetGridlinesColor: number; - DefaultControl(ControlType: number): Control; - DefaultEditing: number; - DefaultView: number; - Dirty: boolean; - DividingLines: boolean; - readonly Dynaset: any; - FastLaserPrinting: boolean; - Filter: string; - FilterOn: boolean; - readonly Form: Form; - FormName: string; - FrozenColumns: number; - - /** - * @param number [Right=0] - * @param number [Down=0] - */ - GoToPage(PageNumber: number, Right?: number, Down?: number): void; - GridX: number; - GridY: number; - HasModule: boolean; - HelpContextId: number; - HelpFile: string; - Hwnd: number; - InputParameters: string; - InsideHeight: number; - InsideWidth: number; - KeyPreview: boolean; - LayoutForPrint: boolean; - LogicalPageHeight: number; - LogicalPageWidth: number; - MaxButton: boolean; - MaxRecButton: boolean; - MaxRecords: number; - MenuBar: string; - MinButton: boolean; - MinMaxButtons: number; - Modal: boolean; - readonly Module: Module; - Name: string; - NavigationButtons: boolean; - readonly NewRecord: number; - OnActivate: string; - OnApplyFilter: string; - OnClick: string; - OnClose: string; - OnCurrent: string; - OnDblClick: string; - OnDeactivate: string; - OnDelete: string; - OnDirty: string; - OnError: string; - OnFilter: string; - OnGotFocus: string; - OnInsert: string; - OnKeyDown: string; - OnKeyPress: string; - OnKeyUp: string; - OnLoad: string; - OnLostFocus: string; - OnMenu: string; - OnMouseDown: string; - OnMouseMove: string; - OnMouseUp: string; - OnOpen: string; - OnResize: string; - OnTimer: string; - OnUnload: string; - OpenArgs: any; - OrderBy: string; - OrderByOn: boolean; - Orientation: number; - Page: number; - Pages: number; - Painting: boolean; - PaintPalette: any; - PaletteSource: string; - readonly Parent: any; - Picture: string; - PictureAlignment: number; - PictureData: any; - PicturePalette: any; - PictureSizeMode: number; - PictureTiling: boolean; - PictureType: number; - PopUp: boolean; - readonly Properties: Properties; - PrtDevMode: any; - PrtDevNames: any; - PrtMip: any; - Recalc(): void; - RecordLocks: number; - RecordSelectors: boolean; - Recordset: any; - readonly RecordsetClone: any; - RecordsetType: number; - RecordSource: string; - Refresh(): void; - Repaint(): void; - Requery(): void; - ResyncCommand: string; - RowHeight: number; - ScrollBars: number; - Section(Index: any): Section; - SelHeight: number; - SelLeft: number; - SelTop: number; - SelWidth: number; - ServerFilter: string; - ServerFilterByForm: boolean; - SetFocus(): void; - ShortcutMenu: boolean; - ShortcutMenuBar: string; - ShowGrid: boolean; - SubdatasheetExpanded: boolean; - SubdatasheetHeight: number; - TabularCharSet: number; - TabularFamily: number; - Tag: string; - TimerInterval: number; - Toolbar: string; - Undo(): void; - UniqueTable: string; - ViewsAllowed: number; - Visible: boolean; - WhatsThisButton: boolean; - Width: number; - WindowHeight: number; - WindowWidth: number; - ZoomControl: number; - } - - class FormOldV10 { - private 'Access.FormOldV10_typekey': FormOldV10; - private constructor(); - _Evaluate(bstrExpr: string, ...ppsa: any[]): any; - _Name: string; - accChild(varChild: any): any; - readonly accChildCount: number; - accDefaultAction(varChild?: any): string; - accDescription(varChild?: any): string; - accDoDefaultAction(varChild?: any): void; - readonly accFocus: any; - accHelp(varChild?: any): string; - accHelpTopic(pszHelpFile: string, varChild?: any): number; - accHitTest(xLeft: number, yTop: number): any; - accKeyboardShortcut(varChild?: any): string; - accLocation(pxLeft: number, pyTop: number, pcxWidth: number, pcyHeight: number, varChild?: any): void; - accName(varChild?: any): string; - accNavigate(navDir: number, varStart?: any): any; - readonly accParent: any; - accRole(varChild?: any): any; - accSelect(flagsSelect: number, varChild?: any): void; - readonly accSelection: any; - accState(varChild?: any): any; - accValue(varChild?: any): string; - acHiddenCurrentPage: number; - readonly ActiveControl: Control; - AfterBeginTransaction: string; - AfterCommitTransaction: string; - AfterDelConfirm: string; - AfterFinalRender: string; - AfterInsert: string; - AfterLayout: string; - AfterRender: string; - AfterUpdate: string; - AllowAdditions: boolean; - AllowDatasheetView: boolean; - AllowDeletions: boolean; - AllowDesignChanges: boolean; - AllowEditing: boolean; - AllowEdits: boolean; - AllowFilters: boolean; - AllowFormView: boolean; - AllowPivotChartView: boolean; - AllowPivotTableView: boolean; - AllowUpdating: number; - readonly Application: Application; - AutoCenter: boolean; - AutoResize: boolean; - BatchUpdates: boolean; - BeforeBeginTransaction: string; - BeforeCommitTransaction: string; - BeforeDelConfirm: string; - BeforeInsert: string; - BeforeQuery: string; - BeforeRender: string; - BeforeScreenTip: string; - BeforeUpdate: string; - BeginBatchEdit: string; - Bookmark: any; - BorderStyle: number; - Caption: string; - readonly ChartSpace: any; - CloseButton: boolean; - CommandBeforeExecute: string; - CommandChecked: string; - CommandEnabled: string; - CommandExecute: string; - CommitOnClose: number; - CommitOnNavigation: boolean; - readonly ConnectControl: Control; - ConnectSynch: number; - ControlBox: boolean; - readonly Controls: Controls; - Count: number; - CurrentRecord: number; - CurrentSectionLeft: number; - CurrentSectionTop: number; - CurrentView: number; - Cycle: number; - DataChange: string; - DataEntry: boolean; - DataSetChange: string; - DatasheetBackColor: number; - DatasheetBorderLineStyle: number; - DatasheetCellsEffect: number; - DatasheetColumnHeaderUnderlineStyle: number; - DatasheetFontHeight: number; - DatasheetFontItalic: boolean; - DatasheetFontName: string; - DatasheetFontUnderline: boolean; - DatasheetFontWeight: number; - DatasheetForeColor: number; - DatasheetGridlinesBehavior: number; - DatasheetGridlinesColor: number; - DefaultControl(ControlType: number): Control; - DefaultEditing: number; - DefaultView: number; - Dirty: boolean; - DividingLines: boolean; - readonly Dynaset: any; - FastLaserPrinting: boolean; - FetchDefaults: boolean; - Filter: string; - FilterOn: boolean; - readonly Form: Form; - FormName: string; - FrozenColumns: number; - - /** - * @param number [Right=0] - * @param number [Down=0] - */ - GoToPage(PageNumber: number, Right?: number, Down?: number): void; - GridX: number; - GridY: number; - HasModule: boolean; - HelpContextId: number; - HelpFile: string; - HorizontalDatasheetGridlineStyle: number; - Hwnd: number; - InputParameters: string; - InsideHeight: number; - InsideWidth: number; - KeyPreview: boolean; - LayoutForPrint: boolean; - LogicalPageHeight: number; - LogicalPageWidth: number; - MaxButton: boolean; - MaxRecButton: boolean; - MaxRecords: number; - MenuBar: string; - MinButton: boolean; - MinMaxButtons: number; - Modal: boolean; - readonly Module: Module; - MouseWheel: string; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; - Moveable: boolean; - Name: string; - NavigationButtons: boolean; - readonly NewRecord: number; - OnActivate: string; - OnApplyFilter: string; - OnClick: string; - OnClose: string; - OnConnect: string; - OnCurrent: string; - OnDblClick: string; - OnDeactivate: string; - OnDelete: string; - OnDirty: string; - OnDisconnect: string; - OnError: string; - OnFilter: string; - OnGotFocus: string; - OnInsert: string; - OnKeyDown: string; - OnKeyPress: string; - OnKeyUp: string; - OnLoad: string; - OnLostFocus: string; - OnMenu: string; - OnMouseDown: string; - OnMouseMove: string; - OnMouseUp: string; - OnOpen: string; - OnRecordExit: string; - OnResize: string; - OnTimer: string; - OnUndo: string; - OnUnload: string; - OpenArgs: any; - OrderBy: string; - OrderByOn: boolean; - Orientation: number; - Page: number; - Pages: number; - Painting: boolean; - PaintPalette: any; - PaletteSource: string; - readonly Parent: any; - Picture: string; - PictureAlignment: number; - PictureData: any; - PicturePalette: any; - PictureSizeMode: number; - PictureTiling: boolean; - PictureType: number; - readonly PivotTable: any; - PivotTableChange: string; - PopUp: boolean; - Printer: Printer; - readonly Properties: Properties; - PrtDevMode: any; - PrtDevNames: any; - PrtMip: any; - Query: string; - Recalc(): void; - RecordLocks: number; - RecordSelectors: boolean; - Recordset: any; - readonly RecordsetClone: any; - RecordsetType: number; - RecordSource: string; - RecordSourceQualifier: string; - Refresh(): void; - Repaint(): void; - Requery(): void; - ResyncCommand: string; - RollbackTransaction: string; - RowHeight: number; - ScrollBars: number; - Section(Index: any): Section; - SelectionChange: string; - SelHeight: number; - SelLeft: number; - SelTop: number; - SelWidth: number; - ServerFilter: string; - ServerFilterByForm: boolean; - SetFocus(): void; - ShortcutMenu: boolean; - ShortcutMenuBar: string; - ShowGrid: boolean; - SubdatasheetExpanded: boolean; - SubdatasheetHeight: number; - TabularCharSet: number; - TabularFamily: number; - Tag: string; - TimerInterval: number; - Toolbar: string; - Undo(): void; - UndoBatchEdit: string; - UniqueTable: string; - UseDefaultPrinter: boolean; - VerticalDatasheetGridlineStyle: number; - ViewChange: string; - ViewsAllowed: number; - Visible: boolean; - WhatsThisButton: boolean; - Width: number; - WindowHeight: number; - readonly WindowLeft: number; - readonly WindowTop: number; - WindowWidth: number; - ZoomControl: number; - } - - class Forms { - private 'Access.Forms_typekey': Forms; - private constructor(); + interface Forms { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: number | string): Form; readonly Parent: any; + (Index: number | string): Form; } class GroupLevel { @@ -5437,10 +4973,10 @@ declare namespace Access { EmailSubject: string; /** - * @param boolean [NewWindow=false] - * @param boolean [AddHistory=true] - * @param Office.MsoExtraInfoMethod [Method=0] - * @param string [HeaderInfo=''] + * @param NewWindow [NewWindow=false] + * @param AddHistory [AddHistory=true] + * @param Method [Method=0] + * @param HeaderInfo [HeaderInfo=''] */ Follow(NewWindow?: boolean, AddHistory?: boolean, ExtraInfo?: any, Method?: Office.MsoExtraInfoMethod, HeaderInfo?: string): void; IsMemberSafe(dispid: number): boolean; @@ -5502,7 +5038,7 @@ declare namespace Access { readonly LayoutID: number; Left: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; ObjectPalette: any; OldBorderStyle: number; @@ -5547,22 +5083,22 @@ declare namespace Access { readonly Application: Application; Delete(): void; Description: string; - Execute(Prompt?: any): void; + Execute(Prompt?: boolean): void; IsMemberSafe(dispid: number): boolean; Name: string; readonly Parent: any; XML: string; } - class ImportExportSpecifications { - private 'Access.ImportExportSpecifications_typekey': ImportExportSpecifications; - private constructor(); + // tslint:disable-next-line:interface-name + interface ImportExportSpecifications { Add(Name: string, SpecificationDefinition: string): ImportExportSpecification; readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): ImportExportSpecification; + Item(Index: number | string): ImportExportSpecification; readonly Parent: any; + (Index: number | string): ImportExportSpecification; } class Label { @@ -5647,7 +5183,7 @@ declare namespace Access { LeftMargin: number; LeftPadding: number; LineSpacing: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NumeralShapes: number; OldBorderStyle: number; @@ -5709,7 +5245,7 @@ declare namespace Access { IsVisible: boolean; Left: number; LineSlant: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly Parent: any; @@ -5749,7 +5285,7 @@ declare namespace Access { accState(varChild?: any): any; accValue(varChild?: any): string; AddColon: boolean; - AddItem(Item: string, Index?: any): void; + AddItem(Item: string, Index?: number): void; AfterUpdate: string; AfterUpdateMacro: string; AllowValueListEdits: boolean; @@ -5770,7 +5306,7 @@ declare namespace Access { BorderWidth: number; BottomPadding: number; BoundColumn: number; - Column(Index: number, Row?: any): any; + Column(Index: number, Row?: number): any; ColumnCount: number; ColumnHeads: boolean; ColumnHidden: boolean; @@ -5834,7 +5370,7 @@ declare namespace Access { ListIndex: number; ListItemsEditForm: string; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; MultiSelect: number; Name: string; NumeralShapes: number; @@ -5867,8 +5403,8 @@ declare namespace Access { readonly Parent: any; readonly Properties: Properties; ReadingOrder: number; - Recordset: any; - RemoveItem(Index: any): void; + Recordset: DAO.Recordset | ADODB.Recordset; + RemoveItem(Index: number | string): void; Requery(): void; RightPadding: number; RowSource: string; @@ -5909,15 +5445,14 @@ declare namespace Access { Value: any; } - class LocalVars { - private 'Access.LocalVars_typekey': LocalVars; - private constructor(); + interface LocalVars { Add(Name: string, Value: any): void; readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): LocalVar; readonly Parent: any; + (Index: any): LocalVar; } class MacroError { @@ -5944,9 +5479,9 @@ declare namespace Access { DeleteLines(StartLine: number, Count: number): void; /** - * @param boolean [WholeWord=false] - * @param boolean [MatchCase=false] - * @param boolean [PatternSearch=false] + * @param WholeWord [WholeWord=false] + * @param MatchCase [MatchCase=false] + * @param PatternSearch [PatternSearch=false] */ Find(Target: string, StartLine: number, StartColumn: number, EndLine: number, EndColumn: number, WholeWord?: boolean, MatchCase?: boolean, PatternSearch?: boolean): boolean; InsertLines(Line: number, String: string): void; @@ -5963,14 +5498,13 @@ declare namespace Access { readonly Type: AcModuleType; } - class Modules { - private 'Access.Modules_typekey': Modules; - private constructor(); + interface Modules { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): Module; + Item(Index: number | string): Module; readonly Parent: any; + (Index: number | string): Module; } class NavigationButton { @@ -6075,7 +5609,7 @@ declare namespace Access { readonly LayoutID: number; readonly Left: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NavigationTargetName: string; NavigationWhereClause: string; @@ -6223,7 +5757,7 @@ declare namespace Access { Left: number; LeftPadding: number; LineSpacing: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NumeralShapes: number; OldBorderStyle: number; @@ -6360,7 +5894,7 @@ declare namespace Access { LinkMasterFields: string; Locked: boolean; LpOleObject: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectPalette: any; @@ -6426,7 +5960,7 @@ declare namespace Access { private 'Access.Operation_typekey': Operation; private constructor(); - /** @param string [bstrParameters=''] */ + /** @param bstrParameters [bstrParameters=''] */ Execute(bstrParameters?: string): any; IsMemberSafe(dispid: number): boolean; readonly Name: string; @@ -6434,13 +5968,12 @@ declare namespace Access { readonly WSParameters: WSParameters; } - class Operations { - private 'Access.Operations_typekey': Operations; - private constructor(); + interface Operations { readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): Operation; + Item(Index: number | string): Operation; readonly Parent: any; + (Index: number | string): Operation; } class OptionButton { @@ -6522,7 +6055,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -6644,7 +6177,7 @@ declare namespace Access { LabelY: number; Left: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -6723,7 +6256,7 @@ declare namespace Access { IsMemberSafe(dispid: number): boolean; IsVisible: boolean; Left: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OnClick: string; OnClickMacro: string; @@ -6767,7 +6300,7 @@ declare namespace Access { IsMemberSafe(dispid: number): boolean; IsVisible: boolean; Left: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Parent: any; readonly Properties: Properties; @@ -6778,14 +6311,13 @@ declare namespace Access { Visible: boolean; } - class Pages { - private 'Access.Pages_typekey': Pages; - private constructor(); - Add(Before?: any): Page; + interface Pages { + Add(Before?: number): Page; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): Page; - Remove(Item?: any): void; + Item(Index: number | string): Page; + Remove(Item?: number): void; + (Index: number | string): Page; } class PaletteButton { @@ -6826,7 +6358,7 @@ declare namespace Access { LabelY: number; Left: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly OldValue: any; OnClick: string; @@ -6902,24 +6434,22 @@ declare namespace Access { TopMargin: number; } - class Printers { - private 'Access.Printers_typekey': Printers; - private constructor(); + interface Printers { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): Printer; + Item(Index: number | string): Printer; readonly Parent: any; + (Index: number | string): Printer; } - class Properties { - private 'Access.Properties_typekey': Properties; - private constructor(); + interface Properties { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): any; + Item(Index: number | string): AccessProperty; readonly Parent: any; + (Index: number | string): AccessProperty; } class Rectangle { @@ -6950,7 +6480,7 @@ declare namespace Access { IsMemberSafe(dispid: number): boolean; IsVisible: boolean; Left: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; OnClick: string; @@ -6990,16 +6520,15 @@ declare namespace Access { readonly Name: string; } - class References { - private 'Access.References_typekey': References; - private constructor(); + interface References { AddFromFile(FileName: string): Reference; AddFromGuid(Guid: string, Major: number, Minor: number): Reference; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(var_0: any): Reference; + Item(var_0: number | string): Reference; readonly Parent: any; Remove(Reference: Reference): void; + (var_0: number | string): Reference; } class Report { @@ -7075,7 +6604,7 @@ declare namespace Access { readonly Module: Module; MouseWheel: string; MouseWheelMacro: string; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Moveable: boolean; MoveLayout: boolean; Name: string; @@ -7129,7 +6658,7 @@ declare namespace Access { OnTimerMacro: string; OnUnload: string; OnUnloadMacro: string; - OpenArgs: any; + OpenArgs: string; OrderBy: string; OrderByOn: boolean; OrderByOnLoad: boolean; @@ -7161,7 +6690,7 @@ declare namespace Access { PrtMip: any; PSet(flags: number, X: number, Y: number, color: number): void; RecordLocks: number; - Recordset: any; + Recordset: DAO.Recordset | ADODB.Recordset | null; RecordSource: string; RecordSourceQualifier: string; readonly Report: Report; @@ -7174,7 +6703,7 @@ declare namespace Access { ScaleTop: number; ScaleWidth: number; ScrollBars: number; - Section(Index: any): Section; + Section(Index: AcReportSection | string): Section; SectionOld(Index: any): Section; ServerFilter: string; readonly Shape: string; @@ -7196,281 +6725,31 @@ declare namespace Access { ZoomControl: number; } - class ReportOld { - private 'Access.ReportOld_typekey': ReportOld; - private constructor(); - _Evaluate(bstrExpr: string, ...ppsa: any[]): any; - _Name: string; - acHiddenCurrentPage: number; - readonly ActiveControl: Control; - readonly Application: Application; - Caption: string; - Circle(flags: number, X: number, Y: number, radius: number, color: number, start: number, end: number, aspect: number): void; - readonly Controls: Controls; - Count: number; - CurrentRecord: number; - CurrentX: number; - CurrentY: number; - DateGrouping: number; - DefaultControl(ControlType: number): Control; - Dirty: boolean; - DrawMode: number; - DrawStyle: number; - DrawWidth: number; - FastLaserPrinting: boolean; - FillColor: number; - FillStyle: number; - Filter: string; - FilterOn: boolean; - FontBold: number; - FontItalic: number; - FontName: string; - FontSize: number; - FontUnderline: number; - ForeColor: number; - FormatCount: number; - FormName: string; - GridX: number; - GridY: number; - GroupLevel(Index: number): GroupLevel; - GrpKeepTogether: number; - HasData: number; - HasModule: boolean; - Height: number; - HelpContextId: number; - HelpFile: string; - Hwnd: number; - InputParameters: string; - LayoutForPrint: boolean; - Left: number; - Line(flags: number, x1: number, y1: number, x2: number, y2: number, color: number): void; - LogicalPageHeight: number; - LogicalPageWidth: number; - MaxButton: boolean; - MenuBar: string; - MinButton: boolean; - readonly Module: Module; - MoveLayout: boolean; - Name: string; - NextRecord: boolean; - OnActivate: string; - OnClose: string; - OnDeactivate: string; - OnError: string; - OnMenu: string; - OnNoData: string; - OnOpen: string; - OnPage: string; - OrderBy: string; - OrderByOn: boolean; - Orientation: number; - Page: number; - PageFooter: number; - PageHeader: number; - Pages: number; - Painting: boolean; - PaintPalette: any; - PaletteSource: string; - readonly Parent: any; - Picture: string; - PictureAlignment: number; - PictureData: any; - PicturePages: number; - PicturePalette: any; - PictureSizeMode: number; - PictureTiling: boolean; - PictureType: number; - Print(Expr: string): void; - PrintCount: number; - PrintSection: boolean; - readonly Properties: Properties; - PrtDevMode: any; - PrtDevNames: any; - PrtMip: any; - PSet(flags: number, X: number, Y: number, color: number): void; - RecordLocks: number; - RecordSource: string; - readonly Report: Report; - Scale(flags: number, x1: number, y1: number, x2: number, y2: number): void; - ScaleHeight: number; - ScaleLeft: number; - ScaleMode: number; - ScaleTop: number; - ScaleWidth: number; - Section(Index: any): Section; - ServerFilter: string; - ShortcutMenuBar: string; - Tag: string; - TextHeight(Expr: string): number; - TextWidth(Expr: string): number; - Toolbar: string; - Top: number; - Visible: boolean; - Width: number; - ZoomControl: number; - } - - class ReportOldV10 { - private 'Access.ReportOldV10_typekey': ReportOldV10; - private constructor(); - _Evaluate(bstrExpr: string, ...ppsa: any[]): any; - _Name: string; - acHiddenCurrentPage: number; - readonly ActiveControl: Control; - readonly Application: Application; - AutoCenter: boolean; - AutoResize: boolean; - BorderStyle: number; - Caption: string; - Circle(flags: number, X: number, Y: number, radius: number, color: number, start: number, end: number, aspect: number): void; - CloseButton: boolean; - ControlBox: boolean; - readonly Controls: Controls; - Count: number; - CurrentRecord: number; - CurrentX: number; - CurrentY: number; - DateGrouping: number; - DefaultControl(ControlType: number): Control; - Dirty: boolean; - DrawMode: number; - DrawStyle: number; - DrawWidth: number; - FastLaserPrinting: boolean; - FillColor: number; - FillStyle: number; - Filter: string; - FilterOn: boolean; - FontBold: number; - FontItalic: number; - FontName: string; - FontSize: number; - FontUnderline: number; - ForeColor: number; - FormatCount: number; - FormName: string; - GridX: number; - GridY: number; - GroupLevel(Index: number): GroupLevel; - GrpKeepTogether: number; - HasData: number; - HasModule: boolean; - Height: number; - HelpContextId: number; - HelpFile: string; - Hwnd: number; - InputParameters: string; - LayoutForPrint: boolean; - Left: number; - Line(flags: number, x1: number, y1: number, x2: number, y2: number, color: number): void; - LogicalPageHeight: number; - LogicalPageWidth: number; - MaxButton: boolean; - MenuBar: string; - MinButton: boolean; - MinMaxButtons: number; - Modal: boolean; - readonly Module: Module; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; - Moveable: boolean; - MoveLayout: boolean; - Name: string; - NextRecord: boolean; - OnActivate: string; - OnClose: string; - OnDeactivate: string; - OnError: string; - OnMenu: string; - OnNoData: string; - OnOpen: string; - OnPage: string; - OpenArgs: any; - OrderBy: string; - OrderByOn: boolean; - Orientation: number; - Page: number; - PageFooter: number; - PageHeader: number; - Pages: number; - Painting: boolean; - PaintPalette: any; - PaletteSource: string; - readonly Parent: any; - Picture: string; - PictureAlignment: number; - PictureData: any; - PicturePages: number; - PicturePalette: any; - PictureSizeMode: number; - PictureTiling: boolean; - PictureType: number; - PopUp: boolean; - Print(Expr: string): void; - PrintCount: number; - Printer: Printer; - PrintSection: boolean; - readonly Properties: Properties; - PrtDevMode: any; - PrtDevNames: any; - PrtMip: any; - PSet(flags: number, X: number, Y: number, color: number): void; - RecordLocks: number; - Recordset: any; - RecordSource: string; - RecordSourceQualifier: string; - readonly Report: Report; - Scale(flags: number, x1: number, y1: number, x2: number, y2: number): void; - ScaleHeight: number; - ScaleLeft: number; - ScaleMode: number; - ScaleTop: number; - ScaleWidth: number; - Section(Index: any): Section; - ServerFilter: string; - readonly Shape: string; - ShortcutMenuBar: string; - Tag: string; - TextHeight(Expr: string): number; - TextWidth(Expr: string): number; - Toolbar: string; - Top: number; - UseDefaultPrinter: boolean; - Visible: boolean; - Width: number; - WindowHeight: number; - readonly WindowLeft: number; - readonly WindowTop: number; - WindowWidth: number; - ZoomControl: number; - } - - class Reports { - private 'Access.Reports_typekey': Reports; - private constructor(); + interface Reports { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): Report; + Item(Index: string | number): Report; readonly Parent: any; + (Index: string | number): Report; } class ReturnVar { private 'Access.ReturnVar_typekey': ReturnVar; private constructor(); - readonly _Value: any; + readonly _Value: string | number; IsMemberSafe(dispid: number): boolean; readonly Name: string; - readonly Value: any; + readonly Value: string | number; } - class ReturnVars { - private 'Access.ReturnVars_typekey': ReturnVars; - private constructor(); + interface ReturnVars { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): ReturnVar; + Item(Index: number | string): ReturnVar; readonly Parent: any; + (Index: string | number): ReturnVar; } class Screen { @@ -7553,14 +6832,13 @@ declare namespace Access { readonly Type: AcResourceType; } - class SharedResources { - private 'Access.SharedResources_typekey': SharedResources; - private constructor(); + interface SharedResources { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: number): SharedResource; readonly Parent: any; + (Index: number): SharedResource; } class SmartTag { @@ -7587,25 +6865,23 @@ declare namespace Access { readonly Parent: any; } - class SmartTagActions { - private 'Access.SmartTagActions_typekey': SmartTagActions; - private constructor(); + interface SmartTagActions { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): SmartTagAction; + Item(Index: number | string): SmartTagAction; readonly Parent: any; + (Index: number | string): SmartTagAction; } - class SmartTagProperties { - private 'Access.SmartTagProperties_typekey': SmartTagProperties; - private constructor(); + interface SmartTagProperties { Add(Name: string, Value: any): SmartTagProperty; readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): SmartTagProperty; + Item(Index: number | string): SmartTagProperty; readonly Parent: any; + (Index: number | string): SmartTagProperty; } class SmartTagProperty { @@ -7617,15 +6893,14 @@ declare namespace Access { Value: string; } - class SmartTags { - private 'Access.SmartTags_typekey': SmartTags; - private constructor(); + interface SmartTags { Add(Name: string): SmartTag; readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): SmartTag; + Item(Index: number | string): SmartTag; readonly Parent: any; + (Index: number | string): SmartTag; } class SubForm { @@ -7701,7 +6976,7 @@ declare namespace Access { LinkChildFields: string; LinkMasterFields: string; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; OnEnter: string; @@ -7821,7 +7096,7 @@ declare namespace Access { readonly LayoutID: number; Left: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; MultiRow: boolean; Name: string; readonly OldValue: any; @@ -7880,23 +7155,22 @@ declare namespace Access { class TempVar { private 'Access.TempVar_typekey': TempVar; private constructor(); - _Value: any; + _Value: number | string | boolean; IsMemberSafe(dispid: number): boolean; readonly Name: string; - Value: any; + Value: number | string | boolean; } - class TempVars { - private 'Access.TempVars_typekey': TempVars; - private constructor(); - Add(Name: string, Value: any): void; + interface TempVars { + Add(Name: string, Value: number | string | boolean): void; readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): TempVar; + Item(Index: number | string): TempVar; readonly Parent: any; - Remove(var_0: any): void; + Remove(Index: number | string): void; RemoveAll(): void; + (Index: number | string): TempVar; } class TextBox { @@ -8019,7 +7293,7 @@ declare namespace Access { LeftPadding: number; LineSpacing: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NumeralShapes: number; OldBorderStyle: number; @@ -8200,7 +7474,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; ObjectPalette: any; readonly OldValue: any; @@ -8336,7 +7610,7 @@ declare namespace Access { Left: number; LeftPadding: number; readonly LocationURL: string; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; readonly OldValue: any; @@ -8416,14 +7690,13 @@ declare namespace Access { readonly Parent: any; } - class WebServices { - private 'Access.WebServices_typekey': WebServices; - private constructor(); + interface WebServices { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): WebService; + Item(Index: number | string): WebService; readonly Parent: any; + (Index: number | string): WebService; } class WizHook { @@ -8459,12 +7732,8 @@ declare namespace Access { GetColumns(bstrBase: string): string; GetCurrentView(bstrTableName: string): number; GetDisabledExtensions(): string; - GetFileName( - hwndOwner: number, AppName: string, DlgTitle: string, OpenTitle: string, File: string, InitialDir: string, Filter: string, FilterIndex: number, View: number, - flags: number, fOpen: boolean): number; - GetFileName2( - hwndOwner: number, AppName: string, DlgTitle: string, OpenTitle: string, File: string, InitialDir: string, Filter: string, FilterIndex: number, View: number, - flags: number, fOpen: boolean, fFileSystem: any): number; + GetFileName(hwndOwner: number, AppName: string, DlgTitle: string, OpenTitle: string, File: string, InitialDir: string, Filter: string, FilterIndex: number, View: number, flags: number, fOpen: boolean): number; + GetFileName2(hwndOwner: number, AppName: string, DlgTitle: string, OpenTitle: string, File: string, InitialDir: string, Filter: string, FilterIndex: number, View: number, flags: number, fOpen: boolean, fFileSystem: any): number; GetFileOdso(bstrExt: string, bstrFilename: string): number; GetImexTblName(): string; GetInfoForColumns(bstrBase: string): string; @@ -8485,7 +7754,7 @@ declare namespace Access { NameFromActid(Actid: number): string; ObjTypOfRecordSource(RecordSource: string): number; OfficeAddInDir(): string; - OpenEmScript(pProperty: _AccessProperty, OpenMode: number, Extra: number, Version: number): number; + OpenEmScript(pProperty: AccessProperty, OpenMode: number, Extra: number, Version: number): number; OpenPictureFile(File: string, Cancelled: boolean): boolean; OpenScript(Script: string, Label: string, OpenMode: number, Extra: number, Version: number): number; ReportLeaksToFile(fRptToFile: boolean, bstrFileOut: string): void; @@ -8514,13 +7783,12 @@ declare namespace Access { readonly Type: number; } - class WSParameters { - private 'Access.WSParameters_typekey': WSParameters; - private constructor(); + interface WSParameters { readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): WSParameter; + Item(Index: number | string): WSParameter; readonly Parent: any; + (Index: number | string): WSParameter; } namespace EventHelperTypes { @@ -8528,12 +7796,230 @@ declare namespace Access { interface WebBrowserControl_BeforeNavigate2_Parameter { Cancel: boolean; - readonly flags: any; + readonly flags: number; readonly Headers: any; readonly pDisp: any; readonly PostData: any; - readonly TargetFrameName: any; - readonly URL: any; + readonly TargetFrameName: string | null; + readonly URL: string; + } + } +} + +declare namespace AccWizObjects { + const enum WIZ_CSIDL_FLAGS { + WIZ_CSIDL_APPDATA = 26, + WIZ_CSIDL_BITBUCKET = 10, + WIZ_CSIDL_COMMON_DESKTOPDIRECTORY = 25, + WIZ_CSIDL_COMMON_PROGRAMS = 23, + WIZ_CSIDL_COMMON_STARTMENU = 22, + WIZ_CSIDL_COMMON_STARTUP = 24, + WIZ_CSIDL_CONTROLS = 3, + WIZ_CSIDL_DESKTOP = 0, + WIZ_CSIDL_DESKTOPDIRECTORY = 16, + WIZ_CSIDL_DRIVES = 17, + WIZ_CSIDL_FAVORITES = 6, + WIZ_CSIDL_FONTS = 20, + WIZ_CSIDL_NETHOOD = 19, + WIZ_CSIDL_NETWORK = 18, + WIZ_CSIDL_PERSONAL = 5, + WIZ_CSIDL_PRINTERS = 4, + WIZ_CSIDL_PRINTHOOD = 27, + WIZ_CSIDL_PROGRAMS = 2, + WIZ_CSIDL_RECENT = 8, + WIZ_CSIDL_SENDTO = 9, + WIZ_CSIDL_STARTMENU = 11, + WIZ_CSIDL_STARTUP = 7, + WIZ_CSIDL_TEMPLATES = 21, + } + + const enum WIZ_SLGP_FLAGS { + WIZ_SLGP_SHORTPATH = 1, + WIZ_SLGP_UNCPRIORITY = 2, + } + + const enum WIZ_SLR_FLAGS { + WIZ_SLR_ANY_MATCH = 2, + WIZ_SLR_NO_UI = 1, + WIZ_SLR_UPDATE = 4, + } + + const enum WIZ_SW_FLAGS { + WIZ_SW_MAXIMIZE = 3, + WIZ_SW_MINIMIZE = 7, + WIZ_SW_NORMAL = 5, + } + + /** Field List Control */ + class FieldList { + private 'AccWizObjects.FieldList_typekey': FieldList; + private constructor(); + AddFieldList(bstrCaption: string, nLeft: number, nTop: number, nWidth: number, nHeight: number, nMultiSelectType: number, cCols: number, fShowPictures: boolean): void; + AddJoinLine(IFieldList: number, iField: number, iForeignFieldList: number, iForeignField: number, lAttribs: number): void; + DeleteFieldList(IFieldList: number): void; + DeleteJoinLine(IJoinLine: number): void; + readonly FieldListCount: number; + FieldLists(IFieldList: number): any; + HScrollPos: number; + readonly JoinLineCount: number; + JoinLines(IJoinLine: number): any; + PersistentHighlight: boolean; + Picture: stdole.IPictureDisp; + PictureCols: number; + PictureRows: number; + ScrollBars: number; + SelectedFieldListIndex: number; + SetCursor(nCursorID: number): void; + VScrollPos: number; + } + + /** ImexGrid Control */ + class ImexGrid { + private 'AccWizObjects.ImexGrid_typekey': ImexGrid; + private constructor(); + AddColumn(ColumnCaption: string, ColumnWidth: number, Index: number): void; + AddRow(RowText: string, Index: number): void; + AllowColumnSizing: boolean; + BackColor: stdole.OLE_COLOR; + CalcBestColumns(): void; + Caption: string; + ClearColumns(): void; + ClearRows(): void; + ColumnClickBehavior: number; + readonly ColumnCount: number; + Columns(ColumnNumber: number): any; + ColumnState: any; + DeleteColumn(Index: number): void; + DeleteRow(Index: number): void; + Delimiters: string; + DrawTextLogicalOrder: boolean; + FirstRowNumber: number; + Font: stdole.IFontDisp; + GridBackColor: stdole.OLE_COLOR; + GridFont: stdole.IFontDisp; + GridHeader: number; + Painting: boolean; + Refresh(): void; + ResetHScrollPos(): void; + ResetVScrollPos(): void; + readonly RowCount: number; + RowText(RowNumber: number): string; + ShowColLines: boolean; + ShowRowHeaders: boolean; + StringDelimiters: string; + } + + interface WIZ_FILETIME { + readonly dwHighDateTime: number; + readonly dwLowDateTime: number; + } + + interface WIZ_WIN32_FIND_DATA { + readonly cAlternate: SafeArray; + readonly cFileName: SafeArray; + readonly dwFileAttributes: number; + readonly dwReserved0: number; + readonly dwReserved1: number; + readonly ftCreationTime: WIZ_FILETIME; + readonly ftLastAccessTime: WIZ_FILETIME; + readonly ftLastWriteTime: WIZ_FILETIME; + readonly nFileSizeHigh: number; + readonly nFileSizeLow: number; + } + + /** WizShellLinkA Class */ + class WizShellLinkA { + private 'AccWizObjects.WizShellLinkA_typekey': WizShellLinkA; + private constructor(); + + /** GetArguments */ + GetArguments(pszArgs: string, cchMaxPath: number): void; + + /** GetDescription */ + GetDescription(pszName: string, cchMaxName: number): void; + + /** GetHotkey */ + GetHotkey(pwHotkey: number): void; + + /** GetIconLocation */ + GetIconLocation(pszIconPath: string, cchIconPath: number, piIcon: number): void; + + /** GetIDList */ + GetIDList(ppidl: WIZ_CSIDL_FLAGS): void; + + /** GetPath */ + GetPath(pszFile: string, cchMaxPath: number, pfd: WIZ_WIN32_FIND_DATA, fflags: number): void; + + /** GetShowCmd */ + GetShowCmd(piShowCmd: WIZ_SW_FLAGS): void; + + /** GetWorkingDirectory */ + GetWorkingDirectory(pszDir: string, cchMaxPath: number): void; + + /** Resolve */ + Resolve(hWnd: number, fflags: number): void; + + /** SetArguments */ + SetArguments(pszArgs: string): void; + + /** SetDescription */ + SetDescription(pszName: string): void; + + /** SetHotkey */ + SetHotkey(wHotkey: number): void; + + /** SetIconLocation */ + SetIconLocation(pszIconPath: string, iIcon: number): void; + + /** SetIDList */ + SetIDList(pidl: WIZ_CSIDL_FLAGS): void; + + /** SetPath */ + SetPath(pszFile: string): void; + + /** SetRelativePath */ + SetRelativePath(pszPathRel: string, dwReserved: number): void; + + /** SetShowCmd */ + SetShowCmd(iShowCmd: WIZ_SW_FLAGS): void; + + /** SetWorkingDirectory */ + SetWorkingDirectory(pszDir: string): void; + } + + namespace EventHelperTypes { + type FieldList_DragOver_ArgNames = ['SourceCtlName', 'SourceFieldList', 'SourceRow', 'State', 'X', 'Y']; + + type FieldList_FldListDragDrop_ArgNames = ['SourceCtlName', 'SourceFieldList', 'SourceRow', 'TargetCtlName', 'TargetFieldList', 'TargetRow']; + + type FieldList_FldListDragOver_ArgNames = ['SourceCtlName', 'SourceFieldList', 'SourceRow', 'TargetCtlName', 'TargetFieldList', 'TargetRow', 'State']; + + interface FieldList_DragOver_Parameter { + readonly SourceCtlName: string; + readonly SourceFieldList: number; + readonly SourceRow: number; + readonly State: number; + readonly X: number; + readonly Y: number; + } + + interface FieldList_FldListDragDrop_Parameter { + readonly SourceCtlName: string; + readonly SourceFieldList: number; + readonly SourceRow: number; + readonly TargetCtlName: string; + readonly TargetFieldList: number; + readonly TargetRow: number; + } + + interface FieldList_FldListDragOver_Parameter { + readonly SourceCtlName: string; + readonly SourceFieldList: number; + readonly SourceRow: number; + readonly State: number; + readonly TargetCtlName: string; + readonly TargetFieldList: number; + readonly TargetRow: number; } } } @@ -8542,71 +8028,45 @@ interface ActiveXObject { on(obj: Access._CheckBoxInOption, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access._CheckBoxInOption, parameter: {Cancel: number}) => void): void; on(obj: Access._CheckBoxInOption, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access._CheckBoxInOption, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access._CheckBoxInOption, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access._CheckBoxInOption, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access._CheckBoxInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access._CheckBoxInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access._CheckBoxInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access._CheckBoxInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access._OptionButtonInOption, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access._OptionButtonInOption, parameter: {Cancel: number}) => void): void; - on( - obj: Access._OptionButtonInOption, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: ( - this: Access._OptionButtonInOption, parameter: {KeyCode: number, Shift: number}) => void): void; + on(obj: Access._OptionButtonInOption, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access._OptionButtonInOption, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access._OptionButtonInOption, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access._OptionButtonInOption, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access._OptionButtonInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], - handler: (this: Access._OptionButtonInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access._OptionButtonInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access._OptionButtonInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access._PageHdrFtrInReport, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access._PageHdrFtrInReport, parameter: {Cancel: number}) => void): void; - on( - obj: Access._PageHdrFtrInReport, event: 'Format', argNames: ['Cancel', 'FormatCount'], handler: ( - this: Access._PageHdrFtrInReport, parameter: {Cancel: number, FormatCount: number}) => void): void; - on( - obj: Access._PageHdrFtrInReport, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access._PageHdrFtrInReport, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access._PageHdrFtrInReport, event: 'Format', argNames: ['Cancel', 'FormatCount'], handler: (this: Access._PageHdrFtrInReport, parameter: {Cancel: number, FormatCount: number}) => void): void; + on(obj: Access._PageHdrFtrInReport, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access._PageHdrFtrInReport, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access._PageHdrFtrInReport, event: 'Print', argNames: ['Cancel', 'PrintCount'], handler: (this: Access._PageHdrFtrInReport, parameter: {Cancel: number, PrintCount: number}) => void): void; on(obj: Access._SectionInReport, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access._SectionInReport, parameter: {Cancel: number}) => void): void; on(obj: Access._SectionInReport, event: 'Format', argNames: ['Cancel', 'FormatCount'], handler: (this: Access._SectionInReport, parameter: {Cancel: number, FormatCount: number}) => void): void; - on( - obj: Access._SectionInReport, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access._SectionInReport, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access._SectionInReport, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access._SectionInReport, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access._SectionInReport, event: 'Print', argNames: ['Cancel', 'PrintCount'], handler: (this: Access._SectionInReport, parameter: {Cancel: number, PrintCount: number}) => void): void; on(obj: Access._ToggleButtonInOption, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access._ToggleButtonInOption, parameter: {Cancel: number}) => void): void; - on( - obj: Access._ToggleButtonInOption, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: ( - this: Access._ToggleButtonInOption, parameter: {KeyCode: number, Shift: number}) => void): void; + on(obj: Access._ToggleButtonInOption, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access._ToggleButtonInOption, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access._ToggleButtonInOption, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access._ToggleButtonInOption, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access._ToggleButtonInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], - handler: (this: Access._ToggleButtonInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access._ToggleButtonInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access._ToggleButtonInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Attachment, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit', argNames: ['Cancel'], handler: (this: Access.Attachment, parameter: {Cancel: number}) => void): void; on(obj: Access.Attachment, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.Attachment, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.Attachment, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.Attachment, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.Attachment, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Attachment, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Attachment, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Attachment, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.BoundObjectFrame, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.BoundObjectFrame, parameter: {Cancel: number}) => void): void; on(obj: Access.BoundObjectFrame, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.BoundObjectFrame, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.BoundObjectFrame, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.BoundObjectFrame, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.BoundObjectFrame, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.BoundObjectFrame, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.BoundObjectFrame, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.BoundObjectFrame, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.BoundObjectFrame, event: 'Updated', argNames: ['Code'], handler: (this: Access.BoundObjectFrame, parameter: {Code: number}) => void): void; on(obj: Access.CheckBox, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.CheckBox, parameter: {Cancel: number}) => void): void; on(obj: Access.CheckBox, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.CheckBox, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.CheckBox, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.CheckBox, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.CheckBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.CheckBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.CheckBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.CheckBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ComboBox, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit' | 'Undo', argNames: ['Cancel'], handler: (this: Access.ComboBox, parameter: {Cancel: number}) => void): void; on(obj: Access.ComboBox, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.ComboBox, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.ComboBox, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.ComboBox, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.ComboBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.ComboBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.ComboBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.ComboBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ComboBox, event: 'NotInList', argNames: ['NewData', 'Response'], handler: (this: Access.ComboBox, parameter: {NewData: string, Response: number}) => void): void; on(obj: Access.CommandButton, event: 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.CommandButton, parameter: {Cancel: number}) => void): void; on(obj: Access.CommandButton, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.CommandButton, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.CommandButton, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.CommandButton, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.CommandButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.CommandButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.CommandButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.CommandButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.CustomControl, event: 'Exit', argNames: ['Cancel'], handler: (this: Access.CustomControl, parameter: {Cancel: number}) => void): void; on(obj: Access.CustomControl, event: 'Updated', argNames: ['Code'], handler: (this: Access.CustomControl, parameter: {Code: number}) => void): void; on(obj: Access.Form, event: 'AfterDelConfirm', argNames: ['Status'], handler: (this: Access.Form, parameter: {Status: number}) => void): void; @@ -8614,16 +8074,9 @@ interface ActiveXObject { on(obj: Access.Form, event: 'AfterRender', argNames: ['drawObject', 'chartObject'], handler: (this: Access.Form, parameter: {readonly drawObject: any, readonly chartObject: any}) => void): void; on(obj: Access.Form, event: 'ApplyFilter', argNames: ['Cancel', 'ApplyType'], handler: (this: Access.Form, parameter: {Cancel: number, ApplyType: number}) => void): void; on(obj: Access.Form, event: 'BeforeDelConfirm', argNames: ['Cancel', 'Response'], handler: (this: Access.Form, parameter: {Cancel: number, Response: number}) => void): void; - on( - obj: Access.Form, event: 'BeforeInsert' | 'BeforeUpdate' | 'BeginBatchEdit' | 'DblClick' | 'Delete' | 'Dirty' | 'Open' | 'RecordExit' | 'Undo' | 'UndoBatchEdit' | - 'Unload', - argNames: ['Cancel'], handler: (this: Access.Form, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Form, event: 'BeforeRender', argNames: ['drawObject', 'chartObject', 'Cancel'], handler: ( - this: Access.Form, parameter: {readonly drawObject: any, readonly chartObject: any, readonly Cancel: any}) => void): void; - on( - obj: Access.Form, event: 'BeforeScreenTip', argNames: ['ScreenTipText', 'SourceObject'], handler: ( - this: Access.Form, parameter: {readonly ScreenTipText: any, readonly SourceObject: any}) => void): void; + on(obj: Access.Form, event: 'BeforeInsert' | 'BeforeUpdate' | 'BeginBatchEdit' | 'DblClick' | 'Delete' | 'Dirty' | 'Open' | 'RecordExit' | 'Undo' | 'UndoBatchEdit' | 'Unload', argNames: ['Cancel'], handler: (this: Access.Form, parameter: {Cancel: number}) => void): void; + on(obj: Access.Form, event: 'BeforeRender', argNames: ['drawObject', 'chartObject', 'Cancel'], handler: (this: Access.Form, parameter: {readonly drawObject: any, readonly chartObject: any, readonly Cancel: any}) => void): void; + on(obj: Access.Form, event: 'BeforeScreenTip', argNames: ['ScreenTipText', 'SourceObject'], handler: (this: Access.Form, parameter: {readonly ScreenTipText: any, readonly SourceObject: any}) => void): void; on(obj: Access.Form, event: 'CommandBeforeExecute', argNames: ['Command', 'Cancel'], handler: (this: Access.Form, parameter: {readonly Command: any, readonly Cancel: any}) => void): void; on(obj: Access.Form, event: 'CommandChecked', argNames: ['Command', 'Checked'], handler: (this: Access.Form, parameter: {readonly Command: any, readonly Checked: any}) => void): void; on(obj: Access.Form, event: 'CommandEnabled', argNames: ['Command', 'Enabled'], handler: (this: Access.Form, parameter: {readonly Command: any, readonly Enabled: any}) => void): void; @@ -8633,141 +8086,41 @@ interface ActiveXObject { on(obj: Access.Form, event: 'Filter', argNames: ['Cancel', 'FilterType'], handler: (this: Access.Form, parameter: {Cancel: number, FilterType: number}) => void): void; on(obj: Access.Form, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.Form, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.Form, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.Form, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.Form, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Form, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Form, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Form, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Form, event: 'MouseWheel', argNames: ['Page', 'Count'], handler: (this: Access.Form, parameter: {readonly Page: boolean, readonly Count: number}) => void): void; - on( - obj: Access.FormOld, event: 'AfterBeginTransaction' | 'AfterCommitTransaction' | 'RollbackTransaction', argNames: ['Connection'], handler: ( - this: Access.FormOld, parameter: {readonly Connection: ADODB.Connection}) => void): void; - on(obj: Access.FormOld, event: 'AfterDelConfirm', argNames: ['Status'], handler: (this: Access.FormOld, parameter: {Status: number}) => void): void; - on(obj: Access.FormOld, event: 'AfterFinalRender' | 'AfterLayout', argNames: ['drawObject'], handler: (this: Access.FormOld, parameter: {readonly drawObject: any}) => void): void; - on( - obj: Access.FormOld, event: 'AfterRender', argNames: ['drawObject', 'chartObject'], handler: ( - this: Access.FormOld, parameter: {readonly drawObject: any, readonly chartObject: any}) => void): void; - on(obj: Access.FormOld, event: 'ApplyFilter', argNames: ['Cancel', 'ApplyType'], handler: (this: Access.FormOld, parameter: {Cancel: number, ApplyType: number}) => void): void; - on( - obj: Access.FormOld, event: 'BeforeBeginTransaction' | 'BeforeCommitTransaction', argNames: ['Cancel', 'Connection'], handler: ( - this: Access.FormOld, parameter: {Cancel: number, readonly Connection: ADODB.Connection}) => void): void; - on(obj: Access.FormOld, event: 'BeforeDelConfirm', argNames: ['Cancel', 'Response'], handler: (this: Access.FormOld, parameter: {Cancel: number, Response: number}) => void): void; - on( - obj: Access.FormOld, event: 'BeforeInsert' | 'BeforeUpdate' | 'BeginBatchEdit' | 'DblClick' | 'Delete' | 'Dirty' | 'Open' | 'RecordExit' | 'Undo' | - 'UndoBatchEdit' | 'Unload', - argNames: ['Cancel'], handler: (this: Access.FormOld, parameter: {Cancel: number}) => void): void; - on( - obj: Access.FormOld, event: 'BeforeRender', argNames: ['drawObject', 'chartObject', 'Cancel'], handler: ( - this: Access.FormOld, parameter: {readonly drawObject: any, readonly chartObject: any, readonly Cancel: any}) => void): void; - on( - obj: Access.FormOld, event: 'BeforeScreenTip', argNames: ['ScreenTipText', 'SourceObject'], handler: ( - this: Access.FormOld, parameter: {readonly ScreenTipText: any, readonly SourceObject: any}) => void): void; - on(obj: Access.FormOld, event: 'CommandBeforeExecute', argNames: ['Command', 'Cancel'], handler: (this: Access.FormOld, parameter: {readonly Command: any, readonly Cancel: any}) => void): void; - on(obj: Access.FormOld, event: 'CommandChecked', argNames: ['Command', 'Checked'], handler: (this: Access.FormOld, parameter: {readonly Command: any, readonly Checked: any}) => void): void; - on(obj: Access.FormOld, event: 'CommandEnabled', argNames: ['Command', 'Enabled'], handler: (this: Access.FormOld, parameter: {readonly Command: any, readonly Enabled: any}) => void): void; - on(obj: Access.FormOld, event: 'CommandExecute', argNames: ['Command'], handler: (this: Access.FormOld, parameter: {readonly Command: any}) => void): void; - on(obj: Access.FormOld, event: 'DataChange' | 'PivotTableChange' | 'ViewChange', argNames: ['Reason'], handler: (this: Access.FormOld, parameter: {readonly Reason: number}) => void): void; - on(obj: Access.FormOld, event: 'Error', argNames: ['DataErr', 'Response'], handler: (this: Access.FormOld, parameter: {DataErr: number, Response: number}) => void): void; - on(obj: Access.FormOld, event: 'Filter', argNames: ['Cancel', 'FilterType'], handler: (this: Access.FormOld, parameter: {Cancel: number, FilterType: number}) => void): void; - on(obj: Access.FormOld, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.FormOld, parameter: {KeyCode: number, Shift: number}) => void): void; - on(obj: Access.FormOld, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.FormOld, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.FormOld, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.FormOld, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; - on(obj: Access.FormOld, event: 'MouseWheel', argNames: ['Page', 'Count'], handler: (this: Access.FormOld, parameter: {readonly Page: boolean, readonly Count: number}) => void): void; - on( - obj: Access.FormOldV10, event: 'AfterBeginTransaction' | 'AfterCommitTransaction' | 'RollbackTransaction', argNames: ['Connection'], - handler: (this: Access.FormOldV10, parameter: {readonly Connection: ADODB.Connection}) => void): void; - on(obj: Access.FormOldV10, event: 'AfterDelConfirm', argNames: ['Status'], handler: (this: Access.FormOldV10, parameter: {Status: number}) => void): void; - on(obj: Access.FormOldV10, event: 'AfterFinalRender' | 'AfterLayout', argNames: ['drawObject'], handler: (this: Access.FormOldV10, parameter: {readonly drawObject: any}) => void): void; - on( - obj: Access.FormOldV10, event: 'AfterRender', argNames: ['drawObject', 'chartObject'], handler: ( - this: Access.FormOldV10, parameter: {readonly drawObject: any, readonly chartObject: any}) => void): void; - on(obj: Access.FormOldV10, event: 'ApplyFilter', argNames: ['Cancel', 'ApplyType'], handler: (this: Access.FormOldV10, parameter: {Cancel: number, ApplyType: number}) => void): void; - on( - obj: Access.FormOldV10, event: 'BeforeBeginTransaction' | 'BeforeCommitTransaction', argNames: ['Cancel', 'Connection'], handler: ( - this: Access.FormOldV10, parameter: {Cancel: number, readonly Connection: ADODB.Connection}) => void): void; - on(obj: Access.FormOldV10, event: 'BeforeDelConfirm', argNames: ['Cancel', 'Response'], handler: (this: Access.FormOldV10, parameter: {Cancel: number, Response: number}) => void): void; - on( - obj: Access.FormOldV10, event: 'BeforeInsert' | 'BeforeUpdate' | 'BeginBatchEdit' | 'DblClick' | 'Delete' | 'Dirty' | 'Open' | 'RecordExit' | 'Undo' | - 'UndoBatchEdit' | 'Unload', - argNames: ['Cancel'], handler: (this: Access.FormOldV10, parameter: {Cancel: number}) => void): void; - on( - obj: Access.FormOldV10, event: 'BeforeRender', argNames: ['drawObject', 'chartObject', 'Cancel'], handler: ( - this: Access.FormOldV10, parameter: {readonly drawObject: any, readonly chartObject: any, readonly Cancel: any}) => void): void; - on( - obj: Access.FormOldV10, event: 'BeforeScreenTip', argNames: ['ScreenTipText', 'SourceObject'], handler: ( - this: Access.FormOldV10, parameter: {readonly ScreenTipText: any, readonly SourceObject: any}) => void): void; - on( - obj: Access.FormOldV10, event: 'CommandBeforeExecute', argNames: ['Command', 'Cancel'], handler: ( - this: Access.FormOldV10, parameter: {readonly Command: any, readonly Cancel: any}) => void): void; - on(obj: Access.FormOldV10, event: 'CommandChecked', argNames: ['Command', 'Checked'], handler: (this: Access.FormOldV10, parameter: {readonly Command: any, readonly Checked: any}) => void): void; - on(obj: Access.FormOldV10, event: 'CommandEnabled', argNames: ['Command', 'Enabled'], handler: (this: Access.FormOldV10, parameter: {readonly Command: any, readonly Enabled: any}) => void): void; - on(obj: Access.FormOldV10, event: 'CommandExecute', argNames: ['Command'], handler: (this: Access.FormOldV10, parameter: {readonly Command: any}) => void): void; - on(obj: Access.FormOldV10, event: 'DataChange' | 'PivotTableChange' | 'ViewChange', argNames: ['Reason'], handler: (this: Access.FormOldV10, parameter: {readonly Reason: number}) => void): void; - on(obj: Access.FormOldV10, event: 'Error', argNames: ['DataErr', 'Response'], handler: (this: Access.FormOldV10, parameter: {DataErr: number, Response: number}) => void): void; - on(obj: Access.FormOldV10, event: 'Filter', argNames: ['Cancel', 'FilterType'], handler: (this: Access.FormOldV10, parameter: {Cancel: number, FilterType: number}) => void): void; - on(obj: Access.FormOldV10, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.FormOldV10, parameter: {KeyCode: number, Shift: number}) => void): void; - on(obj: Access.FormOldV10, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.FormOldV10, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.FormOldV10, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.FormOldV10, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; - on(obj: Access.FormOldV10, event: 'MouseWheel', argNames: ['Page', 'Count'], handler: (this: Access.FormOldV10, parameter: {readonly Page: boolean, readonly Count: number}) => void): void; on(obj: Access.Image, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.Image, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Image, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Image, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Image, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Image, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Label, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.Label, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Label, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Label, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Label, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Label, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ListBox, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.ListBox, parameter: {Cancel: number}) => void): void; on(obj: Access.ListBox, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.ListBox, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.ListBox, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.ListBox, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.ListBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.ListBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.ListBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.ListBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.NavigationButton, event: 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.NavigationButton, parameter: {Cancel: number}) => void): void; on(obj: Access.NavigationButton, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.NavigationButton, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.NavigationButton, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.NavigationButton, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.NavigationButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.NavigationButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; - on( - obj: Access.NavigationControl, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit' | 'Undo', argNames: ['Cancel'], handler: ( - this: Access.NavigationControl, parameter: {Cancel: number}) => void): void; + on(obj: Access.NavigationButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.NavigationButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.NavigationControl, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit' | 'Undo', argNames: ['Cancel'], handler: (this: Access.NavigationControl, parameter: {Cancel: number}) => void): void; on(obj: Access.NavigationControl, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.NavigationControl, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.NavigationControl, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.NavigationControl, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.NavigationControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.NavigationControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.NavigationControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.NavigationControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ObjectFrame, event: 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.ObjectFrame, parameter: {Cancel: number}) => void): void; - on( - obj: Access.ObjectFrame, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.ObjectFrame, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.ObjectFrame, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.ObjectFrame, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ObjectFrame, event: 'Updated', argNames: ['Code'], handler: (this: Access.ObjectFrame, parameter: {Code: number}) => void): void; on(obj: Access.OptionButton, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.OptionButton, parameter: {Cancel: number}) => void): void; on(obj: Access.OptionButton, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.OptionButton, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.OptionButton, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.OptionButton, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.OptionButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.OptionButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.OptionButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.OptionButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.OptionGroup, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.OptionGroup, parameter: {Cancel: number}) => void): void; - on( - obj: Access.OptionGroup, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.OptionGroup, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.OptionGroup, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.OptionGroup, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Page, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.Page, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Page, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Page, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Page, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Page, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.PaletteButton, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.PaletteButton, parameter: {Cancel: number}) => void): void; on(obj: Access.PaletteButton, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.PaletteButton, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.PaletteButton, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.PaletteButton, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.PaletteButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.PaletteButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.PaletteButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.PaletteButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Rectangle, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.Rectangle, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Rectangle, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Rectangle, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Rectangle, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Rectangle, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.References, event: 'ItemAdded' | 'ItemRemoved', argNames: ['Reference'], handler: (this: Access.References, parameter: {readonly Reference: Access.Reference}) => void): void; on(obj: Access.Report, event: 'ApplyFilter', argNames: ['Cancel', 'ApplyType'], handler: (this: Access.Report, parameter: {Cancel: number, ApplyType: number}) => void): void; on(obj: Access.Report, event: 'DblClick' | 'NoData' | 'Open' | 'Unload', argNames: ['Cancel'], handler: (this: Access.Report, parameter: {Cancel: number}) => void): void; @@ -8775,58 +8128,32 @@ interface ActiveXObject { on(obj: Access.Report, event: 'Filter', argNames: ['Cancel', 'FilterType'], handler: (this: Access.Report, parameter: {Cancel: number, FilterType: number}) => void): void; on(obj: Access.Report, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.Report, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.Report, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.Report, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.Report, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Report, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Report, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Report, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Report, event: 'MouseWheel', argNames: ['Page', 'Count'], handler: (this: Access.Report, parameter: {readonly Page: boolean, readonly Count: number}) => void): void; - on(obj: Access.ReportOld, event: 'Error', argNames: ['DataErr', 'Response'], handler: (this: Access.ReportOld, parameter: {DataErr: number, Response: number}) => void): void; - on(obj: Access.ReportOld, event: 'NoData' | 'Open', argNames: ['Cancel'], handler: (this: Access.ReportOld, parameter: {Cancel: number}) => void): void; - on(obj: Access.ReportOldV10, event: 'Error', argNames: ['DataErr', 'Response'], handler: (this: Access.ReportOldV10, parameter: {DataErr: number, Response: number}) => void): void; - on(obj: Access.ReportOldV10, event: 'NoData' | 'Open', argNames: ['Cancel'], handler: (this: Access.ReportOldV10, parameter: {Cancel: number}) => void): void; on(obj: Access.Section, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.Section, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Section, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Section, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Section, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Section, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.SubForm, event: 'Exit', argNames: ['Cancel'], handler: (this: Access.SubForm, parameter: {Cancel: number}) => void): void; on(obj: Access.SubReport, event: 'Exit', argNames: ['Cancel'], handler: (this: Access.SubReport, parameter: {Cancel: number}) => void): void; on(obj: Access.TabControl, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.TabControl, parameter: {Cancel: number}) => void): void; on(obj: Access.TabControl, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.TabControl, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.TabControl, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.TabControl, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.TabControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.TabControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.TabControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.TabControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.TextBox, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit' | 'Undo', argNames: ['Cancel'], handler: (this: Access.TextBox, parameter: {Cancel: number}) => void): void; on(obj: Access.TextBox, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.TextBox, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.TextBox, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.TextBox, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.TextBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.TextBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.TextBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.TextBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ToggleButton, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.ToggleButton, parameter: {Cancel: number}) => void): void; on(obj: Access.ToggleButton, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.ToggleButton, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.ToggleButton, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.ToggleButton, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.ToggleButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.ToggleButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; - on( - obj: Access.WebBrowserControl, event: 'BeforeNavigate2', argNames: Access.EventHelperTypes.WebBrowserControl_BeforeNavigate2_ArgNames, - handler: (this: Access.WebBrowserControl, parameter: Access.EventHelperTypes.WebBrowserControl_BeforeNavigate2_Parameter) => void): void; - on( - obj: Access.WebBrowserControl, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit', argNames: ['Cancel'], handler: ( - this: Access.WebBrowserControl, parameter: {Cancel: number}) => void): void; - on( - obj: Access.WebBrowserControl, event: 'DocumentComplete', argNames: ['pDisp', 'URL'], handler: ( - this: Access.WebBrowserControl, parameter: {readonly pDisp: any, readonly URL: any}) => void): void; + on(obj: Access.ToggleButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.ToggleButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.WebBrowserControl, event: 'BeforeNavigate2', argNames: Access.EventHelperTypes.WebBrowserControl_BeforeNavigate2_ArgNames, handler: (this: Access.WebBrowserControl, parameter: Access.EventHelperTypes.WebBrowserControl_BeforeNavigate2_Parameter) => void): void; + on(obj: Access.WebBrowserControl, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit', argNames: ['Cancel'], handler: (this: Access.WebBrowserControl, parameter: {Cancel: number}) => void): void; + on(obj: Access.WebBrowserControl, event: 'DocumentComplete', argNames: ['pDisp', 'URL'], handler: (this: Access.WebBrowserControl, parameter: {readonly pDisp: any, readonly URL: any}) => void): void; on(obj: Access.WebBrowserControl, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.WebBrowserControl, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.WebBrowserControl, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.WebBrowserControl, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.WebBrowserControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.WebBrowserControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; - on( - obj: Access.WebBrowserControl, event: 'NavigateError', argNames: ['pDisp', 'URL', 'TargetFrameName', 'StatusCode', 'Cancel'], - handler: (this: Access.WebBrowserControl, parameter: {readonly pDisp: any, readonly URL: any, readonly TargetFrameName: any, readonly StatusCode: any, Cancel: boolean}) => void): void; - on( - obj: Access.WebBrowserControl, event: 'ProgressChange', argNames: ['Progress', 'ProgressMax'], handler: ( - this: Access.WebBrowserControl, parameter: {readonly Progress: number, readonly ProgressMax: number}) => void): void; + on(obj: Access.WebBrowserControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.WebBrowserControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.WebBrowserControl, event: 'NavigateError', argNames: ['pDisp', 'URL', 'TargetFrameName', 'StatusCode', 'Cancel'], handler: (this: Access.WebBrowserControl, parameter: {readonly pDisp: any, readonly URL: string, readonly TargetFrameName: string | null, readonly StatusCode: any, Cancel: boolean}) => void): void; + on(obj: Access.WebBrowserControl, event: 'ProgressChange', argNames: ['Progress', 'ProgressMax'], handler: (this: Access.WebBrowserControl, parameter: {readonly Progress: number, readonly ProgressMax: number}) => void): void; on(obj: Access.WebBrowserControl, event: 'Updated', argNames: ['Code'], handler: (this: Access.WebBrowserControl, parameter: {Code: number}) => void): void; on(obj: Access._CheckBoxInOption, event: 'AfterUpdate' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access._CheckBoxInOption, parameter: {}) => void): void; on(obj: Access._OptionButtonInOption, event: 'AfterUpdate' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access._OptionButtonInOption, parameter: {}) => void): void; @@ -8840,18 +8167,7 @@ interface ActiveXObject { on(obj: Access.ComboBox, event: 'AfterUpdate' | 'Change' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.ComboBox, parameter: {}) => void): void; on(obj: Access.CommandButton, event: 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.CommandButton, parameter: {}) => void): void; on(obj: Access.CustomControl, event: 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.CustomControl, parameter: {}) => void): void; - on( - obj: Access.Form, event: 'Activate' | 'AfterInsert' | 'AfterUpdate' | 'BeforeQuery' | 'Click' | 'Close' | 'Current' | 'DataSetChange' | 'Deactivate' | 'GotFocus' | - 'Load' | 'LostFocus' | 'OnConnect' | 'OnDisconnect' | 'Query' | 'Resize' | 'SelectionChange' | 'Timer', - handler: (this: Access.Form, parameter: {}) => void): void; - on( - obj: Access.FormOld, event: 'Activate' | 'AfterInsert' | 'AfterUpdate' | 'BeforeQuery' | 'Click' | 'Close' | 'Current' | 'DataSetChange' | 'Deactivate' | - 'GotFocus' | 'Load' | 'LostFocus' | 'OnConnect' | 'OnDisconnect' | 'Query' | 'Resize' | 'SelectionChange' | 'Timer', - handler: (this: Access.FormOld, parameter: {}) => void): void; - on( - obj: Access.FormOldV10, event: 'Activate' | 'AfterInsert' | 'AfterUpdate' | 'BeforeQuery' | 'Click' | 'Close' | 'Current' | 'DataSetChange' | 'Deactivate' | - 'GotFocus' | 'Load' | 'LostFocus' | 'OnConnect' | 'OnDisconnect' | 'Query' | 'Resize' | 'SelectionChange' | 'Timer', - handler: (this: Access.FormOldV10, parameter: {}) => void): void; + on(obj: Access.Form, event: 'Activate' | 'AfterInsert' | 'AfterUpdate' | 'BeforeQuery' | 'Click' | 'Close' | 'Current' | 'DataSetChange' | 'Deactivate' | 'GotFocus' | 'Load' | 'LostFocus' | 'OnConnect' | 'OnDisconnect' | 'Query' | 'Resize' | 'SelectionChange' | 'Timer', handler: (this: Access.Form, parameter: {}) => void): void; on(obj: Access.Image, event: 'Click', handler: (this: Access.Image, parameter: {}) => void): void; on(obj: Access.Label, event: 'Click', handler: (this: Access.Label, parameter: {}) => void): void; on(obj: Access.ListBox, event: 'AfterUpdate' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.ListBox, parameter: {}) => void): void; @@ -8863,11 +8179,7 @@ interface ActiveXObject { on(obj: Access.Page, event: 'Click', handler: (this: Access.Page, parameter: {}) => void): void; on(obj: Access.PaletteButton, event: 'AfterUpdate' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.PaletteButton, parameter: {}) => void): void; on(obj: Access.Rectangle, event: 'Click', handler: (this: Access.Rectangle, parameter: {}) => void): void; - on( - obj: Access.Report, event: 'Activate' | 'Click' | 'Close' | 'Current' | 'Deactivate' | 'GotFocus' | 'Load' | 'LostFocus' | 'Page' | 'Resize' | 'Timer', - handler: (this: Access.Report, parameter: {}) => void): void; - on(obj: Access.ReportOld, event: 'Activate' | 'Close' | 'Deactivate' | 'Page', handler: (this: Access.ReportOld, parameter: {}) => void): void; - on(obj: Access.ReportOldV10, event: 'Activate' | 'Close' | 'Deactivate' | 'Page', handler: (this: Access.ReportOldV10, parameter: {}) => void): void; + on(obj: Access.Report, event: 'Activate' | 'Click' | 'Close' | 'Current' | 'Deactivate' | 'GotFocus' | 'Load' | 'LostFocus' | 'Page' | 'Resize' | 'Timer', handler: (this: Access.Report, parameter: {}) => void): void; on(obj: Access.Section, event: 'Click' | 'Paint', handler: (this: Access.Section, parameter: {}) => void): void; on(obj: Access.SubForm, event: 'Enter', handler: (this: Access.SubForm, parameter: {}) => void): void; on(obj: Access.SubReport, event: 'Enter', handler: (this: Access.SubReport, parameter: {}) => void): void; @@ -8875,51 +8187,26 @@ interface ActiveXObject { on(obj: Access.TextBox, event: 'AfterUpdate' | 'Change' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.TextBox, parameter: {}) => void): void; on(obj: Access.ToggleButton, event: 'AfterUpdate' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.ToggleButton, parameter: {}) => void): void; on(obj: Access.WebBrowserControl, event: 'AfterUpdate' | 'Change' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.WebBrowserControl, parameter: {}) => void): void; - set( - obj: Access._CheckBoxInOption | Access._ChildLabel | Access._CustomControlInReport | Access._OptionButtonInOption | Access._ToggleButtonInOption | - Access.Attachment | Access.BoundObjectFrame | Access.CheckBox | Access.ComboBox | Access.CommandButton | Access.CustomControl | Access.EmptyCell | Access.Form | - Access.FormOld | Access.FormOldV10 | Access.Label | Access.ListBox | Access.NavigationButton | Access.NavigationControl | Access.ObjectFrame | - Access.OptionButton | Access.OptionGroup | Access.Page | Access.SubForm | Access.TabControl | Access.TextBox | Access.ToggleButton | Access.WebBrowserControl, - propertyName: 'accName' | 'accValue', parameterTypes: [any], newValue: string): void; + on(obj: AccWizObjects.FieldList, event: 'DragDrop', argNames: ['SourceCtlName', 'SourceFieldList', 'SourceRow', 'X', 'Y'], handler: (this: AccWizObjects.FieldList, parameter: { readonly SourceCtlName: string, readonly SourceFieldList: number, readonly SourceRow: number, readonly X: number, readonly Y: number }) => void): void; + on(obj: AccWizObjects.FieldList, event: 'DragOver', argNames: AccWizObjects.EventHelperTypes.FieldList_DragOver_ArgNames, handler: (this: AccWizObjects.FieldList, parameter: AccWizObjects.EventHelperTypes.FieldList_DragOver_Parameter) => void): void; + on(obj: AccWizObjects.FieldList, event: 'FldListCheckItem' | 'FldListClick' | 'FldListDblClick' | 'FldListHdrDblClick', argNames: ['FieldList'], handler: (this: AccWizObjects.FieldList, parameter: { readonly FieldList: number }) => void): void; + on(obj: AccWizObjects.FieldList, event: 'FldListDragDrop', argNames: AccWizObjects.EventHelperTypes.FieldList_FldListDragDrop_ArgNames, handler: (this: AccWizObjects.FieldList, parameter: AccWizObjects.EventHelperTypes.FieldList_FldListDragDrop_Parameter) => void): void; + on(obj: AccWizObjects.FieldList, event: 'FldListDragOver', argNames: AccWizObjects.EventHelperTypes.FieldList_FldListDragOver_ArgNames, handler: (this: AccWizObjects.FieldList, parameter: AccWizObjects.EventHelperTypes.FieldList_FldListDragOver_Parameter) => void): void; + on(obj: AccWizObjects.FieldList, event: 'FldListGotFocus' | 'FldListLostFocus', argNames: ['FieldListIndex'], handler: (this: AccWizObjects.FieldList, parameter: { readonly FieldListIndex: number }) => void): void; + on(obj: AccWizObjects.FieldList, event: 'FldListKeyDown' | 'FldListKeyUp', argNames: ['FieldList', 'KeyCode', 'Shift'], handler: (this: AccWizObjects.FieldList, parameter: { readonly FieldList: number, KeyCode: number, readonly Shift: number }) => void): void; + on(obj: AccWizObjects.FieldList, event: 'FldListKeyPress', argNames: ['FieldList', 'KeyAscii'], handler: (this: AccWizObjects.FieldList, parameter: { readonly FieldList: number, KeyAscii: number }) => void): void; + on(obj: AccWizObjects.FieldList, event: 'FldListMouseDown' | 'FldListMouseMove' | 'FldListMouseUp', argNames: ['FieldList', 'Button', 'Shift', 'X', 'Y'], handler: (this: AccWizObjects.FieldList, parameter: { readonly FieldList: number, readonly Button: number, readonly Shift: number, readonly X: stdole.OLE_XPOS_PIXELS, readonly Y: stdole.OLE_YPOS_PIXELS }) => void): void; + on(obj: AccWizObjects.ImexGrid, event: 'ColumnCreated' | 'ColumnDeleted' | 'ColumnSelected' | 'ColumnSized', argNames: ['Column'], handler: (this: AccWizObjects.ImexGrid, parameter: { readonly Column: number }) => void): void; + on(obj: AccWizObjects.FieldList, event: 'AfterStartup', handler: (this: AccWizObjects.FieldList, parameter: {}) => void): void; + set(obj: Access._CheckBoxInOption | Access._ChildLabel | Access._CustomControlInReport | Access._OptionButtonInOption | Access._ToggleButtonInOption | Access.Attachment | Access.BoundObjectFrame | Access.CheckBox | Access.ComboBox | Access.CommandButton | Access.CustomControl | Access.EmptyCell | Access.Form | Access.Label | Access.ListBox | Access.NavigationButton | Access.NavigationControl | Access.ObjectFrame | Access.OptionButton | Access.OptionGroup | Access.Page | Access.SubForm | Access.TabControl | Access.TextBox | Access.ToggleButton | Access.WebBrowserControl, propertyName: 'accName' | 'accValue', parameterTypes: [any], newValue: string): void; set(obj: Access._ControlInReportEvents | Access.ComboBox | Access.Control | Access.ListBox, propertyName: 'Selected', parameterTypes: [number], newValue: number): void; - new(progid: K): ActiveXObjectNameMap[K]; + set(obj: AccWizObjects.ImexGrid, propertyName: 'Columns', parameterTypes: [number], newValue: any): void; + set(obj: AccWizObjects.ImexGrid, propertyName: 'RowText', parameterTypes: [number], newValue: string): void; } interface ActiveXObjectNameMap { 'Access.Application': Access.Application; -} - -interface EnumeratorConstructor { - new(col: Access._ItemsSelected): Enumerator; - new(col: Access.AccessObjectProperties): Enumerator; - new(col: Access.AdditionalData): Enumerator; - new( - col: Access.AllDataAccessPages | Access.AllDatabaseDiagrams | Access.AllForms | Access.AllFunctions | Access.AllMacros | Access.AllModules | Access.AllQueries | - Access.AllReports | Access.AllStoredProcedures | Access.AllTables | Access.AllViews | Access.DependencyObjects): Enumerator; - new(col: Access.Controls): Enumerator; - new(col: Access.Children | Access.Properties): Enumerator; // tslint:disable-line:use-default-type-parameter - new(col: Access.DataAccessPages): Enumerator; - new(col: Access.Entities): Enumerator; - new(col: Access.FormatConditions): Enumerator; - new(col: Access.Forms): Enumerator; - new(col: Access.ImportExportSpecifications): Enumerator; - new(col: Access.LocalVars): Enumerator; - new(col: Access.Modules): Enumerator; - new(col: Access.Operations): Enumerator; - new(col: Access.Pages): Enumerator; - new(col: Access.Printers): Enumerator; - new(col: Access.References): Enumerator; - new(col: Access.Reports): Enumerator; - new(col: Access.ReturnVars): Enumerator; - new(col: Access.SharedResources): Enumerator; - new(col: Access.SmartTagActions): Enumerator; - new(col: Access.SmartTagProperties): Enumerator; - new(col: Access.SmartTags): Enumerator; - new(col: Access.TempVars): Enumerator; - new(col: Access.WebServices): Enumerator; - new(col: Access.WSParameters): Enumerator; -} - -interface SafeArray { - _brand: SafeArray; + 'ACCWIZ.FieldListCtrl': AccWizObjects.FieldList; + 'ACCWIZ.ImexGridCtrl': AccWizObjects.ImexGrid; + lnkfile: AccWizObjects.WizShellLinkA; } diff --git a/types/activex-access/tsconfig.json b/types/activex-access/tsconfig.json index a376fcb722..867c1e2970 100644 --- a/types/activex-access/tsconfig.json +++ b/types/activex-access/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-access/tslint.json b/types/activex-access/tslint.json index 3224b40b8b..7b89accc6d 100644 --- a/types/activex-access/tslint.json +++ b/types/activex-access/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "no-const-enum": false + "no-const-enum": false, + "max-line-length": false } } diff --git a/types/activex-adodb/activex-adodb-tests.ts b/types/activex-adodb/activex-adodb-tests.ts index 347e1d9c9f..eecc7e9bdc 100644 --- a/types/activex-adodb/activex-adodb-tests.ts +++ b/types/activex-adodb/activex-adodb-tests.ts @@ -1,5 +1,8 @@ // Note -- running these tests under cscript requires some ES5 polyfills +/// +/// + const collectionToArray = (col: { Item(key: any): T }): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); @@ -12,9 +15,9 @@ const collectionToArray = (col: { Item(key: any): T }): T[] => { }; const toSafeArray = (...items: T[]): SafeArray => { - const dict = new ActiveXObject('Scripting.Dictionary'); + const dict: Scripting.Dictionary = new ActiveXObject('Scripting.Dictionary'); items.forEach((x, index) => dict.Add(index, x)); - return dict.Items() as SafeArray; + return dict.Items(); }; const toConnectionString = (o: { [index: string]: any }) => { diff --git a/types/activex-adodb/index.d.ts b/types/activex-adodb/index.d.ts index 1879891b2d..580042cfa6 100644 --- a/types/activex-adodb/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace ADODB { const enum ADCPROP_ASYNCTHREADPRIORITY_ENUM { adPriorityAboveNormal = 4, @@ -1094,7 +1096,6 @@ declare namespace ADODB { } interface ActiveXObject { - new(progid: K): ActiveXObjectNameMap[K]; on(obj: ADODB.Connection, event: 'BeginTransComplete', argNames: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {readonly TransactionLevel: number, readonly pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, readonly pConnection: ADODB.Connection}) => void): void; on(obj: ADODB.Connection, event: 'CommitTransComplete' | 'ConnectComplete' | 'InfoMessage' | 'RollbackTransComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {readonly pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, readonly pConnection: ADODB.Connection}) => void): void; on(obj: ADODB.Connection, event: 'Disconnect', argNames: ['adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {adStatus: ADODB.EventStatusEnum, readonly pConnection: ADODB.Connection}) => void): void; diff --git a/types/activex-adodb/tsconfig.json b/types/activex-adodb/tsconfig.json index 5cb32f94c9..abf5b79a00 100644 --- a/types/activex-adodb/tsconfig.json +++ b/types/activex-adodb/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-adox/activex-adox-tests.ts b/types/activex-adox/activex-adox-tests.ts index 1b6ec21d1f..df5c75ef12 100644 --- a/types/activex-adox/activex-adox-tests.ts +++ b/types/activex-adox/activex-adox-tests.ts @@ -1,3 +1,5 @@ +/// + const collectionToArray = (col: { Item(key: any): T }): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); diff --git a/types/activex-adox/index.d.ts b/types/activex-adox/index.d.ts index 8960dd0a31..fd502684e4 100644 --- a/types/activex-adox/index.d.ts +++ b/types/activex-adox/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// /// declare namespace ADOX { @@ -320,10 +321,6 @@ declare namespace ADOX { } } -interface ActiveXObject { - new(progid: K): ActiveXObjectNameMap[K]; -} - interface ActiveXObjectNameMap { 'ADOX.Catalog': ADOX.Catalog; 'ADOX.Column': ADOX.Column; diff --git a/types/activex-adox/tsconfig.json b/types/activex-adox/tsconfig.json index 7aaa955db5..30b6288e6a 100644 --- a/types/activex-adox/tsconfig.json +++ b/types/activex-adox/tsconfig.json @@ -1,8 +1,9 @@ - { "compilerOptions": { "module": "commonjs", - "lib": ["es5", "scripthost"], + "lib": [ + "es5" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/activex-dao/activex-dao-tests.ts b/types/activex-dao/activex-dao-tests.ts index 7e8c2bef22..6eea19f8e6 100644 --- a/types/activex-dao/activex-dao-tests.ts +++ b/types/activex-dao/activex-dao-tests.ts @@ -1,3 +1,5 @@ +/// + const collectionToArray = (col: { Item(key: any): T }): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); diff --git a/types/activex-dao/index.d.ts b/types/activex-dao/index.d.ts index a2a159e324..0a13747514 100644 --- a/types/activex-dao/index.d.ts +++ b/types/activex-dao/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace DAO { const enum _DAOSuppHelp { KeepLocal = 0, @@ -883,10 +885,6 @@ declare namespace DAO { } } -interface ActiveXObject { - new(progid: K): ActiveXObjectNameMap[K]; -} - interface ActiveXObjectNameMap { 'DAO.DBEngine': DAO.DBEngine; 'DAO.Field': DAO.Field; diff --git a/types/activex-dao/tsconfig.json b/types/activex-dao/tsconfig.json index 2ddea247b9..e9d00e61e1 100644 --- a/types/activex-dao/tsconfig.json +++ b/types/activex-dao/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-diskquota/index.d.ts b/types/activex-diskquota/index.d.ts index d27863de3c..da7457e066 100644 --- a/types/activex-diskquota/index.d.ts +++ b/types/activex-diskquota/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.5 +/// + declare namespace DiskQuotaTypeLibrary { // tslint:disable-next-line no-const-enum const enum AccountStatusConstants { @@ -136,7 +138,6 @@ interface ActiveXObject { on( obj: DiskQuotaTypeLibrary.DiskQuotaControl, event: 'OnUserNameChanged', argNames: ['pUser'], handler: ( this: DiskQuotaTypeLibrary.DiskQuotaControl, parameter: {readonly pUser: DiskQuotaTypeLibrary.DIDiskQuotaUser}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { @@ -146,7 +147,3 @@ interface ActiveXObjectNameMap { interface EnumeratorConstructor { new(col: DiskQuotaTypeLibrary.DiskQuotaControl): Enumerator; } - -interface SafeArray { - _brand: SafeArray; -} diff --git a/types/activex-diskquota/tsconfig.json b/types/activex-diskquota/tsconfig.json index 597d998a96..ce9b55800d 100644 --- a/types/activex-diskquota/tsconfig.json +++ b/types/activex-diskquota/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-excel/activex-excel-tests.ts b/types/activex-excel/activex-excel-tests.ts index 4e577300e5..78291d57b5 100644 --- a/types/activex-excel/activex-excel-tests.ts +++ b/types/activex-excel/activex-excel-tests.ts @@ -1,11 +1,12 @@ +/// /// /// // some helpers const toSafeArray = (...items: T[]): SafeArray => { - const dict = new ActiveXObject('Scripting.Dictionary'); + const dict: Scripting.Dictionary = new ActiveXObject('Scripting.Dictionary'); items.forEach((x, index) => dict.Add(index, x)); - return dict.Items() as SafeArray; + return dict.Items(); }; const inCollection = (collection: { Item(index: any): T }, index: string | number): T | undefined => { let item: T | undefined; diff --git a/types/activex-excel/index.d.ts b/types/activex-excel/index.d.ts index cdf2a79551..c55bfe1c42 100644 --- a/types/activex-excel/index.d.ts +++ b/types/activex-excel/index.d.ts @@ -9723,7 +9723,6 @@ interface ActiveXObject { set(obj: Excel.Workbook, propertyName: 'Colors', parameterTypes: [any], newValue: any): void; set(obj: Excel.Range, propertyName: 'Value', parameterTypes: [Excel.XlRangeValueDataType], newValue: any): void; set(obj: Excel.Range, propertyName: 'Value', newValue: any): void; // because Value is defined on the type as a method, not a property - new (progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-excel/tsconfig.json b/types/activex-excel/tsconfig.json index 244ab1d0ef..0b346a4a25 100644 --- a/types/activex-excel/tsconfig.json +++ b/types/activex-excel/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts b/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts index ef3e403998..478e816eb7 100644 --- a/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts +++ b/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts @@ -1,4 +1,5 @@ -/// +/// +/// const collectionToArray = (col: { Item(index: any): T } | SafeArray) => { const results: T[] = []; @@ -12,9 +13,9 @@ const collectionToArray = (col: { Item(index: any): T } | SafeArray) => { }; const toSafeArray = (...items: T[]): SafeArray => { - const dict = new ActiveXObject('Scripting.Dictionary'); + const dict: Scripting.Dictionary = new ActiveXObject('Scripting.Dictionary'); items.forEach((x, index) => dict.Add(index, x)); - return dict.Items() as SafeArray; + return dict.Items(); }; const VB = { diff --git a/types/activex-faxcomexlib/index.d.ts b/types/activex-faxcomexlib/index.d.ts index d4078061f7..ffd2412ef3 100644 --- a/types/activex-faxcomexlib/index.d.ts +++ b/types/activex-faxcomexlib/index.d.ts @@ -2011,7 +2011,6 @@ interface ActiveXObject { this: FAXCOMEXLib.FaxServer, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; on(obj: FAXCOMEXLib.FaxAccount, event: 'AddRef' | 'Release', handler: (this: FAXCOMEXLib.FaxAccount, parameter: {}) => void): void; on(obj: FAXCOMEXLib.FaxServer, event: 'AddRef' | 'Release', handler: (this: FAXCOMEXLib.FaxServer, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-faxcomexlib/tsconfig.json b/types/activex-faxcomexlib/tsconfig.json index 6509ab4701..8443d46f26 100644 --- a/types/activex-faxcomexlib/tsconfig.json +++ b/types/activex-faxcomexlib/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-infopath/index.d.ts b/types/activex-infopath/index.d.ts index c00c67e197..9cace4ec2e 100644 --- a/types/activex-infopath/index.d.ts +++ b/types/activex-infopath/index.d.ts @@ -1168,7 +1168,6 @@ interface ActiveXObject { on(obj: InfoPath.Button, event: 'AddRef' | 'Release', handler: (this: InfoPath.Button, parameter: {}) => void): void; on(obj: InfoPath.DataDOM, event: 'AddRef' | 'Release', handler: (this: InfoPath.DataDOM, parameter: {}) => void): void; on(obj: InfoPath.XDocument, event: 'AddRef' | 'Release', handler: (this: InfoPath.XDocument, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-infopath/tsconfig.json b/types/activex-infopath/tsconfig.json index 6feef8496c..db2712e264 100644 --- a/types/activex-infopath/tsconfig.json +++ b/types/activex-infopath/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts b/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts new file mode 100644 index 0000000000..67efbd3eca --- /dev/null +++ b/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts @@ -0,0 +1,62 @@ +/// + +const collectionToArray = (col: { Item(key: any): T }): T[] => { + const results: T[] = []; + const enumerator = new Enumerator(col); + enumerator.moveFirst(); + while (!enumerator.atEnd()) { + results.push(enumerator.item()); + enumerator.moveNext(); + } + return results; +}; + +const wshn = new ActiveXObject('WScript.Network'); + +// https://msdn.microsoft.com/en-us/library/s6wt333f(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/wck0hkd7(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/tte130y1(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/3fxhka75(v=vs.84).aspx +{ + WScript.Echo('Domain = ' + wshn.UserDomain); + WScript.Echo('Computer Name = ' + wshn.ComputerName); + WScript.Echo('User Name = ' + wshn.UserName); +} + +// https://msdn.microsoft.com/en-us/library/zsdh7hkb(v=vs.84).aspx +wshn.AddWindowsPrinterConnection('\\\\printserv\\DefaultPrinter'); + +// https://msdn.microsoft.com/en-us/library/kxsdca3c(v=vs.84).aspx +wshn.AddPrinterConnection("LPT1", "\\\\Server\\Print1"); + +// https://msdn.microsoft.com/en-us/library/t9zt39at(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/zhds6k80(v=vs.84).aspx +{ + const drives = wshn.EnumNetworkDrives(); + const printers = wshn.EnumPrinterConnections(); + WScript.Echo("Network drive mappings:"); + for (let i = 0; i < drives.length; i += 2) { + WScript.Echo(`Drive ${drives.Item(i)} = ${drives.Item(i + 1)}`); + } + WScript.Echo(''); + WScript.Echo("Network printer mappings:"); + for (let i = 0; i < printers.length; i += 2) { + WScript.Echo(`Port ${printers.Item(i)} = ${printers.Item(i + 1)}`); + } +} + +// https://msdn.microsoft.com/en-us/library/8kst88h6(v=vs.84).aspx +wshn.MapNetworkDrive('E:', '\\\\Server\\Public'); + +// https://msdn.microsoft.com/en-us/library/d16d7wbf(v=vs.84).aspx +wshn.RemoveNetworkDrive('E:'); + +// https://msdn.microsoft.com/en-us/library/tsbh2yy7(v=vs.84).aspx +wshn.RemovePrinterConnection('\\\\PRN-CORP1\\B41-4523-A', true, true); + +// https://msdn.microsoft.com/en-us/library/2ccwwdct(v=vs.84).aspx +{ + const printerPath = "\\\\research\\library1"; + wshn.AddWindowsPrinterConnection(printerPath); + wshn.SetDefaultPrinter(printerPath); +} diff --git a/types/activex-iwshruntimelibrary/index.d.ts b/types/activex-iwshruntimelibrary/index.d.ts new file mode 100644 index 0000000000..1f89c2b84a --- /dev/null +++ b/types/activex-iwshruntimelibrary/index.d.ts @@ -0,0 +1,437 @@ +// Type definitions for Windows Script Host Runtime Object Model 0.0 +// Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx +// Definitions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +declare namespace IWshRuntimeLibrary { + type WindowStyle = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; + type ShortcutWindowStyle = 1 | 3 | 7; + + const enum ButtonType { + OK, + OKCancel, + AbortRetryIgnore, + YesNoCancel, + YesNo, + RetryCancel, + CancelTryagainContinue + } + + const enum EventType { + AuditFailure = 5, + AuditSuccess = 4, + Error = 1, + Information = 3, + Success = 0, + Warning = 2 + } + + const enum IconType { + Stop = 16, + QuestionMark = 32, + ExclamationMakr = 48, + InformationMark = 64, + } + + const enum PopupType { + SecondButtonDefault = 256, + ThirdButtonDefault = 512, + Modal = 4096, + RightJustified = 524288, + RTL = 1048576, + } + + const enum PopupSelection { + NoButton = -1, + OK = 1, + Cancel = 2, + Abort = 3, + Retry = 4, + Ignore = 5, + Yes = 6, + No = 7, + TryAgain = 10, + Continue = 11, + } + + const enum WshExecStatus { + WshFailed = 2, + WshFinished = 1, + WshRunning = 0, + } + + const enum WshWindowStyle { + WshHide = 0, + WshMaximizedFocus = 3, + WshMinimizedFocus = 2, + WshMinimizedNoFocus = 6, + WshNormalFocus = 1, + WshNormalNoFocus = 4, + } + + class TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + + /** + * The current line number in an input stream. + */ + Line: number; + + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If + * you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; + } + + class TextStreamWriter extends TextStreamBase { + private 'IWshRuntimeLibrary.TextStreamWriter_typekey': TextStreamWriter; + private constructor(); + + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; + } + + class TextStreamReader extends TextStreamBase { + private 'IWshRuntimeLibrary.TextStreamReader_typekey': TextStreamReader; + private constructor(); + + /** + * Returns a specified number of characters from an input stream, starting at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; + } + + /** Generic Collection Object */ + interface WshCollection { + Count(): number; + Item(Index: any): any; + readonly length: number; + (Index: any): any; + } + + /** Environment Variables Collection Object */ + interface WshEnvironment { + Count(): number; + Item(Name: string): string; + readonly Length: number; + Remove(Name: string): void; + (Name: string): string; + } + + /** WSHExec object */ + class WshExec { + private 'IWshRuntimeLibrary.WshExec_typekey': WshExec; + private constructor(); + readonly ExitCode: number; + readonly ProcessID: number; + readonly Status: WshExecStatus; + readonly StdErr: TextStreamWriter; + readonly StdIn: TextStreamReader; + readonly StdOut: TextStreamWriter; + Terminate(): void; + } + + /** Network Object */ + class WshNetwork { + private 'IWshRuntimeLibrary.WshNetwork_typekey': WshNetwork; + private constructor(); + + /** + * Adds a remote MS-DOS-based printer connection to your computer system. + * @param LocalName Local name to assign to the connected printer. + * @param RemoteName Name of the remote printer. + * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. + * + * If you are mapping a remote printer using the profile of someone other than current user, you can specify _UserName_ and _Password_. + */ + AddPrinterConnection(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; + + /** + * @param string Path to printer connection + * @param string [DriverName=''] + * @param string [Port='LPT1'] + * + * Unlike the **AddPrinterConnection** method, this method allows you to create a printer connection without directing it to a specific port, such as LPT1. + */ + AddWindowsPrinterConnection(PrinterName: string, DriverName?: string, Port?: string): void; + readonly ComputerName: string; + EnumNetworkDrives(): WshCollection; + EnumPrinterConnections(): WshCollection; + + /** + * Adds a remote MS-DOS-based printer connection to your computer system. + * @param LocalName Name by which the mapped drive will be known locally + * @param RemoteName Share's UNC name (\\xxx\yyy) + * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. + * + * If you are mapping a network drive using the profile of someone other than current user, you can specify _UserName_ and _Password_. + */ + MapNetworkDrive(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; + readonly Organization: string; + + /** + * Removes a shared network drive from your computer system + * @param Name Name of the mapped drive you want to remove. This will be the drive letter if the drive has a mapping between a local name (drive letter) and a remote name (UNC name); + * it will be the UNC path if there is no such mapping + * @param Force [false] Remove the connections even if the resource is in use + * @param UpdateProfile [false] Remove the mapping from the user's profile + */ + RemoveNetworkDrive(Name: string, Force?: boolean, UpdateProfile?: boolean): void; + + /** + * Removes a shared network printer connection from your computer system + * @param Name Name that identifies the printer. Can be a UNC name (in the form `\\xxx\yyy`) or a local name (such as `LPT1`) + * @param Force [false] Remove printer connection even if a user is still connected + * @param UpdateProfile [false] Remove the printer connection from the user's profile + * + * The **RemovePrinterConnection** method removes both Windows and MS-DOS based printer connections. If the printer was connected using the method **AddPrinterConnection**, + * _Name_ must be the printer's local name. If the printer was connected using the **AddWindowsPrinterConnection** method or was added manually (using the Add Printer wizard), + * then _Name_ must be the printer's UNC name. + */ + RemovePrinterConnection(Name: string, Force?: true, UpdateProfile?: true): void; + SetDefaultPrinter(Name: string): void; + readonly Site: string; + readonly UserDomain: string; + readonly UserName: string; + readonly UserProfile: string; + } + + /** Shell Object */ + class WshShell { + private 'IWshRuntimeLibrary.WshShell_typekey': WshShell; + private constructor(); + + /** + * Activates an application window + * @param App Title of application as it appears in the title bar, or the process ID + * @param Wait + * + * This method changes the focus to the named application or window. The window must be attached to the calling thread's message queue. It does not affect whether it is maximized or + * minimized. Focus moves from the activated application window when the user takes action to change the focus (or closes the window). + * + * In determining which application to activate, the specified title is compared to the title string of each running application. If no exact match exists, any application whose title + * string begins with title is activated. If an application still cannot be found, any application whose title string ends with title is activated. If more than one instance of the + * application named by title exists, one instance is arbitrarily activated. + * + * The method might return `false` under the following conditions: + * + * * The window is not brought to the foreground. + * * The window is brought to the foreground but is not given keyboard focus. + * * A Command Prompt window (`cmd.exe`) is brought to the foreground and is given keyboard focus. + */ + AppActivate(App: string | number, Wait?: any): boolean; + + /** + * Creates a shortcut + * @param PathLink Path where the shortcut should be created + * + * The shortcut object exists in memory until you save it to disk with the **Save** method. + */ + CreateShortcut(PathLink: string): WshShortcut | WshURLShortcut; + CurrentDirectory: string; + + /** + * Note that **Environment** doesn't actually return a callable object; the call is only usable in the context of the **Environment** property. The following: + * + * let env = new ActiveXObject('WScript.Shell').Environment; + * WScript.Echo(env('System')); + * + * will return an empty string, unless there is an environment variable named `System` + */ + Environment: WshEnvironment & ((Type: 'System' | 'User' | 'Process' | 'Volatile') => WshEnvironment); + Exec(Command: string): WshExec; + ExpandEnvironmentStrings(Src: string): string; + + /** @param string [Target=''] Name of the computer system where the event should be logged; default is the local computer system */ + LogEvent(Type: EventType, Message: string, Target?: string): boolean; + Popup(Text: string, SecondsToWait?: number, Title?: string, Type?: ButtonType | IconType | PopupType): PopupSelection; + RegDelete(Name: string): void; + + /** + * Returns the value of a key or value-name from the registry + * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) + * + * Returns one of the following, based on the registry value type: + * + * * **REG_SZ** -- a string + * * **REG_DWORD** -- a number + * * **REG_SBINARY** -- a binary value, as a COM SafeArray containing integers + * * **REG_EXPAND_SZ** -- an expandable string + * * **REG_MULTI_SZ** -- an array of srings, as a COM SafeArray + */ + RegRead(Name: string): string | number | SafeArray | SafeArray; + + /** + * Creates a new key, adds another value-name to an existing key and assigns it a value, or changes the value of an existing value-name + * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) + * @param Value Will be coerced to `string` or `integer` based on the value-name type: + * `REG_SZ | REG_EXPAND_SZ` will be converted to `string`; + * `REG_DWORD | REG_BINARY` will be converted to `integer` + * @param Type + */ + RegWrite(Name: string, Value: any, Type?: 'REG_SZ' | 'REG_DWORD' | 'REG_BINARY' | 'REG_EXPAND_SZ'): void; + + /** + * Runs a program in a new process. + * @param Command Command-line, including any parameters you want to pass to the executable file. + * @param WindowStyle Appearance of the program window. Not all programs make use of this information. + * @param WaitOnReturn Block script until program finishes executing. + * + * If `false` is passed into **WaitOnReturn**, the **Run** method will return 0 immediately. If `true` is passed in, **Run** will return the program's error code, if any. + * + * Environment variables will be expanded within the command line. + * + * Passing a registered file type will automatically open the program registered to the file type. + * + * Possible values for **WindowStyle**: + * + * * **0** -- Hides the window and activates another window. + * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when displaying the window for the first time. + * * **2** -- Activates the window and displays it as a minimized window. + * * **3** -- Activates the window and displays it as a maximized window. + * * **4** -- Displays a window in its most recent size and position. The active window remains active. + * * **5** -- Activates the window and displays it in its current size and position. + * * **6** -- Minimizes the specified window and activates the next top-level window in the Z order. + * * **7** -- Displays the window as a minimized window. The active window remains active. + * * **8** -- Displays the window in its current state. The active window remains active. + * * **9** -- Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when restoring a minimized window. + * * **10** -- Sets the show-state based on the state of the program that started the application. + */ + Run(Command: string, WindowStyle?: WindowStyle, WaitOnReturn?: boolean): number; + SendKeys(Keys: string, Wait?: boolean): void; + readonly SpecialFolders: WshCollection; + } + + /** Shortcut Object */ + class WshShortcut { + private 'IWshRuntimeLibrary.WshShortcut_typekey': WshShortcut; + private constructor(); + Arguments: string; + Description: string; + readonly FullName: string; + Hotkey: string; + IconLocation: string; + Load(PathLink: string): void; + readonly RelativePath: string; + Save(): void; + TargetPath: string; + + /** + * Possible values: + * + * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when displaying the window for the first time. + * * **3** -- Activates the window and displays it as a maximized window. + * * **7** -- Displays the window as a minimized window. The active window remains active. + */ + WindowStyle: ShortcutWindowStyle; + WorkingDirectory: string; + } + + /** URLShortcut Object */ + class WshURLShortcut { + private 'IWshRuntimeLibrary.WshURLShortcut_typekey': WshURLShortcut; + private constructor(); + readonly FullName: string; + Load(PathLink: string): void; + Save(): void; + TargetPath: string; + } +} +declare namespace WSHControllerLibrary { + class WSHController { + private 'WSHControllerLibrary.WSHController_typekey': WSHController; + private constructor(); + CreateScript(Command: string, Server?: any): any; + } +} + +declare namespace ScriptSigner { + class Signer { + private 'ScriptSigner.Signer_typekey': Signer; + private constructor(); + + /** @param Store [Store='my'] */ + Sign(FileExtension: string, Text: string, Certificate: string, Store?: string): string; + + /** @param Store [Store='my'] */ + SignFile(FileName: string, Certificate: string, Store?: string): void; + + /** @param ShowUI [ShowUI=false] */ + Verify(FileExtension: string, Text: string, ShowUI?: boolean): boolean; + + /** @param ShowUI [ShowUI=false] */ + VerifyFile(FileName: string, ShowUI?: boolean): boolean; + } +} + +interface ActiveXObjectNameMap { + 'WSHController': WSHControllerLibrary.WSHController; + 'Scripting.Signer': ScriptSigner.Signer; + 'WScript.Network': IWshRuntimeLibrary.WshNetwork; + 'WScript.Shell': IWshRuntimeLibrary.WshShell; +} + +interface ActiveXObject { + set(obj: IWshRuntimeLibrary.WshEnvironment, propertyName: 'Item', parameterTypes: [string], newValue: string): void; +} diff --git a/types/activex-iwshruntimelibrary/tsconfig.json b/types/activex-iwshruntimelibrary/tsconfig.json new file mode 100644 index 0000000000..885ca81980 --- /dev/null +++ b/types/activex-iwshruntimelibrary/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "activex-iwshruntimelibrary-tests.ts" + ] +} diff --git a/types/activex-iwshruntimelibrary/tslint.json b/types/activex-iwshruntimelibrary/tslint.json new file mode 100644 index 0000000000..ed91c31f9c --- /dev/null +++ b/types/activex-iwshruntimelibrary/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-const-enum": false + } +} \ No newline at end of file diff --git a/types/activex-libreoffice/activex-libreoffice-tests.ts b/types/activex-libreoffice/activex-libreoffice-tests.ts index bafe014f59..87cf55eb8c 100644 --- a/types/activex-libreoffice/activex-libreoffice-tests.ts +++ b/types/activex-libreoffice/activex-libreoffice-tests.ts @@ -1,3 +1,5 @@ +/// + (() => { // https://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/Automation_Bridge diff --git a/types/activex-libreoffice/index.d.ts b/types/activex-libreoffice/index.d.ts index 1698317e8f..3459215083 100644 --- a/types/activex-libreoffice/index.d.ts +++ b/types/activex-libreoffice/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +/// + declare class type { private typekey: type; } @@ -12,9 +14,6 @@ declare class sequence { private typekey: sequence; } -// tslint:disable-next-line no-empty-interface -interface SafeArray {} - declare namespace com.sun.star { namespace accessibility { /** diff --git a/types/activex-libreoffice/tsconfig.json b/types/activex-libreoffice/tsconfig.json index 712ea46ca1..b6e9a7be63 100644 --- a/types/activex-libreoffice/tsconfig.json +++ b/types/activex-libreoffice/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-msforms/index.d.ts b/types/activex-msforms/index.d.ts index c896cc4bf5..a9b5e8f8ac 100644 --- a/types/activex-msforms/index.d.ts +++ b/types/activex-msforms/index.d.ts @@ -1564,7 +1564,6 @@ interface ActiveXObject { set(obj: MSForms.ComboBox | MSForms.ListBox, propertyName: 'Column' | 'List', parameterTypes: [number, number] | [number], newValue: any): void; set(obj: MSForms.ComboBox | MSForms.ListBox, propertyName: 'Column' | 'List', parameterTypes: number[], newValue: SafeArray): void; set(obj: MSForms.ListBox, propertyName: 'Selected', parameterTypes: [any], newValue: boolean): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-msforms/tsconfig.json b/types/activex-msforms/tsconfig.json index 38f907552d..074a493c66 100644 --- a/types/activex-msforms/tsconfig.json +++ b/types/activex-msforms/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-mshtml/activex-mshtml-tests.ts b/types/activex-mshtml/activex-mshtml-tests.ts index 324d3d09e2..bdf7f3dec3 100644 --- a/types/activex-mshtml/activex-mshtml-tests.ts +++ b/types/activex-mshtml/activex-mshtml-tests.ts @@ -1,3 +1,5 @@ +/// + let htmlfile = new ActiveXObject('htmlfile'); let htmldoc = htmlfile.createDocumentFromUrl('https://msdn.microsoft.com/en-us/library/aa741317(v=vs.85).aspx', 'null'); let length = htmldoc.all.length; diff --git a/types/activex-mshtml/index.d.ts b/types/activex-mshtml/index.d.ts index 94466927d7..b2f8a92883 100644 --- a/types/activex-mshtml/index.d.ts +++ b/types/activex-mshtml/index.d.ts @@ -35570,7 +35570,6 @@ interface ActiveXObject { on(obj: MSHTML.SVGTSpanElement, event: 'onactivate' | 'onafterupdate' | 'onbeforeactivate' | 'onbeforecopy' | 'onbeforecut' | 'onbeforedeactivate' | 'onbeforeeditfocus' | 'onbeforepaste' | 'onbeforeupdate' | 'onblur' | 'oncellchange' | 'onclick' | 'oncontextmenu' | 'oncontrolselect' | 'oncopy' | 'oncut' | 'ondataavailable' | 'ondatasetchanged' | 'ondatasetcomplete' | 'ondblclick' | 'ondeactivate' | 'ondrag' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondragstart' | 'ondrop' | 'onerrorupdate' | 'onfilterchange' | 'onfocus' | 'onfocusin' | 'onfocusout' | 'onhelp' | 'onkeydown' | 'onkeypress' | 'onkeyup' | 'onlayoutcomplete' | 'onlosecapture' | 'onmousedown' | 'onmouseenter' | 'onmouseleave' | 'onmousemove' | 'onmouseout' | 'onmouseover' | 'onmouseup' | 'onmousewheel' | 'onmove' | 'onmoveend' | 'onmovestart' | 'onpage' | 'onpaste' | 'onpropertychange' | 'onreadystatechange' | 'onresize' | 'onresizeend' | 'onresizestart' | 'onrowenter' | 'onrowexit' | 'onrowsdelete' | 'onrowsinserted' | 'onscroll' | 'onselectstart', handler: (this: MSHTML.SVGTSpanElement, parameter: {}) => void): void; on(obj: MSHTML.SVGUseElement, event: 'onactivate' | 'onafterupdate' | 'onbeforeactivate' | 'onbeforecopy' | 'onbeforecut' | 'onbeforedeactivate' | 'onbeforeeditfocus' | 'onbeforepaste' | 'onbeforeupdate' | 'onblur' | 'oncellchange' | 'onclick' | 'oncontextmenu' | 'oncontrolselect' | 'oncopy' | 'oncut' | 'ondataavailable' | 'ondatasetchanged' | 'ondatasetcomplete' | 'ondblclick' | 'ondeactivate' | 'ondrag' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondragstart' | 'ondrop' | 'onerrorupdate' | 'onfilterchange' | 'onfocus' | 'onfocusin' | 'onfocusout' | 'onhelp' | 'onkeydown' | 'onkeypress' | 'onkeyup' | 'onlayoutcomplete' | 'onlosecapture' | 'onmousedown' | 'onmouseenter' | 'onmouseleave' | 'onmousemove' | 'onmouseout' | 'onmouseover' | 'onmouseup' | 'onmousewheel' | 'onmove' | 'onmoveend' | 'onmovestart' | 'onpage' | 'onpaste' | 'onpropertychange' | 'onreadystatechange' | 'onresize' | 'onresizeend' | 'onresizestart' | 'onrowenter' | 'onrowexit' | 'onrowsdelete' | 'onrowsinserted' | 'onscroll' | 'onselectstart', handler: (this: MSHTML.SVGUseElement, parameter: {}) => void): void; on(obj: MSHTML.SVGViewElement, event: 'onactivate' | 'onafterupdate' | 'onbeforeactivate' | 'onbeforecopy' | 'onbeforecut' | 'onbeforedeactivate' | 'onbeforeeditfocus' | 'onbeforepaste' | 'onbeforeupdate' | 'onblur' | 'oncellchange' | 'onclick' | 'oncontextmenu' | 'oncontrolselect' | 'oncopy' | 'oncut' | 'ondataavailable' | 'ondatasetchanged' | 'ondatasetcomplete' | 'ondblclick' | 'ondeactivate' | 'ondrag' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondragstart' | 'ondrop' | 'onerrorupdate' | 'onfilterchange' | 'onfocus' | 'onfocusin' | 'onfocusout' | 'onhelp' | 'onkeydown' | 'onkeypress' | 'onkeyup' | 'onlayoutcomplete' | 'onlosecapture' | 'onmousedown' | 'onmouseenter' | 'onmouseleave' | 'onmousemove' | 'onmouseout' | 'onmouseover' | 'onmouseup' | 'onmousewheel' | 'onmove' | 'onmoveend' | 'onmovestart' | 'onpage' | 'onpaste' | 'onpropertychange' | 'onreadystatechange' | 'onresize' | 'onresizeend' | 'onresizestart' | 'onrowenter' | 'onrowexit' | 'onrowsdelete' | 'onrowsinserted' | 'onscroll' | 'onselectstart', handler: (this: MSHTML.SVGViewElement, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-mshtml/tsconfig.json b/types/activex-mshtml/tsconfig.json index deba2b6ba3..1ef33423ee 100644 --- a/types/activex-mshtml/tsconfig.json +++ b/types/activex-mshtml/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-msxml2/activex-msxml2-tests.ts b/types/activex-msxml2/activex-msxml2-tests.ts index 470f35d785..01ef12802e 100644 --- a/types/activex-msxml2/activex-msxml2-tests.ts +++ b/types/activex-msxml2/activex-msxml2-tests.ts @@ -1,3 +1,5 @@ +/// + // https://msdn.microsoft.com/en-us/library/ms764708(v=vs.85).aspx { const dom = new ActiveXObject('Msxml2.DOMDocument.6.0'); diff --git a/types/activex-msxml2/index.d.ts b/types/activex-msxml2/index.d.ts index 6f43ba02c5..5353864443 100644 --- a/types/activex-msxml2/index.d.ts +++ b/types/activex-msxml2/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +/// + declare namespace MSXML2 { /** Schema Object Model Content Types */ const enum _SCHEMACONTENTTYPE { @@ -2775,7 +2777,6 @@ declare namespace MSXML2 { interface ActiveXObject { on(obj: MSXML2.DOMDocument60, event: 'ondataavailable' | 'onreadystatechange', handler: (this: MSXML2.DOMDocument60, parameter: {}) => void): void; on(obj: MSXML2.FreeThreadedDOMDocument60, event: 'ondataavailable' | 'onreadystatechange', handler: (this: MSXML2.FreeThreadedDOMDocument60, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-msxml2/tsconfig.json b/types/activex-msxml2/tsconfig.json index 49c53f71ca..fe55b33d3c 100644 --- a/types/activex-msxml2/tsconfig.json +++ b/types/activex-msxml2/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-office/activex-office-tests.ts b/types/activex-office/activex-office-tests.ts index 7aab0b4521..4dd24fd547 100644 --- a/types/activex-office/activex-office-tests.ts +++ b/types/activex-office/activex-office-tests.ts @@ -1,3 +1,4 @@ +/// /// const collectionToArray = (col: { Item(key: any): T }): T[] => { diff --git a/types/activex-office/tsconfig.json b/types/activex-office/tsconfig.json index 729657e813..6ded50cfda 100644 --- a/types/activex-office/tsconfig.json +++ b/types/activex-office/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-outlook/index.d.ts b/types/activex-outlook/index.d.ts index 37628722b5..2b316d80bd 100644 --- a/types/activex-outlook/index.d.ts +++ b/types/activex-outlook/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// /// /// @@ -5855,7 +5856,6 @@ interface ActiveXObject { on(obj: Outlook.TaskRequestDeclineItem, event: 'AfterWrite' | 'BeforeRead' | 'Read' | 'Unload', handler: (this: Outlook.TaskRequestDeclineItem, parameter: {}) => void): void; on(obj: Outlook.TaskRequestItem, event: 'AfterWrite' | 'BeforeRead' | 'Read' | 'Unload', handler: (this: Outlook.TaskRequestItem, parameter: {}) => void): void; on(obj: Outlook.TaskRequestUpdateItem, event: 'AfterWrite' | 'BeforeRead' | 'Read' | 'Unload', handler: (this: Outlook.TaskRequestUpdateItem, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-outlook/tsconfig.json b/types/activex-outlook/tsconfig.json index 1a9fddc714..1a7c466608 100644 --- a/types/activex-outlook/tsconfig.json +++ b/types/activex-outlook/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-powerpoint/activex-powerpoint-tests.ts b/types/activex-powerpoint/activex-powerpoint-tests.ts index 3f2bedf8cd..eb5a2e4c05 100644 --- a/types/activex-powerpoint/activex-powerpoint-tests.ts +++ b/types/activex-powerpoint/activex-powerpoint-tests.ts @@ -1,5 +1,5 @@ // tslint:disable-next-line no-unnecessary-generics -const collectionToArray = (col: any): T[] => { +const collectionToArray = (col: {Item(index: any): T}): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); enumerator.moveFirst(); @@ -13,8 +13,8 @@ const collectionToArray = (col: any): T[] => { const app = new ActiveXObject('PowerPoint.Application'); (() => { // delete empty textboxes in PowerPoint - collectionToArray(app.ActivePresentation.Slides).forEach(slide => { - collectionToArray(slide.Shapes).filter(shape => + collectionToArray(app.ActivePresentation.Slides).forEach(slide => { + collectionToArray(slide.Shapes).filter(shape => shape.Type === Office.MsoShapeType.msoTextBox && shape.TextFrame.TextRange.Text.trim() === '' ).forEach(shape => shape.Delete()); diff --git a/types/activex-powerpoint/index.d.ts b/types/activex-powerpoint/index.d.ts index ee59fd0be4..34e722a8a0 100644 --- a/types/activex-powerpoint/index.d.ts +++ b/types/activex-powerpoint/index.d.ts @@ -5374,7 +5374,6 @@ interface ActiveXObject { this: PowerPoint.Application, parameter: {readonly Sel: PowerPoint.Selection, Cancel: boolean}) => void): void; on(obj: PowerPoint.Application, event: 'WindowSelectionChange', argNames: ['Sel'], handler: (this: PowerPoint.Application, parameter: {readonly Sel: PowerPoint.Selection}) => void): void; on(obj: PowerPoint.OLEControl, event: 'GotFocus' | 'LostFocus', handler: (this: PowerPoint.OLEControl, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-powerpoint/tsconfig.json b/types/activex-powerpoint/tsconfig.json index 8a0392da3f..25bcee9fa3 100644 --- a/types/activex-powerpoint/tsconfig.json +++ b/types/activex-powerpoint/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-scripting/activex-scripting-tests.ts b/types/activex-scripting/activex-scripting-tests.ts index 313e480cb5..f3ee3218ca 100644 --- a/types/activex-scripting/activex-scripting-tests.ts +++ b/types/activex-scripting/activex-scripting-tests.ts @@ -1,3 +1,5 @@ +/// + // Note -- running these tests under cscript requires some ES5 polyfills const collectionToArray = (col: { Item(key: any): T }): T[] => { diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts index 42e4f0c9e0..e0f8ba306d 100644 --- a/types/activex-scripting/index.d.ts +++ b/types/activex-scripting/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace Scripting { // tslint:disable-next-line:no-const-enum const enum CompareMethod { @@ -489,7 +491,6 @@ declare namespace Scripting { } interface ActiveXObject { - new (progid: K): ActiveXObjectNameMap[K]; set(obj: Scripting.Dictionary, propertyName: 'Item', parameterTypes: [any], newValue: any): void; } diff --git a/types/activex-scripting/tsconfig.json b/types/activex-scripting/tsconfig.json index e2008551fd..11cfcc44a4 100644 --- a/types/activex-scripting/tsconfig.json +++ b/types/activex-scripting/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-shdocvw/index.d.ts b/types/activex-shdocvw/index.d.ts index 86568f6c5d..f450ea6112 100644 --- a/types/activex-shdocvw/index.d.ts +++ b/types/activex-shdocvw/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace SHDocVw { // tslint:disable-next-line no-const-enum const enum BrowserBarConstants { @@ -1562,7 +1564,6 @@ interface ActiveXObject { on(obj: SHDocVw.ShellNameSpace, event: 'DoubleClick' | 'Initialized' | 'SelectionChange', handler: (this: SHDocVw.ShellNameSpace, parameter: {}) => void): void; on(obj: SHDocVw.WebBrowser, event: 'DownloadBegin' | 'DownloadComplete' | 'OnQuit', handler: (this: SHDocVw.WebBrowser, parameter: {}) => void): void; on(obj: SHDocVw.WebBrowser_V1, event: 'DownloadBegin' | 'DownloadComplete' | 'WindowActivate' | 'WindowMove' | 'WindowResize', handler: (this: SHDocVw.WebBrowser_V1, parameter: {}) => void): void; - new (progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { @@ -1571,7 +1572,3 @@ interface ActiveXObjectNameMap { 'Shell.UIHelper': SHDocVw.ShellUIHelper; 'ShellNameSpace.ShellNameSpace': SHDocVw.ShellNameSpace; } - -interface EnumeratorConstructor { - new(col: SHDocVw.ShellWindows): Enumerator; -} diff --git a/types/activex-shdocvw/tsconfig.json b/types/activex-shdocvw/tsconfig.json index 1907cb1ef6..2a388d4c7d 100644 --- a/types/activex-shdocvw/tsconfig.json +++ b/types/activex-shdocvw/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-shell/activex-shell-tests.ts b/types/activex-shell/activex-shell-tests.ts index f236f6e592..b9fd3b18fd 100644 --- a/types/activex-shell/activex-shell-tests.ts +++ b/types/activex-shell/activex-shell-tests.ts @@ -1,4 +1,4 @@ -/// +/// const shell = new ActiveXObject('Shell.Application'); diff --git a/types/activex-shell/index.d.ts b/types/activex-shell/index.d.ts index cb59a11c5e..f12d135979 100644 --- a/types/activex-shell/index.d.ts +++ b/types/activex-shell/index.d.ts @@ -1001,7 +1001,6 @@ interface ActiveXObject { on( obj: Shell32.ShellFolderViewOC, event: 'BeginDrag' | 'DefaultVerbInvoked' | 'EnumDone' | 'SelectionChanged' | 'VerbInvoked', handler: (this: Shell32.ShellFolderViewOC, parameter: {}) => void): void; - new (progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-shell/tsconfig.json b/types/activex-shell/tsconfig.json index f4b549f649..364b5716de 100644 --- a/types/activex-shell/tsconfig.json +++ b/types/activex-shell/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-stdole/index.d.ts b/types/activex-stdole/index.d.ts index e738e4f03d..070a84a30a 100644 --- a/types/activex-stdole/index.d.ts +++ b/types/activex-stdole/index.d.ts @@ -4,15 +4,23 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace stdole { + type IFontDisp = StdFont; + type IPictureDisp = StdPicture; type OLE_COLOR = number; type OLE_XPOS_CONTAINER = number; + type OLE_XPOS_PIXELS = number; + type OLE_YPOS_CONTAINER = number; + type OLE_YPOS_PIXELS = number; + const enum LoadPictureConstants { Color = 4, Default = 0, @@ -79,7 +87,6 @@ declare namespace stdole { interface ActiveXObject { on(obj: stdole.StdFont, event: 'FontChanged', argNames: ['PropertyName'], handler: (this: stdole.StdFont, parameter: {readonly PropertyName: string}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-stdole/tsconfig.json b/types/activex-stdole/tsconfig.json index cbe3ce7aae..24ea6a5417 100644 --- a/types/activex-stdole/tsconfig.json +++ b/types/activex-stdole/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-vbide/activex-vbide-tests.ts b/types/activex-vbide/activex-vbide-tests.ts index 02209ec9bd..5780d36b1a 100644 --- a/types/activex-vbide/activex-vbide-tests.ts +++ b/types/activex-vbide/activex-vbide-tests.ts @@ -1,3 +1,4 @@ +/// /// const collectionToArray = (col: { Item(key: any): T }): T[] => { diff --git a/types/activex-vbide/tsconfig.json b/types/activex-vbide/tsconfig.json index 6fb205a3c4..5d27488056 100644 --- a/types/activex-vbide/tsconfig.json +++ b/types/activex-vbide/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index 8fc7dcfd2e..25d025cc90 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -1,3 +1,5 @@ +/// + // Note -- running these tests under cscript requires some ES5 polyfills const collectionToArray = (col: { Item(key: any): T }): T[] => { diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts index 18e474e09c..5a06471ff8 100644 --- a/types/activex-wia/index.d.ts +++ b/types/activex-wia/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace WIA { /** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */ const enum CommandID { @@ -791,7 +793,6 @@ declare namespace WIA { } interface ActiveXObject { - new(progid: K): ActiveXObjectNameMap[K]; on(obj: WIA.DeviceManager, event: 'OnEvent', argNames: ['EventID', 'DeviceID', 'ItemID'], handler: ( this: WIA.DeviceManager, parameter: { readonly EventID: string, readonly DeviceID: string, readonly ItemID: string }) => void): void; set(obj: WIA.Vector, propertyName: 'Item', parameterTypes: [number], newValue: TItem): void; diff --git a/types/activex-wia/tsconfig.json b/types/activex-wia/tsconfig.json index e77b3d1b66..48ed56e82e 100644 --- a/types/activex-wia/tsconfig.json +++ b/types/activex-wia/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-word/activex-word-tests.ts b/types/activex-word/activex-word-tests.ts index 4a0000e6fa..2b44a5ba22 100644 --- a/types/activex-word/activex-word-tests.ts +++ b/types/activex-word/activex-word-tests.ts @@ -1,5 +1,7 @@ +/// + // tslint:disable-next-line no-unnecessary-generics -const collectionToArray = (col: any): T[] => { +const collectionToArray = (col: {Item(index: any): T}): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); enumerator.moveFirst(); @@ -233,7 +235,7 @@ const activeDoc = app.ActiveDocument; // looping through a collection -- https://msdn.microsoft.com/en-us/vba/word-vba/articles/looping-through-a-collection (() => { - collectionToArray(app.Documents) + collectionToArray(app.Documents) .forEach(openDocument => WScript.Echo(openDocument.Name)); const strMarks = collectionToArray(activeDoc.Bookmarks) diff --git a/types/activex-word/index.d.ts b/types/activex-word/index.d.ts index 879af9021d..f6f559ae16 100644 --- a/types/activex-word/index.d.ts +++ b/types/activex-word/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// /// /// /// @@ -12496,7 +12497,6 @@ interface ActiveXObject { set(obj: Word.Document, propertyName: 'ActiveWritingStyle', parameterTypes: [any], newValue: string): void; set(obj: Word.Document, propertyName: 'Compatibility', parameterTypes: [Word.WdCompatibility], newValue: boolean): void; set(obj: Word.System, propertyName: 'PrivateProfileString', parameterTypes: [string, string, string], newValue: string): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-word/tsconfig.json b/types/activex-word/tsconfig.json index c62626ca52..c5316c83c4 100644 --- a/types/activex-word/tsconfig.json +++ b/types/activex-word/tsconfig.json @@ -1,10 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es5", - "scripthost" - ], + "lib": ["es5"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 96270b31eb..87fdb95a01 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -94,7 +94,8 @@ let _algoliaIndexSettings: IndexSettings = { allowCompressionOfIntegerArray: false, altCorrections: [{}], minProximity: 0, - placeholders: '', + placeholders: { '': [''] }, + camelCaseAttributes: [''], }; let _algoliaQueryParameters: QueryParameters = { diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index ba46f37ce6..9315a7f6b9 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1759,10 +1759,18 @@ declare namespace algoliasearch { minProximity?: number; /** * This is an advanced use-case to define a token substitutable by a list of words without having the original token searchable - * default: '' + * default: {} * https://github.com/algolia/algoliasearch-client-js#placeholders */ - placeholders?: any; + placeholders?: { + [name: string]: string[], + }; + /** + * List of attributes on which to do a decomposition of camel case words. + * + https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/ + */ + camelCaseAttributes?: string[]; } interface Response { diff --git a/types/amazon-product-api/index.d.ts b/types/amazon-product-api/index.d.ts index 34bafd04f4..f266001632 100644 --- a/types/amazon-product-api/index.d.ts +++ b/types/amazon-product-api/index.d.ts @@ -33,6 +33,8 @@ interface IItemLookupOptions { searchIndex?: string; truncateReviewsAt?: number; variationPage?: string; + domain?: string; + request?: Function; } interface IBrowseNodeLookupOptions { diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 57420d5059..9d01e194a9 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -1327,6 +1327,9 @@ function testMarkerLayer() { markers = markerLayer.findMarkers({ containsRange: [[0, 0], pos] }); markers = markerLayer.findMarkers({ containsRange: [[0, 0], [0, 0]] }); + const role = markerLayer.getRole(); + if (role) str = role; + // Marker creation marker = markerLayer.markRange(range); marker = markerLayer.markRange([pos, pos]); @@ -1738,6 +1741,10 @@ function testProject() { subscription = project.onDidAddBuffer(buffer => buffer.id); subscription = project.observeBuffers(buffer => buffer.getUri()); + subscription = project.onDidReplace(projectSpec => { + if (projectSpec != null) str = projectSpec.originPath; + }); + // Accessing the git repository repositories = project.getRepositories(); @@ -1950,32 +1957,54 @@ function testSelection() { selection.insertText("Replacement", { autoDecreaseIndent: true }); selection.insertText("Replacement", { normalizeLineEndings: true }); selection.insertText("Replacement", { undo: "skip" }); + selection.insertText("Replacement", { bypassReadOnly: true }); selection.insertText("Replacement", { select: true, autoIndent: true, autoIndentNewline: true, autoDecreaseIndent: true, normalizeLineEndings: true, - undo: "skip", preserveTrailingLineIndentation: false }); + undo: "skip", preserveTrailingLineIndentation: false, bypassReadOnly: false }); selection.backspace(); + selection.backspace({ bypassReadOnly: true }); selection.deleteToPreviousWordBoundary(); + selection.deleteToPreviousWordBoundary({ bypassReadOnly: false }); selection.deleteToNextWordBoundary(); + selection.deleteToNextWordBoundary({ bypassReadOnly: true }); selection.deleteToBeginningOfWord(); + selection.deleteToBeginningOfWord({ bypassReadOnly: false }); selection.deleteToBeginningOfLine(); + selection.deleteToBeginningOfLine({ bypassReadOnly: true }); selection.delete(); + selection.delete({ bypassReadOnly: false }); selection.deleteToEndOfLine(); + selection.deleteToEndOfLine({ bypassReadOnly: true }); selection.deleteToEndOfWord(); + selection.deleteToEndOfWord({ bypassReadOnly: false }); selection.deleteToBeginningOfSubword(); + selection.deleteToBeginningOfSubword({ bypassReadOnly: true }); selection.deleteToEndOfSubword(); + selection.deleteToEndOfSubword({ bypassReadOnly: false }); selection.deleteSelectedText(); + selection.deleteSelectedText({ bypassReadOnly: true }); selection.deleteLine(); + selection.deleteLine({ bypassReadOnly: false }); selection.joinLines(); + selection.joinLines({ bypassReadOnly: true }); selection.outdentSelectedRows(); + selection.outdentSelectedRows({ bypassReadOnly: false }); selection.autoIndentSelectedRows(); + selection.autoIndentSelectedRows({ bypassReadOnly: true }); selection.toggleLineComments(); + selection.toggleLineComments({ bypassReadOnly: false }); selection.cutToEndOfLine(); + selection.cutToEndOfLine(true); + selection.cutToEndOfLine(undefined, { bypassReadOnly: true }); selection.cutToEndOfBufferLine(); + selection.cutToEndOfBufferLine(true); + selection.cutToEndOfBufferLine(false, { bypassReadOnly: false }); selection.cut(); selection.cut(true); selection.cut(true, true); + selection.cut(undefined, undefined, { bypassReadOnly: true }); selection.copy(); selection.copy(true); @@ -1983,6 +2012,7 @@ function testSelection() { selection.fold(); selection.indentSelectedRows(); + selection.indentSelectedRows({ bypassReadOnly: false }); // Managing multiple selections selection.addSelectionBelow(); @@ -2143,6 +2173,8 @@ function testTextBuffer() { num = nextRow; } + bool = buffer.hasAstral(); + // Mutating Text range = buffer.setText("Test"); buffer.setTextViaDiff("Test"); @@ -2232,9 +2264,13 @@ function testTextBuffer() { // History bool = buffer.undo(); + bool = buffer.undo({ selectionsMarkerLayer: markerLayer }); bool = buffer.redo(); + bool = buffer.redo({ selectionsMarkerLayer: markerLayer }); - num = buffer.transact(500, (): number => 42); + num = buffer.transact(500, (): number => 42); + num = buffer.transact({ groupingInterval: 500, selectionsMarkerLayer: markerLayer }, + (): number => 42); buffer.clearUndoStack(); num = buffer.createCheckpoint(); @@ -2434,6 +2470,8 @@ function testTextEditor() { // Mutating Text editor.setText("Test"); + editor.setText("Test", {}); + editor.setText("Text", { bypassReadOnly: true }); range = editor.setTextInBufferRange(range, "Test"); range = editor.setTextInBufferRange([pos, pos], "Test"); @@ -2443,7 +2481,7 @@ function testTextEditor() { range = editor.setTextInBufferRange(range, "Test", {}); range = editor.setTextInBufferRange([pos, pos], "Test", { normalizeLineEndings: true }); range = editor.setTextInBufferRange(range, "Test", { normalizeLineEndings: true, - undo: "skip" }); + undo: "skip", bypassReadOnly: false }); editor.insertText("Test"); editor.insertText("Test", {}); @@ -2455,27 +2493,45 @@ function testTextEditor() { editor.insertText("Test", { undo: "skip" }); editor.insertText("Text", { autoDecreaseIndent: false, autoIndent: false, autoIndentNewline: false, normalizeLineEndings: false, select: false, - undo: "skip", preserveTrailingLineIndentation: true }); + undo: "skip", preserveTrailingLineIndentation: true, bypassReadOnly: true }); editor.insertNewline(); + editor.insertNewline({ bypassReadOnly: false }); editor.delete(); + editor.delete({ bypassReadOnly: true }); editor.backspace(); + editor.backspace({ bypassReadOnly: false }); editor.mutateSelectedText((selection, index) => { selection.clear(); }); editor.transpose(); + editor.transpose({ bypassReadOnly: true }); editor.upperCase(); + editor.upperCase({ bypassReadOnly: false }); editor.lowerCase(); + editor.lowerCase({ bypassReadOnly: true }); editor.toggleLineCommentsInSelection(); + editor.toggleLineCommentsInSelection({ bypassReadOnly: false }); editor.insertNewlineBelow(); + editor.insertNewlineBelow({ bypassReadOnly: true }); editor.insertNewlineAbove(); + editor.insertNewlineAbove({ bypassReadOnly: false }); editor.deleteToBeginningOfWord(); + editor.deleteToBeginningOfWord({ bypassReadOnly: true }); editor.deleteToPreviousWordBoundary(); + editor.deleteToPreviousWordBoundary({ bypassReadOnly: false }); editor.deleteToNextWordBoundary(); + editor.deleteToNextWordBoundary({ bypassReadOnly: true }); editor.deleteToBeginningOfSubword(); + editor.deleteToBeginningOfSubword({ bypassReadOnly: false }); editor.deleteToEndOfSubword(); + editor.deleteToEndOfSubword({ bypassReadOnly: true }); editor.deleteToBeginningOfLine(); + editor.deleteToBeginningOfLine({ bypassReadOnly: false }); editor.deleteToEndOfLine(); + editor.deleteToEndOfLine({ bypassReadOnly: true }); editor.deleteToEndOfWord(); + editor.deleteToEndOfWord({ bypassReadOnly: false }); editor.deleteLine(); + editor.deleteLine({ bypassReadOnly: true }); // History editor.undo(); @@ -2923,9 +2979,12 @@ function testTextEditor() { editor.setIndentationForBufferRow(42, 42, { preserveLeadingWhitespace: true }); editor.indentSelectedRows(); + editor.indentSelectedRows({ bypassReadOnly: false }); editor.outdentSelectedRows(); + editor.outdentSelectedRows({ bypassReadOnly: true }); num = editor.indentLevelForLine("Test"); editor.autoIndentSelectedRows(); + editor.autoIndentSelectedRows({ bypassReadOnly: false }); // Grammars grammar = editor.getGrammar(); @@ -2942,6 +3001,7 @@ function testTextEditor() { // Clipboard Operations editor.copySelectedText(); editor.cutSelectedText(); + editor.cutSelectedText({ bypassReadOnly: true }); editor.pasteText(); editor.pasteText({}); @@ -2951,11 +3011,14 @@ function testTextEditor() { editor.pasteText({ normalizeLineEndings: true }); editor.pasteText({ select: true }); editor.pasteText({ undo: "skip" }); + editor.pasteText({ bypassReadOnly: false }); editor.pasteText({ autoIndentNewline: true, autoIndent: true, autoDecreaseIndent: true, - normalizeLineEndings: true, select: true, undo: "skip" }); + normalizeLineEndings: true, select: true, undo: "skip", bypassReadOnly: true }); editor.cutToEndOfLine(); + editor.cutToEndOfLine({ bypassReadOnly: false }); editor.cutToEndOfBufferLine(); + editor.cutToEndOfBufferLine({ bypassReadOnly: true }); // Folds editor.foldCurrentRow(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 3cee95ace5..232c20a034 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Atom 1.26 +// Type definitions for Atom 1.27 // Project: https://github.com/atom/atom // Definitions by: GlenCFL // smhxx @@ -7,7 +7,7 @@ // TypeScript Version: 2.3 // NOTE: only those classes exported within this file should be retain that status below. -// https://github.com/atom/atom/blob/v1.26.0/exports/atom.js +// https://github.com/atom/atom/blob/v1.27.0/exports/atom.js /// @@ -1004,6 +1004,9 @@ export interface MarkerLayer { /** Find markers in the layer conforming to the given parameters. */ findMarkers(params: FindMarkerOptions): Marker[]; + /** Get the role of the marker layer e.g. "atom.selection". */ + getRole(): string | undefined; + // Marker Creation /** Create a marker with the given range. */ markRange(range: RangeCompatible, options?: { reversed?: boolean, invalidate?: @@ -1525,29 +1528,29 @@ export class TextEditor { // Mutating Text /** Replaces the entire contents of the buffer with the given string. */ - setText(text: string): void; + setText(text: string, options?: ReadonlyEditOptions): void; /** Set the text in the given Range in buffer coordinates. */ setTextInBufferRange(range: RangeCompatible, text: string, options?: - TextEditOptions): Range; + TextEditOptions & ReadonlyEditOptions): Range; /* For each selection, replace the selected text with the given text. */ - insertText(text: string, options?: TextInsertionOptions): Range|false; + insertText(text: string, options?: TextInsertionOptions & ReadonlyEditOptions): Range|false; /** For each selection, replace the selected text with a newline. */ - insertNewline(): void; + insertNewline(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete the character following * the cursor. Otherwise delete the selected text. */ - delete(): void; + delete(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete the character preceding * the cursor. Otherwise delete the selected text. */ - backspace(): void; + backspace(options?: ReadonlyEditOptions): void; /** * Mutate the text of all the selections in a single transaction. @@ -1561,89 +1564,89 @@ export class TextEditor { * If the selection is empty, the characters preceding and following the cursor * are swapped. Otherwise, the selected characters are reversed. */ - transpose(): void; + transpose(options?: ReadonlyEditOptions): void; /** * Convert the selected text to upper case. * For each selection, if the selection is empty, converts the containing word * to upper case. Otherwise convert the selected text to upper case. */ - upperCase(): void; + upperCase(options?: ReadonlyEditOptions): void; /** * Convert the selected text to lower case. * For each selection, if the selection is empty, converts the containing word * to upper case. Otherwise convert the selected text to upper case. */ - lowerCase(): void; + lowerCase(options?: ReadonlyEditOptions): void; /** * Toggle line comments for rows intersecting selections. * If the current grammar doesn't support comments, does nothing. */ - toggleLineCommentsInSelection(): void; + toggleLineCommentsInSelection(options?: ReadonlyEditOptions): void; /** For each cursor, insert a newline at beginning the following line. */ - insertNewlineBelow(): void; + insertNewlineBelow(options?: ReadonlyEditOptions): void; /** For each cursor, insert a newline at the end of the preceding line. */ - insertNewlineAbove(): void; + insertNewlineAbove(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete all characters of the * containing word that precede the cursor. Otherwise delete the selected text. */ - deleteToBeginningOfWord(): void; + deleteToBeginningOfWord(options?: ReadonlyEditOptions): void; /** * Similar to ::deleteToBeginningOfWord, but deletes only back to the previous * word boundary. */ - deleteToPreviousWordBoundary(): void; + deleteToPreviousWordBoundary(options?: ReadonlyEditOptions): void; /** Similar to ::deleteToEndOfWord, but deletes only up to the next word boundary. */ - deleteToNextWordBoundary(): void; + deleteToNextWordBoundary(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete all characters of the * containing subword following the cursor. Otherwise delete the selected text. */ - deleteToBeginningOfSubword(): void; + deleteToBeginningOfSubword(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete all characters of the * containing subword following the cursor. Otherwise delete the selected text. */ - deleteToEndOfSubword(): void; + deleteToEndOfSubword(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete all characters of the * containing line that precede the cursor. Otherwise delete the selected text. */ - deleteToBeginningOfLine(): void; + deleteToBeginningOfLine(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is not empty, deletes the selection * otherwise, deletes all characters of the containing line following the cursor. * If the cursor is already at the end of the line, deletes the following newline. */ - deleteToEndOfLine(): void; + deleteToEndOfLine(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete all characters of the * containing word following the cursor. Otherwise delete the selected text. */ - deleteToEndOfWord(): void; + deleteToEndOfWord(options?: ReadonlyEditOptions): void; /** Delete all lines intersecting selections. */ - deleteLine(): void; + deleteLine(options?: ReadonlyEditOptions): void; // History /** Undo the last change. */ - undo(): void; + undo(options?: ReadonlyEditOptions): void; /** Redo the last change. */ - redo(): void; + redo(options?: ReadonlyEditOptions): void; /** * Batch multiple operations as a single undo/redo step. @@ -2284,10 +2287,10 @@ export class TextEditor { { preserveLeadingWhitespace?: boolean }): void; /** Indent rows intersecting selections by one level. */ - indentSelectedRows(): void; + indentSelectedRows(options?: ReadonlyEditOptions): void; /** Outdent rows intersecting selections by one level. */ - outdentSelectedRows(): void; + outdentSelectedRows(options?: ReadonlyEditOptions): void; /** * Get the indentation level of the given line of text. @@ -2298,7 +2301,7 @@ export class TextEditor { indentLevelForLine(line: string): number; /** Indent rows intersecting selections based on the grammar's suggested indent level. */ - autoIndentSelectedRows(): void; + autoIndentSelectedRows(options?: ReadonlyEditOptions): void; // Grammars /** Get the current Grammar of this editor. */ @@ -2328,7 +2331,7 @@ export class TextEditor { copySelectedText(): void; /** For each selection, cut the selected text. */ - cutSelectedText(): void; + cutSelectedText(options?: ReadonlyEditOptions): void; /** * For each selection, replace the selected text with the contents of the clipboard. @@ -2336,19 +2339,19 @@ export class TextEditor { * each selection will be replaced with the content of the corresponding clipboard * selection text. */ - pasteText(options?: TextInsertionOptions): void; + pasteText(options?: TextInsertionOptions & ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, cut all characters of the * containing screen line following the cursor. Otherwise cut the selected text. */ - cutToEndOfLine(): void; + cutToEndOfLine(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, cut all characters of the * containing buffer line following the cursor. Otherwise cut the selected text. */ - cutToEndOfBufferLine(): void; + cutToEndOfBufferLine(options?: ReadonlyEditOptions): void; // Folds /** @@ -3322,7 +3325,7 @@ export class Directory { /** Returns a boolean, always false. */ isFile(): this is File; - /** Returns a roolean, always true. */ + /** Returns a boolean, always true. */ isDirectory(): this is Directory; /** Returns a boolean indicating whether or not this is a symbolic link. */ @@ -4482,6 +4485,10 @@ export interface Project { /** Invoke a callback when a filesystem change occurs within any open project path. */ onDidChangeFiles(callback: (events: FilesystemChangeEvent) => void): Disposable; + /** Invoke a callback whenever the project's configuration has been replaced. */ + onDidReplace(callback: (projectSpec: ProjectSpecification | null | undefined) => void): + Disposable; + // Accessing the Git Repository /** * Get an Array of GitRepositorys associated with the project's directories. @@ -4716,107 +4723,107 @@ export interface Selection { // Modifying the selected text /** Replaces text at the current selection. */ - insertText(text: string, options?: TextInsertionOptions): void; + insertText(text: string, options?: TextInsertionOptions & ReadonlyEditOptions): void; /** * Removes the first character before the selection if the selection is empty * otherwise it deletes the selection. */ - backspace(): void; + backspace(options?: ReadonlyEditOptions): void; /** * Removes the selection or, if nothing is selected, then all characters from * the start of the selection back to the previous word boundary. */ - deleteToPreviousWordBoundary(): void; + deleteToPreviousWordBoundary(options?: ReadonlyEditOptions): void; /** * Removes the selection or, if nothing is selected, then all characters from * the start of the selection up to the next word boundary. */ - deleteToNextWordBoundary(): void; + deleteToNextWordBoundary(options?: ReadonlyEditOptions): void; /** * Removes from the start of the selection to the beginning of the current * word if the selection is empty otherwise it deletes the selection. */ - deleteToBeginningOfWord(): void; + deleteToBeginningOfWord(options?: ReadonlyEditOptions): void; /** * Removes from the beginning of the line which the selection begins on all * the way through to the end of the selection. */ - deleteToBeginningOfLine(): void; + deleteToBeginningOfLine(options?: ReadonlyEditOptions): void; /** * Removes the selection or the next character after the start of the selection * if the selection is empty. */ - delete(): void; + delete(options?: ReadonlyEditOptions): void; /** * If the selection is empty, removes all text from the cursor to the end of * the line. If the cursor is already at the end of the line, it removes the following * newline. If the selection isn't empty, only deletes the contents of the selection. */ - deleteToEndOfLine(): void; + deleteToEndOfLine(options?: ReadonlyEditOptions): void; /** * Removes the selection or all characters from the start of the selection to * the end of the current word if nothing is selected. */ - deleteToEndOfWord(): void; + deleteToEndOfWord(options?: ReadonlyEditOptions): void; /** * Removes the selection or all characters from the start of the selection to * the end of the current word if nothing is selected. */ - deleteToBeginningOfSubword(): void; + deleteToBeginningOfSubword(options?: ReadonlyEditOptions): void; /** * Removes the selection or all characters from the start of the selection to * the end of the current word if nothing is selected. */ - deleteToEndOfSubword(): void; + deleteToEndOfSubword(options?: ReadonlyEditOptions): void; /** Removes only the selected text. */ - deleteSelectedText(): void; + deleteSelectedText(options?: ReadonlyEditOptions): void; /** * Removes the line at the beginning of the selection if the selection is empty * unless the selection spans multiple lines in which case all lines are removed. */ - deleteLine(): void; + deleteLine(options?: ReadonlyEditOptions): void; /** * Joins the current line with the one below it. Lines will be separated by a single space. * If there selection spans more than one line, all the lines are joined together. */ - joinLines(): void; + joinLines(options?: ReadonlyEditOptions): void; /** Removes one level of indent from the currently selected rows. */ - outdentSelectedRows(): void; + outdentSelectedRows(options?: ReadonlyEditOptions): void; /** * Sets the indentation level of all selected rows to values suggested by the * relevant grammars. */ - autoIndentSelectedRows(): void; + autoIndentSelectedRows(options?: ReadonlyEditOptions): void; /** * Wraps the selected lines in comments if they aren't currently part of a comment. * Removes the comment if they are currently wrapped in a comment. */ - toggleLineComments(): void; + toggleLineComments(options?: ReadonlyEditOptions): void; /** Cuts the selection until the end of the screen line. */ - cutToEndOfLine(): void; + cutToEndOfLine(maintainClipboard?: boolean, options?: ReadonlyEditOptions): void; /** Cuts the selection until the end of the buffer line. */ - cutToEndOfBufferLine(): void; + cutToEndOfBufferLine(maintainClipboard?: boolean, options?: ReadonlyEditOptions): void; /** Copies the selection to the clipboard and then deletes it. */ - cut(maintainClipboard?: boolean, fullLine?: boolean): void; + cut(maintainClipboard?: boolean, fullLine?: boolean, options?: ReadonlyEditOptions): void; /** Copies the current selection to the clipboard. */ copy(maintainClipboard?: boolean, fullLine?: boolean): void; @@ -4825,7 +4832,7 @@ export interface Selection { fold(): void; /** If the selection spans multiple rows, indent all of them. */ - indentSelectedRows(): void; + indentSelectedRows(options?: ReadonlyEditOptions): void; // Managing multiple selections /** Moves the selection down one row. */ @@ -5134,6 +5141,12 @@ export class TextBuffer { */ nextNonBlankRow(startRow: number): number|null; + /** + * Return true if the buffer contains any astral-plane Unicode characters that + * are encoded as surrogate pairs. + */ + hasAstral(): boolean; + // Mutating Text /** Replace the entire contents of the buffer with the given text. */ setText(text: string): Range; @@ -5172,7 +5185,7 @@ export class TextBuffer { // Markers /** Create a layer to contain a set of related markers. */ - addMarkerLayer(options?: { maintainHistory?: boolean, persistent?: boolean }): + addMarkerLayer(options?: { maintainHistory?: boolean, persistent?: boolean, role?: string }): MarkerLayer; /** @@ -5210,16 +5223,18 @@ export class TextBuffer { * Undo the last operation. If a transaction is in progress, aborts it. * @return A boolean of whether or not a change was made. */ - undo(): boolean; + undo(options?: HistoryTraversalOptions): boolean; /** * Redo the last operation. * @return A boolean of whether or not a change was made. */ - redo(): boolean; + redo(options?: HistoryTraversalOptions): boolean; /** Batch multiple operations as a single undo/redo step. */ - transact(groupingInterval: number, fn: () => T): T; + transact(optionsOrInterval: number | { groupingInterval?: number } & + HistoryTransactionOptions, fn: () => T): T; + /** Batch multiple operations as a single undo/redo step. */ transact(fn: () => T): T; /** @@ -5237,20 +5252,21 @@ export class TextBuffer { * `::revertToCheckpoint` and `::groupChangesSinceCheckpoint`. * @return A checkpoint ID value. */ - createCheckpoint(): number; + createCheckpoint(options?: HistoryTransactionOptions): number; /** * Revert the buffer to the state it was in when the given checkpoint was created. * @return A boolean indicating whether the operation succeeded. */ - revertToCheckpoint(checkpoint: number): boolean; + revertToCheckpoint(checkpoint: number, options?: HistoryTraversalOptions): + boolean; /** * Group all changes since the given checkpoint into a single transaction for * purposes of undo/redo. * @return A boolean indicating whether the operation succeeded. */ - groupChangesSinceCheckpoint(checkpoint: number): boolean; + groupChangesSinceCheckpoint(checkpoint: number, options?: HistoryTransactionOptions): boolean; /** * Group the last two text changes for purposes of undo/redo. @@ -5828,7 +5844,7 @@ export interface TextEditorObservedEvent { // information under certain contexts. // NOTE: the config schema with these defaults can be found here: -// https://github.com/atom/atom/blob/v1.26.0/src/config-schema.js +// https://github.com/atom/atom/blob/v1.27.0/src/config-schema.js /** * Allows you to strongly type Atom configuration variables. Additional key:value * pairings merged into this interface will result in configuration values under @@ -6356,6 +6372,16 @@ export interface FindMarkerOptions { intersectsRow?: number; } +export interface HistoryTransactionOptions { + /** When provided, skip taking snapshot for other selections markerLayers except given one. */ + selectionsMarkerLayer?: MarkerLayer; +} + +export interface HistoryTraversalOptions { + /** Restore snapshot of selections marker layer to given selectionsMarkerLayer. */ + selectionsMarkerLayer?: MarkerLayer; +} + export interface MenuOptions { /** The menu itme's label. */ label: string; @@ -6413,6 +6439,11 @@ export interface ProcessOptions extends NodeProcessOptions { autoStart?: boolean; } +export interface ReadonlyEditOptions { + /** Whether the readonly protections on the text editor should be ignored. */ + bypassReadOnly?: boolean; +} + export interface ScanContextOptions { /** The number of lines before the matched line to include in the results object. */ leadingContextLineCount?: number; @@ -6822,6 +6853,12 @@ export interface ProjectHistory { lastOpened: Date; } +export interface ProjectSpecification { + paths: string[]; + originPath: string; + config?: ConfigValues; +} + export interface ScandalResult { filePath: string; matches: Array<{ diff --git a/types/awesomplete/index.d.ts b/types/awesomplete/index.d.ts index e73b7cf2f3..9f5060de03 100644 --- a/types/awesomplete/index.d.ts +++ b/types/awesomplete/index.d.ts @@ -42,7 +42,8 @@ declare class Awesomplete { } declare namespace Awesomplete { - type Suggestion = string | {label: string | any, value: string | any} | [string, string]; + type Suggestion = string | { label: string | any, value: string | any } | [string, string]; + type SortFunction = (left: number | any[], right: number | any[]) => number; interface Options { list?: string | string[] | Element | Array<{ label: string, value: any }> | Array<[string, string]>; @@ -51,7 +52,7 @@ declare namespace Awesomplete { autoFirst?: boolean; data?(item: Suggestion, input: string): string; filter?(text: string, input: string): boolean; - sort?(left: number | any[], right: number | any[]): number; + sort?: boolean | SortFunction; item?(text: string, input: string): HTMLElement; replace?(text: string): void; } diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 9f9d7438e3..ea51d25770 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -93,6 +93,7 @@ str = apiGwEvtReqCtx.identity.sourceIp; strOrNull = apiGwEvtReqCtx.identity.user; strOrNull = apiGwEvtReqCtx.identity.userAgent; strOrNull = apiGwEvtReqCtx.identity.userArn; +str = apiGwEvtReqCtx.path; str = apiGwEvtReqCtx.stage; str = apiGwEvtReqCtx.requestId; str = apiGwEvtReqCtx.resourceId; @@ -525,6 +526,58 @@ function customAuthorizerCallback(cb: AWSLambda.CustomAuthorizerCallback) { cb(null, authResponse); } +/* CodePipeline events https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html#actions-invoke-lambda-function-json-event-example */ +const CodePipelineEvent: AWSLambda.CodePipelineEvent = { + "CodePipeline.job": { + id: "11111111-abcd-1111-abcd-111111abcdef", + accountId: "111111111111", + data: { + actionConfiguration: { + configuration: { + FunctionName: "MyLambdaFunctionForAWSCodePipeline", + UserParameters: "some-input-such-as-a-URL" + } + }, + inputArtifacts: [ + { + location: { + s3Location: { + bucketName: "the name of the bucket configured as the pipeline artifact store in Amazon S3, for example codepipeline-us-east-2-1234567890", + objectKey: "the name of the application, for example CodePipelineDemoApplication.zip" + }, + type: "S3" + }, + revision: null, + name: "ArtifactName" + } + ], + outputArtifacts: [], + artifactCredentials: { + secretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + sessionToken: `MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w + 0BAQUFADCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZ + WF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIw + EAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5 + jb20wHhcNMTEwNDI1MjA0NTIxWhcNMTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBh + MCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBb + WF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMx + HzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wgZ8wDQYJKoZIhvcNAQE + BBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ21uUSfwfEvySWtC2XADZ4nB+BLYgVI + k60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9TrDHudUZg3qX4waLG5M43q7Wgc/MbQ + ITxOUSQv7c7ugFFDzQGBzZswY6786m86gpEIbb3OhjZnzcvQAaRHhdlQWIMm2nr + AgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4nUhVVxYUntneD9+h8Mg9q6q+auN + KyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0FkbFFBjvSfpJIlJ00zbhNYS5f6Guo + EDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTbNYiytVbZPQUQ5Yaxu2jXnimvw + 3rrszlaEXAMPLE=`, + accessKeyId: "AKIAIOSFODNN7EXAMPLE" + }, + continuationToken: "A continuation token if continuing job" + } + } +}; + +CodePipelineEvent["CodePipeline.job"].data.encryptionKey = { type: 'KMS', id: 'key' }; + /* CloudFront events, see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */ const CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = { Records: [ @@ -750,6 +803,8 @@ let apiGtwProxyHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.API let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { }; apiGtwProxyHandler = proxyHandler; +let codePipelineHandler: AWSLambda.CodePipelineHandler = (event: AWSLambda.CodePipelineEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => { cb(); cb(null); diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 7795c4cdfe..4b62269902 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -42,6 +42,7 @@ export interface APIGatewayEventRequestContext { userAgent: string | null; userArn: string | null; }; + path: string; stage: string; requestId: string; requestTimeEpoch: number; @@ -501,6 +502,58 @@ export interface AuthResponseContext { [name: string]: any; } +/** + * CodePipeline events + * https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html + */ +export interface S3ArtifactLocation { + bucketName: string; + objectKey: string; +} +export interface S3ArtifactStore { + type: 'S3'; + s3Location: S3ArtifactLocation; +} + +export type ArtifactLocation = S3ArtifactStore; + +export interface Artifact { + name: string; + revision: string | null; + location: ArtifactLocation; +} + +export interface Credentials { + accessKeyId: string; + secretAccessKey: string; + sessionToken?: string; +} + +export interface EncryptionKey { + type: string; + id: string; +} + +export interface CodePipelineEvent { + "CodePipeline.job": { + id: string; + accountId: string; + data: { + actionConfiguration: { + configuration: { + FunctionName: string; + UserParameters: string; + } + }; + inputArtifacts: Artifact[]; + outputArtifacts: Artifact[]; + artifactCredentials: Credentials; + encryptionKey?: EncryptionKey & {type: 'KMS'}; + continuationToken?: string; + }; + }; +} + /** * CloudFront events * http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html @@ -653,6 +706,8 @@ export type ProxyCallback = APIGatewayProxyCallback; // Old name // TODO: IoT +export type CodePipelineHandler = Handler; + export type CloudFrontRequestHandler = Handler; export type CloudFrontRequestCallback = Callback; diff --git a/types/chartist/chartist-tests.ts b/types/chartist/chartist-tests.ts index 13a7c7dd1c..53ba63497c 100644 --- a/types/chartist/chartist-tests.ts +++ b/types/chartist/chartist-tests.ts @@ -1,429 +1,485 @@ import Chartist = require("chartist"); + Chartist.escapingMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', + '&': '&', + '<': '<', + '>': '>', + '"': '"', + '\'': ''', }; Chartist.precision = 8; new Chartist.Line('.ct-chart', { - labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'], - series: [ - [12, 9, 7, 8, 5], - [2, 1, 3.5, 7, 3], - [1, 3, 4, 5, 6] - ] + labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'], + series: [ + [12, 9, 7, 8, 5], + [2, 1, 3.5, 7, 3], + [1, 3, 4, 5, 6] + ] }, { fullWidth: true, chartPadding: { - right: 40 + right: 40 } - }); - -var lineChart = new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], - series: [ - [5, 5, 10, 8, 7, 5, 4, null, null, null, 10, 10, 7, 8, 6, 9], - [10, 15, null, 12, null, 10, 12, 15, null, null, 12, null, 14, null, null, null], - [null, null, null, null, 3, 4, 1, 3, 4, 6, 7, 9, 5, null, null, null] - ] -}, { - fullWidth: true, - chartPadding: { - right: 10 - }, - low: 0 - }); - -new Chartist.Line('.ct-chart', { - labels: ['1', '2', '3', '4', '5', '6'], - series: [ - { - name: 'Fibonacci sequence', - data: [1, 2, 3, 5, 8, 13] - }, - { - name: 'Golden section', - data: [1, 1.618, 2.618, 4.236, 6.854, 11.09] - } - ] }); +var lineChart = new Chartist.Line('.ct-chart', { + labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], + series: [ + [5, 5, 10, 8, 7, 5, 4, null, null, null, 10, 10, 7, 8, 6, 9], + [10, 15, null, 12, null, 10, 12, 15, null, null, 12, null, 14, null, null, null], + [null, null, null, null, 3, 4, 1, 3, 4, 6, 7, 9, 5, null, null, null] + ] +}, { + fullWidth: true, + chartPadding: { + right: 10 + }, + low: 0 +}); + +new Chartist.Line('.ct-chart', { + labels: ['1', '2', '3', '4', '5', '6'], + series: [ + { + name: 'Fibonacci sequence', + data: [1, 2, 3, 5, 8, 13] + }, + { + name: 'Golden section', + data: [1, 1.618, 2.618, 4.236, 6.854, 11.09] + } + ] +}); + + +// This example was taken here: https://gionkunz.github.io/chartist-js/examples.html#example-line-series-override +new Chartist.Line('.ct-chart', { + labels: ['1', '2', '3', '4', '5', '6', '7', '8'], + // Naming the series with the series object array notation + series: [{ + name: 'series-1', + data: [5, 2, -4, 2, 0, -2, 5, -3] + }, { + name: 'series-2', + data: [4, 3, 5, 3, 1, 3, 6, 4] + }, { + name: 'series-3', + data: [2, 4, 3, 1, 4, 5, 3, 2] + }] +}, { + fullWidth: true, + // Within the series options you can use the series names + // to specify configuration that will only be used for the + // specific series. + series: { + 'series-1': { + lineSmooth: Chartist.Interpolation.step() + }, + 'series-2': { + lineSmooth: Chartist.Interpolation.simple(), + showArea: true + }, + 'series-3': { + showPoint: false + } + } +}, [ + // You can even use responsive configuration overrides to + // customize your series configuration even further! + ['screen and (max-width: 320px)', { + series: { + 'series-1': { + lineSmooth: Chartist.Interpolation.none() + }, + 'series-2': { + lineSmooth: Chartist.Interpolation.none(), + showArea: false + }, + 'series-3': { + lineSmooth: Chartist.Interpolation.none(), + showPoint: true + } + } + }] +]); + + var data = { - series: [5, 3, 4] + series: [5, 3, 4] }; -var sum = (a: number, b: number) => { return a + b }; +var sum = (a: number, b: number) => { + return a + b +}; new Chartist.Pie('.ct-chart', data, { - labelInterpolationFnc: (value: number) => { - return Math.round(value / data.series.reduce(sum) * 100) + '%'; - } + labelInterpolationFnc: (value: number) => { + return Math.round(value / data.series.reduce(sum) * 100) + '%'; + } }); new Chartist.Pie('.ct-chart', { - series: [20, 10, 30, 40] + series: [20, 10, 30, 40] }, { donut: true, donutWidth: 60, startAngle: 270, total: 200, showLabel: false - }); +}); // Animation Donut example var chart = new Chartist.Pie('.ct-chart', { - series: [10, 20, 50, 20, 5, 50, 15], - labels: [1, 2, 3, 4, 5, 6, 7] + series: [10, 20, 50, 20, 5, 50, 15], + labels: [1, 2, 3, 4, 5, 6, 7] }, { donut: true, showLabel: false - }); +}); chart.on('draw', (data: any) => { - if (data.type === 'slice') { - // Get the total path length in order to use for dash array animation - var pathLength = data.element._node.getTotalLength(); + if (data.type === 'slice') { + // Get the total path length in order to use for dash array animation + var pathLength = data.element._node.getTotalLength(); - // Set a dasharray that matches the path length as prerequisite to animate dashoffset - data.element.attr({ - 'stroke-dasharray': pathLength + 'px ' + pathLength + 'px' - }); + // Set a dasharray that matches the path length as prerequisite to animate dashoffset + data.element.attr({ + 'stroke-dasharray': pathLength + 'px ' + pathLength + 'px' + }); - // Create animation definition while also assigning an ID to the animation for later sync usage - var animationDefinition: Chartist.IChartistAnimations = { - 'stroke-dashoffset': { - id: 'anim' + data.index, - dur: 1000, - from: -pathLength + 'px', - to: '0px', - easing: Chartist.Svg.Easing.easeOutQuint, - // We need to use `fill: 'freeze'` otherwise our animation will fall back to initial (not visible) - fill: 'freeze' - } - }; + // Create animation definition while also assigning an ID to the animation for later sync usage + var animationDefinition: Chartist.IChartistAnimations = { + 'stroke-dashoffset': { + id: 'anim' + data.index, + dur: 1000, + from: -pathLength + 'px', + to: '0px', + easing: Chartist.Svg.Easing.easeOutQuint, + // We need to use `fill: 'freeze'` otherwise our animation will fall back to initial (not visible) + fill: 'freeze' + } + }; - // If this was not the first slice, we need to time the animation so that it uses the end sync event of the previous animation - if (data.index !== 0) { - animationDefinition['stroke-dashoffset'].begin = 'anim' + (data.index - 1) + '.end'; + // If this was not the first slice, we need to time the animation so that it uses the end sync event of the previous animation + if (data.index !== 0) { + animationDefinition['stroke-dashoffset'].begin = 'anim' + (data.index - 1) + '.end'; + } + + // We need to set an initial value before the animation starts as we are not in guided mode which would do that for us + data.element.attr({ + 'stroke-dashoffset': -pathLength + 'px' + }); + + // We can't use guided mode as the animations need to rely on setting begin manually + // See http://gionkunz.github.io/chartist-js/api-documentation.html#chartistsvg-function-animate + data.element.animate(animationDefinition, false); } - - // We need to set an initial value before the animation starts as we are not in guided mode which would do that for us - data.element.attr({ - 'stroke-dashoffset': -pathLength + 'px' - }); - - // We can't use guided mode as the animations need to rely on setting begin manually - // See http://gionkunz.github.io/chartist-js/api-documentation.html#chartistsvg-function-animate - data.element.animate(animationDefinition, false); - } }); new Chartist.Bar('.ct-chart', { - labels: ['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'], - series: [20, 60, 120, 200, 180, 20, 10] + labels: ['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'], + series: [20, 60, 120, 200, 180, 20, 10] }, { distributeSeries: true - }); +}); new Chartist.Bar('.ct-chart', { - labels: ['Quarter 1', 'Quarter 2', 'Quarter 3', 'Quarter 4'], - series: [ - [5, 4, 3, 7], - [3, 2, 9, 5], - [1, 5, 8, 4], - [2, 3, 4, 6], - [4, 1, 2, 1] - ] + labels: ['Quarter 1', 'Quarter 2', 'Quarter 3', 'Quarter 4'], + series: [ + [5, 4, 3, 7], + [3, 2, 9, 5], + [1, 5, 8, 4], + [2, 3, 4, 6], + [4, 1, 2, 1] + ] }, { // Default mobile configuration stackBars: true, axisX: { - labelInterpolationFnc: (value: string) => { - return value.split(/\s+/).map((word: string) => { - return word[0]; - }).join(''); - } + labelInterpolationFnc: (value: string) => { + return value.split(/\s+/).map((word: string) => { + return word[0]; + }).join(''); + } }, axisY: { - offset: 20 + offset: 20 } - }, [ +}, [ // Options override for media > 400px ['screen and (min-width: 400px)', { - reverseData: true, - horizontalBars: true, - axisX: { - labelInterpolationFnc: Chartist.noop - }, - axisY: { - offset: 60 - } + reverseData: true, + horizontalBars: true, + axisX: { + labelInterpolationFnc: Chartist.noop + }, + axisY: { + offset: 60 + } }], // Options override for media > 800px ['screen and (min-width: 800px)', { - stackBars: false, - seriesBarDistance: 10 + stackBars: false, + seriesBarDistance: 10 }], // Options override for media > 1000px ['screen and (min-width: 1000px)', { - reverseData: false, - horizontalBars: false, - seriesBarDistance: 15 + reverseData: false, + horizontalBars: false, + seriesBarDistance: 15 }] - ]); +]); new Chartist.Pie('.ct-chart', { - series: [{ - value: 20, - name: 'Series 1', - className: 'my-custom-class-one', - meta: 'Meta One' - }, { - value: 10, - name: 'Series 2', - className: 'my-custom-class-two', - meta: 'Meta Two' + series: [{ + value: 20, + name: 'Series 1', + className: 'my-custom-class-one', + meta: 'Meta One' }, { - value: 70, - name: 'Series 3', - className: 'my-custom-class-three', - meta: 'Meta Three' + value: 10, + name: 'Series 2', + className: 'my-custom-class-two', + meta: 'Meta Two' + }, { + value: 70, + name: 'Series 3', + className: 'my-custom-class-three', + meta: 'Meta Three' }] }); new Chartist.Bar('.bar-chart', { - labels: ['foo', 'bar', 'foobar'], - series: [ - { - data: [1], - className: 'graph-foo', - }, - { - data: [10], - className: 'graph-foo', - }, - { - data: [12], - className: 'graph-foo', - }] -  }, { + labels: ['foo', 'bar', 'foobar'], + series: [ + { + data: [1], + className: 'graph-foo', + }, + { + data: [10], + className: 'graph-foo', + }, + { + data: [12], + className: 'graph-foo', + }] +}, { seriesBarDistance: 30, reverseData: true, horizontalBars: true, height: '115px', axisY: { - offset: 70, - showGrid: false, + offset: 70, + showGrid: false, }, axisX: { - scaleMinSpace: 200 + scaleMinSpace: 200 } - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5, 6, 7, 8], - series: [ - [5, 9, 7, 8, 5, 3, 5, 4] - ] + labels: [1, 2, 3, 4, 5, 6, 7, 8], + series: [ + [5, 9, 7, 8, 5, 3, 5, 4] + ] }, { ticks: [0, 4], low: 0, showArea: true, axisY: { - showLabel: true, - showGrid: false, - ticks: [1, 4], - type: Chartist.FixedScaleAxis + showLabel: true, + showGrid: false, + ticks: [1, 4], + type: Chartist.FixedScaleAxis } - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5, 6, 7, 8], - series: [ - [5, 9, 7, 8, 5, 3, 5, 4] - ] + labels: [1, 2, 3, 4, 5, 6, 7, 8], + series: [ + [5, 9, 7, 8, 5, 3, 5, 4] + ] }, { ticks: [0, 4], low: 0, showArea: true, axisX: { - showGrid: false + showGrid: false }, axisY: { - showLabel: true, - showGrid: false, - ticks: [1, 4], - type: Chartist.FixedScaleAxis + showLabel: true, + showGrid: false, + ticks: [1, 4], + type: Chartist.FixedScaleAxis } - }); +}); var chart2 = new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5], - series: [ - [12, 9, 7, 8, 5] - ] + labels: [1, 2, 3, 4, 5], + series: [ + [12, 9, 7, 8, 5] + ] }); // Listening for draw events that get emitted by the Chartist chart chart2.on('draw', (data: any) => { - // If the draw event was triggered from drawing a point on the line chart - if (data.type === 'point') { - // We are creating a new path SVG element that draws a triangle around the point coordinates - var triangle = new Chartist.Svg('path', { - d: ['M', - data.x, - data.y - 15, - 'L', - data.x - 15, - data.y + 8, - 'L', - data.x + 15, - data.y + 8, - 'z'].join(' '), - style: 'fill-opacity: 1' - }, 'ct-area'); + // If the draw event was triggered from drawing a point on the line chart + if (data.type === 'point') { + // We are creating a new path SVG element that draws a triangle around the point coordinates + var triangle = new Chartist.Svg('path', { + d: ['M', + data.x, + data.y - 15, + 'L', + data.x - 15, + data.y + 8, + 'L', + data.x + 15, + data.y + 8, + 'z'].join(' '), + style: 'fill-opacity: 1' + }, 'ct-area'); - // With data.element we get the Chartist SVG wrapper and we can replace the original point drawn by Chartist with our newly created triangle - data.element.replace(triangle); - } + // With data.element we get the Chartist SVG wrapper and we can replace the original point drawn by Chartist with our newly created triangle + data.element.replace(triangle); + } }); // Create a simple bi-polar bar chart var biPolarChart = new Chartist.Bar('.ct-chart', { - labels: ['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8', 'W9', 'W10'], - series: [ - [1, 2, 4, 8, 6, -2, -1, -4, -6, -2] - ] + labels: ['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8', 'W9', 'W10'], + series: [ + [1, 2, 4, 8, 6, -2, -1, -4, -6, -2] + ] }, { high: 10, low: -10, axisX: { - labelInterpolationFnc: (value: any, index: number) => { - return index % 2 === 0 ? value : null; - } + labelInterpolationFnc: (value: any, index: number) => { + return index % 2 === 0 ? value : null; + } } - }); +}); // Listen for draw events on the bar chart biPolarChart.on('draw', (data: any) => { - // If this draw event is of type bar we can use the data to create additional content - if (data.type === 'bar') { - // We use the group element of the current series to append a simple circle with the bar peek coordinates and a circle radius that is depending on the value - data.group.append(new Chartist.Svg('circle', { - cx: data.x2, - cy: data.y2, - r: Math.abs(Chartist.getMultiValue(data.value)) * 2 + 5 - }, 'ct-slice-pie')); - } + // If this draw event is of type bar we can use the data to create additional content + if (data.type === 'bar') { + // We use the group element of the current series to append a simple circle with the bar peek coordinates and a circle radius that is depending on the value + data.group.append(new Chartist.Svg('circle', { + cx: data.x2, + cy: data.y2, + r: Math.abs(Chartist.getMultiValue(data.value)) * 2 + 5 + }, 'ct-slice-pie')); + } }); new Chartist.Bar('.ct-chart', { - labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], - series: [ - [5, 4, 3, 7, 5, 10, 3], - [3, 2, 9, 5, 4, 6, 4] - ] + labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + series: [ + [5, 4, 3, 7, 5, 10, 3], + [3, 2, 9, 5, 4, 6, 4] + ] }, { axisX: { - // On the x-axis start means top and end means bottom - position: 'start' + // On the x-axis start means top and end means bottom + position: 'start' }, axisY: { - // On the y-axis start means left and end means right - position: 'end' + // On the y-axis start means left and end means right + position: 'end' } - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5], - series: [[1, 2, 8, 1, 7]] + labels: [1, 2, 3, 4, 5], + series: [[1, 2, 8, 1, 7]] }, { lineSmooth: Chartist.Interpolation.none({ - fillHoles: false + fillHoles: false }) - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5], - series: [[1, 2, 8, 1, 7]] + labels: [1, 2, 3, 4, 5], + series: [[1, 2, 8, 1, 7]] }, { lineSmooth: Chartist.Interpolation.simple({ - divisor: 2, - fillHoles: false + divisor: 2, + fillHoles: false }) - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5], - series: [[1, 2, 8, 1, 7]] + labels: [1, 2, 3, 4, 5], + series: [[1, 2, 8, 1, 7]] }, { lineSmooth: Chartist.Interpolation.cardinal({ - tension: 1, - fillHoles: false + tension: 1, + fillHoles: false }) - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5], - series: [[1, 2, 8, 1, 7]] + labels: [1, 2, 3, 4, 5], + series: [[1, 2, 8, 1, 7]] }, { lineSmooth: Chartist.Interpolation.step({ - postpone: true, - fillHoles: false + postpone: true, + fillHoles: false }) - }); +}); var overlappingBarsData: Chartist.IChartistData = { - labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - series: [ - [5, 4, 3, 7, 5, 10, 3, 4, 8, 10, 6, 8], - [3, 2, 9, 5, 4, 6, 4, 6, 7, 8, 7, 4] - ] + labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + series: [ + [5, 4, 3, 7, 5, 10, 3, 4, 8, 10, 6, 8], + [3, 2, 9, 5, 4, 6, 4, 6, 7, 8, 7, 4] + ] }; var overlappingBarsOptions: Chartist.IBarChartOptions = { - seriesBarDistance: 10 + seriesBarDistance: 10 }; var overlappingBarsResponsiveOptions: Array> = [ - ['screen and (max-width: 640px)', { - seriesBarDistance: 5, - axisX: { - labelInterpolationFnc: (value: any) => { - return value[0]; - } - } - }] + ['screen and (max-width: 640px)', { + seriesBarDistance: 5, + axisX: { + labelInterpolationFnc: (value: any) => { + return value[0]; + } + } + }] ]; new Chartist.Bar('.ct-chart', overlappingBarsData, overlappingBarsOptions, overlappingBarsResponsiveOptions); new Chartist.Candle('.ct-chart', { - labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], - series: [ - [5, 4, 3, 7], - [3, 2, 9, 5], - [5, 4, 3, 7], - [3, 2, 9, 5], - [5, 4, 3, 7], - [3, 2, 9, 5], - [3, 2, 9, 5] - ] + labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + series: [ + [5, 4, 3, 7], + [3, 2, 9, 5], + [5, 4, 3, 7], + [3, 2, 9, 5], + [5, 4, 3, 7], + [3, 2, 9, 5], + [3, 2, 9, 5] + ] }, { - axisX: { - labelOffset: { - x: -10, - y: 0 + axisX: { + labelOffset: { + x: -10, + y: 0 + } + }, + axisY: { + showGrid: false, + labelInterpolationFnc: function (value: any) { + return value + 12000; + } } - }, - axisY: { - showGrid: false, - labelInterpolationFnc: function (value: any) { - return value + 12000; - } - } }); diff --git a/types/chartist/index.d.ts b/types/chartist/index.d.ts index 93918a5eeb..58db5e64ff 100644 --- a/types/chartist/index.d.ts +++ b/types/chartist/index.d.ts @@ -1,703 +1,728 @@ // Type definitions for Chartist v0.9.81 // Project: https://github.com/gionkunz/chartist-js -// Definitions by: Matt Gibbs , Simon Pfeifer , Cassey Lottman +// Definitions by: Matt Gibbs , Simon Pfeifer , Cassey Lottman , Anastasiia Antonova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Chartist { - interface ChartistStatic { - - /** - * Precision level used internally in Chartist for rounding. If you require more decimal places you can increase this number. - */ - precision: number; - - /** - * A map with characters to escape for strings to be safely used as attribute values. - */ - escapingMap: IChartistEscapeMap; - - Pie: IChartistPieChart; - Bar: IChartistBarChart; - Line: IChartistLineChart; - Candle: IChartistCandleChart; - - FixedScaleAxis: IFixedScaleAxisStatic; - AutoScaleAxis: IAutoScaleAxisStatic; - StepAxis: IStepAxisStatic; - - Svg: ChartistSvgStatic; - Interpolation: ChartistInterpolationStatic; - - noop: Function; - - alphaNumerate(n: number): string; - extend(target: Object, ...sources: Object[]): Object; - - replaceAll(str: string, subStr: string, newSubStr: string): string; - ensureUnit(value: number, unit: string): string; - quantity(input: string | number): Object; - - query(query: Node | string): Node; - times(length: number): Array; - sum(previous: number, current: number): number; - mapMultiply(factor: number): (num: number) => number; - mapAdd(addend: number): (num: number) => number; - serialMap(arr: Array, cb: Function): Array; - roundWithPrecision(value: number, digits?: number): number; - - getMultiValue(value: any, dimension?: any): number; // this method is not documented, but it is used in the examples - - serialize(data: Object | string | number): string; - deserialize(data: string): Object | string | number; - - createSvg(container: Node, width: string, height: string, className: string): Object; // TODO: Figure out if this is returning a ChartistSVGWrapper or an actual SVGElement - - plugins: any; - } - - interface IChartistEscapeMap { - [Key: string]: string; - } - - interface IResponsiveOptionTuple extends Array { - 0: string; - 1: T; - } - - // these have no other purpose than to help define the types that can be placed on - // a line chart axisX - // in the actual chartist library these are classes that project their options onto - // the parent class - interface IFixedScaleAxisStatic { } - interface IAutoScaleAxisStatic { } - interface IStepAxisStatic { } - - // data formats are not well documented on all the ways they can be passed to the constructors - // this definition gives some intellisense, but does not protect the user from misuse - // TODO: come in and tidy this up and make it fit better - interface IChartistData { - labels?: Array | Array | Array; - series: Array | Array> | Array | Array>; - } - - interface IChartistSeriesData { - name?: string; - value?: number; - data?: Array; - className?: string; - meta?: string; // I assume this could probably be a number as well? - } - - interface IChartistBase { - container: any; - data: IChartistData; - defaultOptions: T; - options: T; - responsiveOptions: Array>; - - // this most likely doesn't need to be exposed to the user - eventEmitter: any; - - supportsForeignObject: boolean; - supportsAnimations: boolean; - resizeListener: any; - - plugins?: Array; // all of these plugins seem to be functions with options, but keeping type any for now - - update(data: Object, options?: T, override?: boolean): void; - detach(): void; - - /** - * Use this function to register event handlers. The handler callbacks are synchronous and will run in the main thread rather than the event loop. - * - * @method on - * @param event {string} Name of the event. Check the examples for supported events. - * @param handler {Function} The handler function that will be called when an event with the given name was emitted. This function will receive a data argument which contains event data. See the example for more details. - */ - on(event: string, handler: Function): IChartistBase; - - /** - * Use this function to un-register event handlers. If the handler function parameter is omitted all handlers for the given event will be un-registered. - * - * @method off - * @param event {string} Name of the event for which a handler should be removed - * @param handler {Function} The handler function that that was previously used to register a new event handler. This handler will be removed from the event handler list. If this parameter is omitted then all event handlers for the given event are removed from the list. - */ - off(event: string, handler?: Function): IChartistBase; - } - - interface IChartistPieChart extends IChartistBase { - new (target: any, data: IChartistData, options?: IPieChartOptions, responsiveOptions?: Array>): IChartistPieChart; - } - - interface IChartistLineChart extends IChartistBase { - new (target: any, data: IChartistData, options?: ILineChartOptions, responsiveOptions?: Array>): IChartistLineChart; - } - - interface IChartistBarChart extends IChartistBase { - new (target: any, data: IChartistData, options?: IBarChartOptions, responsiveOptions?: Array>): IChartistBarChart; - } - - interface IChartistCandleChart extends IChartistBase { - new (target: any, data: IChartistData, options?: ICandleChartOptions, responsiveOptions?: Array>): IChartistCandleChart; - } - - interface IChartOptions { - /** - * If true the whole data is reversed including labels, the series order as well as the whole series data arrays. - */ - reverseData?: boolean; - - plugins?: Array; - } - - interface IPieChartOptions extends IChartOptions { - /** - * Specify a fixed width for the chart as a string (i.e. '100px' or '50%') - */ - width?: number | string; - - /** - * Specify a fixed height for the chart as a string (i.e. '100px' or '50%') - */ - height?: number | string; - - /** - * Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5} - */ - chartPadding?: IChartPadding | number; - - /** - * Override the class names that are used to generate the SVG structure of the chart - */ - classNames?: IPieChartClasses; - - /** - * The start angle of the pie chart in degrees where 0 points north. A higher value offsets the start angle clockwise. - */ - startAngle?: number; - - /** - * An optional total you can specify. By specifying a total value, the sum of the values in the series must be this total in order to draw a full pie. You can use this parameter to draw only parts of a pie or gauge charts. - */ - total?: number; - - /** - * If specified the donut CSS classes will be used and strokes will be drawn instead of pie slices. - */ - donut?: boolean; - - /** - * If specified the donut segments will be drawn as shapes instead of strokes. - */ - donutSolid?: boolean; - - /** - * Specify the donut stroke width, currently done in javascript for convenience. May move to CSS styles in the future. - * This option can be set as number or string to specify a relative width (i.e. 100 or '30%'). - */ - donutWidth?: number | string; - - /** - * Specify if a label should be shown or not - */ - showLabel?: boolean; - - /** - * Label position offset from the standard position which is half distance of the radius. This value can be either positive or negative. Positive values will position the label away from the center. - */ - labelOffset?: number; - - /** - * This option can be set to 'inside', 'outside' or 'center'. Positioned with 'inside' the labels will be placed on half the distance of the radius to the border of the Pie by respecting the 'labelOffset'. The 'outside' option will place the labels at the border of the pie and 'center' will place the labels in the absolute center point of the chart. The 'center' option only makes sense in conjunction with the 'labelOffset' option. - */ - labelPosition?: string; - - /** - * An interpolation function for the label value - */ - labelInterpolationFnc?: Function; - - /** - * Label direction can be 'neutral', 'explode' or 'implode'. Default is 'neutral'. The labels anchor will be positioned based on those settings as well as the fact if the labels are on the right or left side of the center of the chart. Usually explode is useful when labels are positioned far away from the center. - */ - labelDirection?: string; - - /** - * If true the whole data is reversed including labels, the series order as well as the whole series data arrays. - */ - reverseData?: boolean; - - /** - * If true empty values will be ignored to avoid drawing unncessary slices and labels - */ - ignoreEmptyValues?: boolean; - } - - interface IChartPadding { - top?: number; - right?: number; - bottom?: number; - left?: number; - } - - interface IPieChartClasses { - chartPie?: string; - chartDonut?: string; - series?: string; - slicePie?: string; - sliceDonut?: string; - label?: string; - } - - interface IBarChartOptions extends IChartOptions { - axisX?: IBarChartAxis; - axisY?: IBarChartAxis; - width?: number | string; - height?: number | string; - high?: number; - low?: number; - ticks?: Array; - onlyInteger?: boolean; - chartPadding?: IChartPadding; - seriesBarDistance?: number; - - /** - * If set to true this property will cause the series bars to be stacked and form a total for each series point. This will also influence the y-axis and the overall bounds of the chart. In stacked mode the seriesBarDistance property will have no effect. - */ - stackBars?: boolean; - - horizontalBars?: boolean; - distributeSeries?: boolean; - } - - interface IBarChartAxis { - offset?: number; - position?: string; - labelOffset?: { - x?: number; - y?: number; - }; - showLabel?: boolean; - showGrid?: boolean; - labelInterpolationFnc?: Function; - scaleMinSpace?: number; - onlyInteger?: boolean; - } - - interface IBarChartClasses { - chart?: string; - horizontalBars?: string; - label?: string; - labelGroup?: string; - series?: string; - bar?: string; - grid?: string; - gridGroup?: string; - vertical?: string; - horizontal?: string; - start?: string; - end?: string; - } - - interface ILineChartOptions extends IChartOptions { - axisX?: IChartistStepAxis | IChartistFixedScaleAxis | IChartistAutoScaleAxis; - axisY?: IChartistStepAxis | IChartistFixedScaleAxis | IChartistAutoScaleAxis; - width?: number | string; - height?: number | string; - showLine?: boolean; - showPoint?: boolean; - showArea?: boolean; - areaBase?: number; - lineSmooth?: Function | boolean; - low?: number; - high?: number; - ticks?: Array; - chartPadding?: IChartPadding; - fullWidth?: boolean; - classNames?: ILineChartClasses; - } - - interface ILineChartAxis { - offset?: number; - position?: string; - labelOffset?: { - x?: number; - y?: number; - }; - showLabel?: boolean; - showGrid?: boolean; - labelInterpolationFnc?: Function; - } - - interface IChartistStepAxis extends ILineChartAxis { - type?: IStepAxisStatic; - ticks?: Array | Array; - stretch?: boolean; - } - - interface IChartistFixedScaleAxis extends ILineChartAxis { - type?: IFixedScaleAxisStatic; - high?: number; - low?: number; - divisor?: number; - ticks?: Array | Array; - } - - interface IChartistAutoScaleAxis extends ILineChartAxis { - high?: number; - low?: number; - scaleMinSpace?: number; - onlyInteger?: boolean; - referenceValue?: number; - type?: IAutoScaleAxisStatic; - } - - interface ILineChartClasses { - /** - * Default is 'ct-chart-line' - */ - chart?: string; - label?: string; - labelGroup?: string; - series?: string; - line?: string; - point?: string; - area?: string; - grid?: string; - gridGroup?: string; - gridBackground?: string; - vertical?: string; - horizontal?: string; - start?: string; - end?: string; - } - - interface ICandleChartOptions extends IChartOptions { - - /** - * Options for X-Axis - */ - axisX?: ICandleChartAxis; - - /** - * Options for Y-Axis - */ - axisY?: ICandleChartAxis; - - /** - * Specify a fixed width for the chart as a string (i.e. '100px' or '50%') - */ - width?: number | string; - - /** - * Specify a fixed height for the chart as a string (i.e. '100px' or '50%') - */ - height?: number | string; - - /** - * Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value - */ - hight?: number | string; - - /** - * Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value - */ - low?: number | string; - - /** - * Width of candle body in pixel (IMO is 2 px best minimum value) - */ - candleWidth?: number | string; - - /** - * Width of candle wick in pixel (IMO is 1 px best minimum value) - */ - candleWickWidth?: number | string; - - /** - * Use calculated x-axis step length, depending on the number of quotes to display, as candle width. Otherwise the candleWidth is being used. - */ - useStepLengthAsCandleWidth?: boolean | string; - - /** - * Use 1/3 of candle body width as width for the candle wick, otherwise the candleWickWidth is being used. - */ - useOneThirdAsCandleWickWidth?: boolean | string; - - /** - * Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5} - */ - chartPadding?: IChartPadding | number; - - /** - * When set to true, the last grid line on the x-axis is not drawn and the chart elements will expand to the full available width of the chart. For the last label to be drawncorrectly you might need to add chart padding or offset the last label with a draw event handler. - */ - fullWidth?: boolean | string; - - /** - * Override the class names that get used to generate the SVG structure of the chart - */ - classNames?: ICandleChartClasses; - } - - interface ICandleChartAxis { - /** - * The offset of the chart drawing area to the border of the container - */ - offset?: number; - /** - * Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis. - */ - position?: string; - /** - * Allows you to correct label positioning on this axis by positive or negative x and y offset. - */ - labelOffset?: { - x?: number; - y?: number; - }; - /** - * If labels should be shown or not - */ - showLabel?: boolean; - /** - * If the axis grid should be drawn or not - */ - showGrid?: boolean; - /** - * Interpolation function that allows you to intercept the value from the axis label - */ - labelInterpolationFnc?: Function; - /** - * Set the axis type to be used to project values on this axis. If not defined, Chartist.StepAxis will be used for the X-Axis, where the ticks option will be set to the labels in the data and the stretch option will be set to the global fullWidth option. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here. - */ - type?: any; - } - - interface ICandleChartClasses { - chart?: string; - label?: string; - labelGroup?: string; - series?: string; - candlePositive?: string; - candleNegative?: string, - grid?: string, - gridGroup?: string, - gridBackground?: string, - vertical?: string, - horizontal?: string, - start?: string, - end?: string, - } - - - interface ChartistSvgStatic { - new (name: HTMLElement | string, attributes: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg; - - Easing: ChartistEasingStatic; - - /** - * This method checks for support of a given SVG feature like Extensibility, SVG-animation or the like. Check http://www.w3.org/TR/SVG11/feature for a detailed list. - */ - isSupported(feature: string): boolean; - } - - interface IChartistSvg { - - /** - * Set attributes on the current SVG element of the wrapper you're currently working on. - */ - attr(attributes: Object | string, ns: string): Object | string; - - /** - * Create a new SVG element whose wrapper object will be selected for further operations. This way you can also create nested groups easily. - */ - elem(name: string, attributes?: Object, className?: string, insertFirst?: boolean): IChartistSvg; - - /** - * Returns the parent Chartist.SVG wrapper object - */ - parent(): IChartistSvg; - - /** - * This method returns a Chartist.Svg wrapper around the root SVG element of the current tree. - */ - root(): IChartistSvg; - - /** - * Find the first child SVG element of the current element that matches a CSS selector. The returned object is a Chartist.Svg wrapper. - */ - querySelector(selector: string): IChartistSvg; - - /** - * Find the all child SVG elements of the current element that match a CSS selector. The returned object is a Chartist.Svg.List wrapper. - */ - querySelectorAll(selector: string): any; // this returns an svg wrapper list in the docs, need to see if that's just an array or a special list - - /** - * This method creates a foreignObject (see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject) that allows to embed HTML content into a SVG graphic. With the help of foreignObjects you can enable the usage of regular HTML elements inside of SVG where they are subject for SVG positioning and transformation but the Browser will use the HTML rendering capabilities for the containing DOM. - */ - foreignObject(content: any, attributes?: Object, className?: string, insertFirst?: boolean): IChartistSvg; - - /** - * This method adds a new text element to the current Chartist.Svg wrapper. - */ - text(t: string): IChartistSvg; - - /** - * This method will clear all child nodes of the current wrapper object. - */ - empty(): IChartistSvg; - - /** - * This method will cause the current wrapper to remove itself from its parent wrapper. Use this method if you'd like to get rid of an element in a given DOM structure. - */ - remove(): IChartistSvg; - - /** - * This method will replace the element with a new element that can be created outside of the current DOM. - */ - replace(): IChartistSvg; - - /** - * This method will append an element to the current element as a child. - */ - append(element: IChartistSvg, insertFirst?: boolean): IChartistSvg; - - /** - * Returns an array of class names that are attached to the current wrapper element. This method can not be chained further. - */ - classes(): Array; - - /** - * Adds one or a space separated list of classes to the current element and ensures the classes are only existing once. - * - * @method addClass - * @param names {string} A white space separated list of class names - */ - addClass(names: string): IChartistSvg; - - /** - * Removes one or a space separated list of classes from the current element. - * - * @method removeClass - * @param names {string} A white space separated list of class names - */ - removeClass(names: string): IChartistSvg; - - /** - * Removes all classes from the current element. - */ - removeAllClasses(): IChartistSvg; - - /** - * Get element height with fallback to svg BoundingBox or parent container dimensions - */ - height(): number; - - /** - * The animate function lets you animate the current element with SMIL animations. You can add animations for multiple attributes at the same time by using an animation definition object. This object should contain SMIL animation attributes. - */ - animate(animations: IChartistAnimations, guided: boolean, eventEmitter: Object): IChartistSvg; - - /** - * "Safe" way to get property value from svg BoundingBox. This is a workaround. Firefox throws an NS_ERROR_FAILURE error if getBBox() is called on an invisible node. - * THIS IS A WORKAROUND - */ - getBBoxProperty(node: SVGElement, prop: string): string; // TODO: find a good example of this and add it to the tests, it might belong to static - } - - interface IChartistAnimations { - [Key: string]: IChartistAnimationOptions; - } - - interface IChartistAnimationOptions { - id?: string; - dur: string | number; - from: string | number; - to: string | number; - easing?: IChartistEasingDefinition | string; - fill?: string; - begin?: string; - } - - interface IChartistEasingDefinition { - 0: number; - 1: number; - 2: number; - 3: number; - } - - interface ChartistEasingStatic { - easeInSine: IChartistEasingDefinition; - easeOutSine: IChartistEasingDefinition; - easeInOutSine: IChartistEasingDefinition; - easeInQuad: IChartistEasingDefinition; - easeOutQuad: IChartistEasingDefinition; - easeInOutQuad: IChartistEasingDefinition; - easeInCubic: IChartistEasingDefinition; - easeOutCubic: IChartistEasingDefinition; - easeInOutCubic: IChartistEasingDefinition; - easeInQuart: IChartistEasingDefinition; - easeOutQuart: IChartistEasingDefinition; - easeInOutQuart: IChartistEasingDefinition; - easeInQuint: IChartistEasingDefinition; - easeOutQuint: IChartistEasingDefinition; - easeInOutQuint: IChartistEasingDefinition; - easeInExpo: IChartistEasingDefinition; - easeOutExpo: IChartistEasingDefinition; - easeInOutExpo: IChartistEasingDefinition; - easeInCirc: IChartistEasingDefinition; - easeOutCirc: IChartistEasingDefinition; - easeInOutCirc: IChartistEasingDefinition; - easeInBack: IChartistEasingDefinition; - easeOutBack: IChartistEasingDefinition; - easeInOutBack: IChartistEasingDefinition; - } - - interface ChartistInterpolationStatic { - - /** - * This interpolation function does not smooth the path and the result is only containing lines and no curves. - */ - none(options?: IChartistInterpolationOptions): Function; - - /** - * Simple smoothing creates horizontal handles that are positioned with a fraction of the length between two data points. You can use the divisor option to specify the amount of smoothing. - */ - simple(options?: IChartistSimpleInterpolationOptions): Function; - - /** - * Cardinal / Catmull-Rome spline interpolation is the default smoothing function in Chartist. It produces nice results where the splines will always meet the points. It produces some artifacts though when data values are increased or decreased rapidly. The line may not follow a very accurate path and if the line should be accurate this smoothing function does not produce the best results. - */ - cardinal(options?: IChartistCardinalInterpolationOptions): Function; - - /** - * Step interpolation will cause the line chart to move in steps rather than diagonal or smoothed lines. This interpolation will create additional points that will also be drawn when the showPoint option is enabled. - */ - step(options?: IChartistStepInterpolationOptions): Function; - } - - interface IChartistInterpolationOptions { - fillHoles?: boolean; - } - - interface IChartistSimpleInterpolationOptions extends IChartistInterpolationOptions { - divisor?: number; - } - - interface IChartistCardinalInterpolationOptions extends IChartistInterpolationOptions { - tension?: number; - } - - interface IChartistStepInterpolationOptions extends IChartistInterpolationOptions { - postpone?: boolean; - } + interface ChartistStatic { + + /** + * Precision level used internally in Chartist for rounding. If you require more decimal places you can increase this number. + */ + precision: number; + + /** + * A map with characters to escape for strings to be safely used as attribute values. + */ + escapingMap: IChartistEscapeMap; + + Pie: IChartistPieChart; + Bar: IChartistBarChart; + Line: IChartistLineChart; + Candle: IChartistCandleChart; + + FixedScaleAxis: IFixedScaleAxisStatic; + AutoScaleAxis: IAutoScaleAxisStatic; + StepAxis: IStepAxisStatic; + + Svg: ChartistSvgStatic; + Interpolation: ChartistInterpolationStatic; + + noop: Function; + + alphaNumerate(n: number): string; + + extend(target: Object, ...sources: Object[]): Object; + + replaceAll(str: string, subStr: string, newSubStr: string): string; + + ensureUnit(value: number, unit: string): string; + + quantity(input: string | number): Object; + + query(query: Node | string): Node; + + times(length: number): Array; + + sum(previous: number, current: number): number; + + mapMultiply(factor: number): (num: number) => number; + + mapAdd(addend: number): (num: number) => number; + + serialMap(arr: Array, cb: Function): Array; + + roundWithPrecision(value: number, digits?: number): number; + + getMultiValue(value: any, dimension?: any): number; // this method is not documented, but it is used in the examples + + serialize(data: Object | string | number): string; + + deserialize(data: string): Object | string | number; + + createSvg(container: Node, width: string, height: string, className: string): Object; // TODO: Figure out if this is returning a ChartistSVGWrapper or an actual SVGElement + + plugins: any; + } + + interface IChartistEscapeMap { + [Key: string]: string; + } + + interface IResponsiveOptionTuple extends Array { + 0: string; + 1: T; + } + + // these have no other purpose than to help define the types that can be placed on + // a line chart axisX + // in the actual chartist library these are classes that project their options onto + // the parent class + interface IFixedScaleAxisStatic { + } + + interface IAutoScaleAxisStatic { + } + + interface IStepAxisStatic { + } + + // data formats are not well documented on all the ways they can be passed to the constructors + // this definition gives some intellisense, but does not protect the user from misuse + // TODO: come in and tidy this up and make it fit better + interface IChartistData { + labels?: Array | Array | Array; + series: Array | Array> | Array | Array>; + } + + interface IChartistSeriesData { + name?: string; + value?: number; + data?: Array; + className?: string; + meta?: string; // I assume this could probably be a number as well? + } + + interface IChartistBase { + container: any; + data: IChartistData; + defaultOptions: T; + options: T; + responsiveOptions: Array>; + + // this most likely doesn't need to be exposed to the user + eventEmitter: any; + + supportsForeignObject: boolean; + supportsAnimations: boolean; + resizeListener: any; + + plugins?: Array; // all of these plugins seem to be functions with options, but keeping type any for now + + update(data: Object, options?: T, override?: boolean): void; + + detach(): void; + + /** + * Use this function to register event handlers. The handler callbacks are synchronous and will run in the main thread rather than the event loop. + * + * @method on + * @param event {string} Name of the event. Check the examples for supported events. + * @param handler {Function} The handler function that will be called when an event with the given name was emitted. This function will receive a data argument which contains event data. See the example for more details. + */ + on(event: string, handler: Function): IChartistBase; + + /** + * Use this function to un-register event handlers. If the handler function parameter is omitted all handlers for the given event will be un-registered. + * + * @method off + * @param event {string} Name of the event for which a handler should be removed + * @param handler {Function} The handler function that that was previously used to register a new event handler. This handler will be removed from the event handler list. If this parameter is omitted then all event handlers for the given event are removed from the list. + */ + off(event: string, handler?: Function): IChartistBase; + } + + interface IChartistPieChart extends IChartistBase { + new (target: any, data: IChartistData, options?: IPieChartOptions, responsiveOptions?: Array>): IChartistPieChart; + } + + interface IChartistLineChart extends IChartistBase { + new (target: any, data: IChartistData, options?: ILineChartOptions, responsiveOptions?: Array>): IChartistLineChart; + } + + interface IChartistBarChart extends IChartistBase { + new (target: any, data: IChartistData, options?: IBarChartOptions, responsiveOptions?: Array>): IChartistBarChart; + } + + interface IChartistCandleChart extends IChartistBase { + new (target: any, data: IChartistData, options?: ICandleChartOptions, responsiveOptions?: Array>): IChartistCandleChart; + } + + interface IChartOptions { + /** + * If true the whole data is reversed including labels, the series order as well as the whole series data arrays. + */ + reverseData?: boolean; + + plugins?: Array; + } + + interface IPieChartOptions extends IChartOptions { + /** + * Specify a fixed width for the chart as a string (i.e. '100px' or '50%') + */ + width?: number | string; + + /** + * Specify a fixed height for the chart as a string (i.e. '100px' or '50%') + */ + height?: number | string; + + /** + * Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5} + */ + chartPadding?: IChartPadding | number; + + /** + * Override the class names that are used to generate the SVG structure of the chart + */ + classNames?: IPieChartClasses; + + /** + * The start angle of the pie chart in degrees where 0 points north. A higher value offsets the start angle clockwise. + */ + startAngle?: number; + + /** + * An optional total you can specify. By specifying a total value, the sum of the values in the series must be this total in order to draw a full pie. You can use this parameter to draw only parts of a pie or gauge charts. + */ + total?: number; + + /** + * If specified the donut CSS classes will be used and strokes will be drawn instead of pie slices. + */ + donut?: boolean; + + /** + * If specified the donut segments will be drawn as shapes instead of strokes. + */ + donutSolid?: boolean; + + /** + * Specify the donut stroke width, currently done in javascript for convenience. May move to CSS styles in the future. + * This option can be set as number or string to specify a relative width (i.e. 100 or '30%'). + */ + donutWidth?: number | string; + + /** + * Specify if a label should be shown or not + */ + showLabel?: boolean; + + /** + * Label position offset from the standard position which is half distance of the radius. This value can be either positive or negative. Positive values will position the label away from the center. + */ + labelOffset?: number; + + /** + * This option can be set to 'inside', 'outside' or 'center'. Positioned with 'inside' the labels will be placed on half the distance of the radius to the border of the Pie by respecting the 'labelOffset'. The 'outside' option will place the labels at the border of the pie and 'center' will place the labels in the absolute center point of the chart. The 'center' option only makes sense in conjunction with the 'labelOffset' option. + */ + labelPosition?: string; + + /** + * An interpolation function for the label value + */ + labelInterpolationFnc?: Function; + + /** + * Label direction can be 'neutral', 'explode' or 'implode'. Default is 'neutral'. The labels anchor will be positioned based on those settings as well as the fact if the labels are on the right or left side of the center of the chart. Usually explode is useful when labels are positioned far away from the center. + */ + labelDirection?: string; + + /** + * If true the whole data is reversed including labels, the series order as well as the whole series data arrays. + */ + reverseData?: boolean; + + /** + * If true empty values will be ignored to avoid drawing unncessary slices and labels + */ + ignoreEmptyValues?: boolean; + } + + interface IChartPadding { + top?: number; + right?: number; + bottom?: number; + left?: number; + } + + interface IPieChartClasses { + chartPie?: string; + chartDonut?: string; + series?: string; + slicePie?: string; + sliceDonut?: string; + label?: string; + } + + interface IBarChartOptions extends IChartOptions { + axisX?: IBarChartAxis; + axisY?: IBarChartAxis; + width?: number | string; + height?: number | string; + high?: number; + low?: number; + ticks?: Array; + onlyInteger?: boolean; + chartPadding?: IChartPadding; + seriesBarDistance?: number; + + /** + * If set to true this property will cause the series bars to be stacked and form a total for each series point. This will also influence the y-axis and the overall bounds of the chart. In stacked mode the seriesBarDistance property will have no effect. + */ + stackBars?: boolean; + + horizontalBars?: boolean; + distributeSeries?: boolean; + } + + interface IBarChartAxis { + offset?: number; + position?: string; + labelOffset?: { + x?: number; + y?: number; + }; + showLabel?: boolean; + showGrid?: boolean; + labelInterpolationFnc?: Function; + scaleMinSpace?: number; + onlyInteger?: boolean; + } + + interface IBarChartClasses { + chart?: string; + horizontalBars?: string; + label?: string; + labelGroup?: string; + series?: string; + bar?: string; + grid?: string; + gridGroup?: string; + vertical?: string; + horizontal?: string; + start?: string; + end?: string; + } + + interface ILineChartOptions extends IChartOptions { + axisX?: IChartistStepAxis | IChartistFixedScaleAxis | IChartistAutoScaleAxis; + axisY?: IChartistStepAxis | IChartistFixedScaleAxis | IChartistAutoScaleAxis; + width?: number | string; + height?: number | string; + showLine?: boolean; + showPoint?: boolean; + showArea?: boolean; + areaBase?: number; + lineSmooth?: Function | boolean; + low?: number; + high?: number; + ticks?: Array; + chartPadding?: IChartPadding; + fullWidth?: boolean; + classNames?: ILineChartClasses; + series?: { + [key: string]: { + lineSmooth?: Function | boolean; + showLine?: boolean; + showPoint?: boolean; + showArea?: boolean; + areaBase?: number; + } + } + } + + interface ILineChartAxis { + offset?: number; + position?: string; + labelOffset?: { + x?: number; + y?: number; + }; + showLabel?: boolean; + showGrid?: boolean; + labelInterpolationFnc?: Function; + } + + interface IChartistStepAxis extends ILineChartAxis { + type?: IStepAxisStatic; + ticks?: Array | Array; + stretch?: boolean; + } + + interface IChartistFixedScaleAxis extends ILineChartAxis { + type?: IFixedScaleAxisStatic; + high?: number; + low?: number; + divisor?: number; + ticks?: Array | Array; + } + + interface IChartistAutoScaleAxis extends ILineChartAxis { + high?: number; + low?: number; + scaleMinSpace?: number; + onlyInteger?: boolean; + referenceValue?: number; + type?: IAutoScaleAxisStatic; + } + + interface ILineChartClasses { + /** + * Default is 'ct-chart-line' + */ + chart?: string; + label?: string; + labelGroup?: string; + series?: string; + line?: string; + point?: string; + area?: string; + grid?: string; + gridGroup?: string; + gridBackground?: string; + vertical?: string; + horizontal?: string; + start?: string; + end?: string; + } + + interface ICandleChartOptions extends IChartOptions { + + /** + * Options for X-Axis + */ + axisX?: ICandleChartAxis; + + /** + * Options for Y-Axis + */ + axisY?: ICandleChartAxis; + + /** + * Specify a fixed width for the chart as a string (i.e. '100px' or '50%') + */ + width?: number | string; + + /** + * Specify a fixed height for the chart as a string (i.e. '100px' or '50%') + */ + height?: number | string; + + /** + * Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value + */ + hight?: number | string; + + /** + * Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value + */ + low?: number | string; + + /** + * Width of candle body in pixel (IMO is 2 px best minimum value) + */ + candleWidth?: number | string; + + /** + * Width of candle wick in pixel (IMO is 1 px best minimum value) + */ + candleWickWidth?: number | string; + + /** + * Use calculated x-axis step length, depending on the number of quotes to display, as candle width. Otherwise the candleWidth is being used. + */ + useStepLengthAsCandleWidth?: boolean | string; + + /** + * Use 1/3 of candle body width as width for the candle wick, otherwise the candleWickWidth is being used. + */ + useOneThirdAsCandleWickWidth?: boolean | string; + + /** + * Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5} + */ + chartPadding?: IChartPadding | number; + + /** + * When set to true, the last grid line on the x-axis is not drawn and the chart elements will expand to the full available width of the chart. For the last label to be drawncorrectly you might need to add chart padding or offset the last label with a draw event handler. + */ + fullWidth?: boolean | string; + + /** + * Override the class names that get used to generate the SVG structure of the chart + */ + classNames?: ICandleChartClasses; + } + + interface ICandleChartAxis { + /** + * The offset of the chart drawing area to the border of the container + */ + offset?: number; + /** + * Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis. + */ + position?: string; + /** + * Allows you to correct label positioning on this axis by positive or negative x and y offset. + */ + labelOffset?: { + x?: number; + y?: number; + }; + /** + * If labels should be shown or not + */ + showLabel?: boolean; + /** + * If the axis grid should be drawn or not + */ + showGrid?: boolean; + /** + * Interpolation function that allows you to intercept the value from the axis label + */ + labelInterpolationFnc?: Function; + /** + * Set the axis type to be used to project values on this axis. If not defined, Chartist.StepAxis will be used for the X-Axis, where the ticks option will be set to the labels in the data and the stretch option will be set to the global fullWidth option. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here. + */ + type?: any; + } + + interface ICandleChartClasses { + chart?: string; + label?: string; + labelGroup?: string; + series?: string; + candlePositive?: string; + candleNegative?: string, + grid?: string, + gridGroup?: string, + gridBackground?: string, + vertical?: string, + horizontal?: string, + start?: string, + end?: string, + } + + + interface ChartistSvgStatic { + new (name: HTMLElement | string, attributes: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg; + + Easing: ChartistEasingStatic; + + /** + * This method checks for support of a given SVG feature like Extensibility, SVG-animation or the like. Check http://www.w3.org/TR/SVG11/feature for a detailed list. + */ + isSupported(feature: string): boolean; + } + + interface IChartistSvg { + + /** + * Set attributes on the current SVG element of the wrapper you're currently working on. + */ + attr(attributes: Object | string, ns: string): Object | string; + + /** + * Create a new SVG element whose wrapper object will be selected for further operations. This way you can also create nested groups easily. + */ + elem(name: string, attributes?: Object, className?: string, insertFirst?: boolean): IChartistSvg; + + /** + * Returns the parent Chartist.SVG wrapper object + */ + parent(): IChartistSvg; + + /** + * This method returns a Chartist.Svg wrapper around the root SVG element of the current tree. + */ + root(): IChartistSvg; + + /** + * Find the first child SVG element of the current element that matches a CSS selector. The returned object is a Chartist.Svg wrapper. + */ + querySelector(selector: string): IChartistSvg; + + /** + * Find the all child SVG elements of the current element that match a CSS selector. The returned object is a Chartist.Svg.List wrapper. + */ + querySelectorAll(selector: string): any; // this returns an svg wrapper list in the docs, need to see if that's just an array or a special list + + /** + * This method creates a foreignObject (see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject) that allows to embed HTML content into a SVG graphic. With the help of foreignObjects you can enable the usage of regular HTML elements inside of SVG where they are subject for SVG positioning and transformation but the Browser will use the HTML rendering capabilities for the containing DOM. + */ + foreignObject(content: any, attributes?: Object, className?: string, insertFirst?: boolean): IChartistSvg; + + /** + * This method adds a new text element to the current Chartist.Svg wrapper. + */ + text(t: string): IChartistSvg; + + /** + * This method will clear all child nodes of the current wrapper object. + */ + empty(): IChartistSvg; + + /** + * This method will cause the current wrapper to remove itself from its parent wrapper. Use this method if you'd like to get rid of an element in a given DOM structure. + */ + remove(): IChartistSvg; + + /** + * This method will replace the element with a new element that can be created outside of the current DOM. + */ + replace(): IChartistSvg; + + /** + * This method will append an element to the current element as a child. + */ + append(element: IChartistSvg, insertFirst?: boolean): IChartistSvg; + + /** + * Returns an array of class names that are attached to the current wrapper element. This method can not be chained further. + */ + classes(): Array; + + /** + * Adds one or a space separated list of classes to the current element and ensures the classes are only existing once. + * + * @method addClass + * @param names {string} A white space separated list of class names + */ + addClass(names: string): IChartistSvg; + + /** + * Removes one or a space separated list of classes from the current element. + * + * @method removeClass + * @param names {string} A white space separated list of class names + */ + removeClass(names: string): IChartistSvg; + + /** + * Removes all classes from the current element. + */ + removeAllClasses(): IChartistSvg; + + /** + * Get element height with fallback to svg BoundingBox or parent container dimensions + */ + height(): number; + + /** + * The animate function lets you animate the current element with SMIL animations. You can add animations for multiple attributes at the same time by using an animation definition object. This object should contain SMIL animation attributes. + */ + animate(animations: IChartistAnimations, guided: boolean, eventEmitter: Object): IChartistSvg; + + /** + * "Safe" way to get property value from svg BoundingBox. This is a workaround. Firefox throws an NS_ERROR_FAILURE error if getBBox() is called on an invisible node. + * THIS IS A WORKAROUND + */ + getBBoxProperty(node: SVGElement, prop: string): string; // TODO: find a good example of this and add it to the tests, it might belong to static + } + + interface IChartistAnimations { + [Key: string]: IChartistAnimationOptions; + } + + interface IChartistAnimationOptions { + id?: string; + dur: string | number; + from: string | number; + to: string | number; + easing?: IChartistEasingDefinition | string; + fill?: string; + begin?: string; + } + + interface IChartistEasingDefinition { + 0: number; + 1: number; + 2: number; + 3: number; + } + + interface ChartistEasingStatic { + easeInSine: IChartistEasingDefinition; + easeOutSine: IChartistEasingDefinition; + easeInOutSine: IChartistEasingDefinition; + easeInQuad: IChartistEasingDefinition; + easeOutQuad: IChartistEasingDefinition; + easeInOutQuad: IChartistEasingDefinition; + easeInCubic: IChartistEasingDefinition; + easeOutCubic: IChartistEasingDefinition; + easeInOutCubic: IChartistEasingDefinition; + easeInQuart: IChartistEasingDefinition; + easeOutQuart: IChartistEasingDefinition; + easeInOutQuart: IChartistEasingDefinition; + easeInQuint: IChartistEasingDefinition; + easeOutQuint: IChartistEasingDefinition; + easeInOutQuint: IChartistEasingDefinition; + easeInExpo: IChartistEasingDefinition; + easeOutExpo: IChartistEasingDefinition; + easeInOutExpo: IChartistEasingDefinition; + easeInCirc: IChartistEasingDefinition; + easeOutCirc: IChartistEasingDefinition; + easeInOutCirc: IChartistEasingDefinition; + easeInBack: IChartistEasingDefinition; + easeOutBack: IChartistEasingDefinition; + easeInOutBack: IChartistEasingDefinition; + } + + interface ChartistInterpolationStatic { + + /** + * This interpolation function does not smooth the path and the result is only containing lines and no curves. + */ + none(options?: IChartistInterpolationOptions): Function; + + /** + * Simple smoothing creates horizontal handles that are positioned with a fraction of the length between two data points. You can use the divisor option to specify the amount of smoothing. + */ + simple(options?: IChartistSimpleInterpolationOptions): Function; + + /** + * Cardinal / Catmull-Rome spline interpolation is the default smoothing function in Chartist. It produces nice results where the splines will always meet the points. It produces some artifacts though when data values are increased or decreased rapidly. The line may not follow a very accurate path and if the line should be accurate this smoothing function does not produce the best results. + */ + cardinal(options?: IChartistCardinalInterpolationOptions): Function; + + /** + * Step interpolation will cause the line chart to move in steps rather than diagonal or smoothed lines. This interpolation will create additional points that will also be drawn when the showPoint option is enabled. + */ + step(options?: IChartistStepInterpolationOptions): Function; + } + + interface IChartistInterpolationOptions { + fillHoles?: boolean; + } + + interface IChartistSimpleInterpolationOptions extends IChartistInterpolationOptions { + divisor?: number; + } + + interface IChartistCardinalInterpolationOptions extends IChartistInterpolationOptions { + tension?: number; + } + + interface IChartistStepInterpolationOptions extends IChartistInterpolationOptions { + postpone?: boolean; + } } declare var Chartist: Chartist.ChartistStatic; export = Chartist; -export as namespace Chartist; \ No newline at end of file +export as namespace Chartist; diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index d2b92e4b22..3553daada1 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -5989,6 +5989,16 @@ declare namespace chrome.tabs { * @since Chrome 45. */ audible?: boolean; + /** + * Whether the tab is discarded. A discarded tab is one whose content has been unloaded from memory, but is still visible in the tab strip. Its content gets reloaded the next time it's activated. + * @since Chrome 54. + */ + discarded: boolean; + /** + * Whether the tab can be discarded automatically by the browser when resources are low. + * @since Chrome 54. + */ + autoDiscardable: boolean; /** * Optional. * Current tab muted state and the reason for the last state change. @@ -6153,6 +6163,11 @@ declare namespace chrome.tabs { * @since Chrome 45. */ muted?: boolean; + /** + * Optional. Whether the tab should be discarded automatically by the browser when resources are low. + * @since Chrome 54. + */ + autoDiscardable?: boolean; } export interface CaptureVisibleTabOptions { @@ -6200,7 +6215,7 @@ declare namespace chrome.tabs { * Optional. Whether the tabs have completed loading. * One of: "loading", or "complete" */ - status?: string; + status?: 'loading' | 'complete'; /** * Optional. Whether the tabs are in the last focused window. * @since Chrome 19. @@ -6212,7 +6227,7 @@ declare namespace chrome.tabs { * Optional. The type of window the tabs are in. * One of: "normal", "popup", "panel", "app", or "devtools" */ - windowType?: string; + windowType?: 'normal' | 'popup' | 'panel' | 'app' | 'devtools'; /** Optional. Whether the tabs are active in their windows. */ active?: boolean; /** @@ -6231,6 +6246,18 @@ declare namespace chrome.tabs { currentWindow?: boolean; /** Optional. Whether the tabs are highlighted. */ highlighted?: boolean; + /** + * Optional. + * Whether the tabs are discarded. A discarded tab is one whose content has been unloaded from memory, but is still visible in the tab strip. Its content gets reloaded the next time it's activated. + * @since Chrome 54. + */ + discarded?: boolean; + /** + * Optional. + * Whether the tabs can be discarded automatically by the browser when resources are low. + * @since Chrome 54. + */ + autoDiscardable?: boolean; /** Optional. Whether the tabs are pinned. */ pinned?: boolean; /** @@ -6280,6 +6307,16 @@ declare namespace chrome.tabs { * @since Chrome 45. */ audible?: boolean; + /** + * The tab's new discarded state. + * @since Chrome 54. + */ + discarded?: boolean; + /** + * The tab's new auto-discardable + * @since Chrome 54. + */ + autoDiscardable?: boolean; /** * The tab's new muted state and the reason for the change. * @since Chrome 46. Warning: this is the current Beta channel. @@ -6604,6 +6641,13 @@ declare namespace chrome.tabs { * Paramater zoomSettings: The tab's current zoom settings. */ export function getZoomSettings(tabId: number, callback: (zoomSettings: ZoomSettings) => void): void; + /** + * Discards a tab from memory. Discarded tabs are still visible on the tab strip and are reloaded when activated. + * @since Chrome 54. + * @param tabId Optional. The ID of the tab to be discarded. If specified, the tab will be discarded unless it's active or already discarded. If omitted, the browser will discard the least important tab. This can fail if no discardable tabs exist. + * @param callback Called after the operation is completed. + */ + export function discard(tabId: number, callback: (tab: Tab) => void): void; /** * Fired when the highlighted or selected tabs in a window changes. diff --git a/types/cli-table/cli-table-tests.ts b/types/cli-table/cli-table-tests.ts new file mode 100644 index 0000000000..30d160f699 --- /dev/null +++ b/types/cli-table/cli-table-tests.ts @@ -0,0 +1,50 @@ +import Table = require('cli-table'); + +/** + * Example. + */ + +/* col widths */ +const table = new Table({ + head: ['Rel', 'Change', 'By', 'When'], + colWidths: [6, 21, 25, 17] +}); + +table.push( + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'], + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] +); + +table.toString(); + +/* compact */ +const table1 = new Table({ + head: ['Rel', 'Change', 'By', 'When'], + colWidths: [6, 21, 25, 17], + style : {compact : true, 'padding-left' : 1} +}); + +table1.push( + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'], + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'], + [], + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] +); + +/* headless */ +const headless_table = new Table(); +headless_table.push( + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'] +); +/* vertical */ +const vertical_table = new Table(); +vertical_table.push( + { "Some Key": "Some Value"}, + { "Another much longer key": "And its corresponding longer value"} +); +/* cross */ +const cross_table = new Table({ head: ["", "Header #1", "Header #2"] }); +cross_table.push( + { "Header #3": ["Value 1", "Value 2"] }, + { "Header #4": ["Value 3", "Value 4"] } +); diff --git a/types/cli-table/index.d.ts b/types/cli-table/index.d.ts new file mode 100644 index 0000000000..a39ac2d914 --- /dev/null +++ b/types/cli-table/index.d.ts @@ -0,0 +1,45 @@ +// Type definitions for cli-table 0.3 +// Project: https://github.com/Automattic/cli-table +// Definitions by: AryloYeung +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +interface TableOptions { + chars: Partial>; + truncate: string; + colors: boolean; + colWidths: number[]; + colAligns: Array<"left" | "middle" | "right">; + style: Partial<{ + 'padding-left': number; + 'padding-right': number; + head: string[]; + border: string[]; + compact: boolean; + }>; + head: string[]; +} + +declare class Table extends Array { + constructor(options?: Partial); + toString(): string; + static version: string; +} + +export = Table; diff --git a/types/cli-table/tsconfig.json b/types/cli-table/tsconfig.json new file mode 100644 index 0000000000..50afa32769 --- /dev/null +++ b/types/cli-table/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cli-table-tests.ts" + ] +} diff --git a/types/cli-table/tslint.json b/types/cli-table/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cli-table/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/create-subscription/create-subscription-tests.tsx b/types/create-subscription/create-subscription-tests.tsx new file mode 100644 index 0000000000..891adc5ede --- /dev/null +++ b/types/create-subscription/create-subscription-tests.tsx @@ -0,0 +1,119 @@ +import * as React from "react"; +import { createSubscription, Subscription } from "create-subscription"; + +// +// Example: Subscribing to event dispatchers +// https://github.com/facebook/react/blob/fa7fa812c70084e139d13437fb204fcdf9152299/packages/create-subscription/README.md#subscribing-to-event-dispatchers +// ---------------------------------------------------------------------------- + +// Start with a simple component. +// In this case, it's a functional component, but it could have been a class. +function FollowerComponent({ followersCount }: { followersCount: number }) { + return
You have {followersCount} followers!
; +} + +interface EventDispatcher { + value: T; + addEventListener(eventName: "change", onChange: (newValue: T) => any): void; + removeEventListener(eventName: "change", onChange: (newValue: T) => any): void; +} + +// Create a wrapper component to manage the subscription. +// $ExpectType Subscription, number> +const EventHandlerSubscription = createSubscription({ + getCurrentValue: (eventDispatcher: EventDispatcher) => eventDispatcher.value, + subscribe: (eventDispatcher: EventDispatcher, callback) => { + const onChange = (event: any) => callback(eventDispatcher.value); + eventDispatcher.addEventListener("change", onChange); + return () => eventDispatcher.removeEventListener("change", onChange); + } +}); + +declare const eventDispatcher: EventDispatcher; + +// Your component can now be used as shown below. +// In this example, 'eventDispatcher' represents a generic event dispatcher. + + {value => { + // $ExpectType number + const followersCount = value; + return ; + }} +; + +// +// Example: Subscribing to event dispatchers +// https://github.com/facebook/react/blob/fa7fa812c70084e139d13437fb204fcdf9152299/packages/create-subscription/README.md#subscribing-to-a-promise +// ---------------------------------------------------------------------------- + +// Start with a simple component. +const LoadingComponent: React.SFC<{ loadingStatus: string | undefined }> = ({ loadingStatus }) => { + if (loadingStatus === undefined) { + // Loading + } else if (loadingStatus === null) { + // Error + } else { + // Success + } + return null; +}; + +// Wrap the functional component with a subscriber HOC. +// This HOC will manage subscriptions and pass values to the decorated component. +// It will add and remove subscriptions in an async-safe way when props change. +// $ExpectType Subscription, string | undefined> +const PromiseSubscription = createSubscription({ + getCurrentValue: promise => { + // There is no way to synchronously read a Promise's value, + // So this method should return undefined. + return undefined; + }, + subscribe: (promise: Promise, callback: (newValue: string | undefined) => void) => { + promise.then( + // Success + callback, + // Failure + () => callback(undefined) + ); + + // There is no way to "unsubscribe" from a Promise. + // create-subscription will still prevent stale values from rendering. + return () => {}; + } +}); + +declare const loadingPromise: Promise; + +// Your component can now be used as shown below. + + {value => { + // $ExpectType string | undefined + const loadingStatus = value; + return ; + }} +; + +// +// Error cases +// ---------------------------------------------------------------------------- + +declare const wrongPromise: Promise; + +// $ExpectError + + {value => null} +; + +// $ExpectError +const MismatchSubscription = createSubscription({ + getCurrentValue: (a: number) => null, + subscribe: (a: string, callback) => (() => undefined) +}); + +// $ExpectError +const NoUnsubscribe = createSubscription({ + getCurrentValue: (a: number) => a, + subscribe: (a: number, callback) => { + // oops, should've returned a callback here + } +}); diff --git a/types/create-subscription/index.d.ts b/types/create-subscription/index.d.ts new file mode 100644 index 0000000000..79003980ee --- /dev/null +++ b/types/create-subscription/index.d.ts @@ -0,0 +1,37 @@ +// Type definitions for create-subscription 16.4 +// Project: https://github.com/facebook/react/tree/master/packages/create-subscription +// Definitions by: Asana +// Vincent Siao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; + +export type Unsubscribe = () => any; + +export interface SubscriptionConfig { + /** + * Synchronously gets the value for the subscribed property. + * Return undefined if the subscribable value is undefined, + * Or does not support synchronous reading (e.g. native Promise). + */ + getCurrentValue: (source: S) => T; + + /** + * Set up a subscription for the subscribable value in props, and return an unsubscribe function. + * Return false to indicate the property cannot be unsubscribed from (e.g. native Promises). + * Due to the variety of change event types, subscribers should provide their own handlers. + * Those handlers should not attempt to update state though; + * They should call the callback() instead when a subscription changes. + */ + subscribe: (source: S, callback: (newValue: T) => void) => Unsubscribe; +} + +export interface SubscriptionProps { + children: (value: T) => React.ReactNode; + source: S; +} + +export interface Subscription extends React.ComponentClass> {} + +export function createSubscription(config: SubscriptionConfig): Subscription; diff --git a/types/create-subscription/tsconfig.json b/types/create-subscription/tsconfig.json new file mode 100644 index 0000000000..0e42cd3adb --- /dev/null +++ b/types/create-subscription/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "jsx": "react", + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "create-subscription-tests.tsx" + ] +} diff --git a/types/create-subscription/tslint.json b/types/create-subscription/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/create-subscription/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index 4da9cd9ca0..18c3c0d1b5 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -4,6 +4,7 @@ // Shenghan Gao // Yuri Pereira Constante // Jan-Niclas Struewer +// Cerberuser // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Translation from Objects in help to Typescript interface. @@ -4527,4 +4528,22 @@ declare namespace cytoscape { */ promise(animationEvent?: "completed" | "complete" | "frame"): Promise; } + + /** + * Cytoscape extension type + * Definition of an extension would be in following form: + * @example + * declare module 'cytoscape-ext' { + * const ext: cytoscape.Ext; + * export = ext; + * } + */ + type Ext = (cytoscape: (options?: CytoscapeOptions) => Core) => void; + /** + * Register imported extension into cytoscape + * @param module Entry point for the extension, got by module = require('cy-ext') + * or by import module from 'cy-ext' + * http://js.cytoscape.org/#extensions + */ + function use(module: Ext): void; } diff --git a/types/d3-brush/index.d.ts b/types/d3-brush/index.d.ts index 644e6c06f7..e3d11d8f11 100644 --- a/types/d3-brush/index.d.ts +++ b/types/d3-brush/index.d.ts @@ -195,21 +195,21 @@ export interface BrushBehavior { * Create a new two-dimensional brush. * * The generic "Datum" refers to the type of the data of the selected svg:g element to - * which the returned BrushBEhavoir will be applied. + * which the returned BrushBehavior will be applied. */ export function brush(): BrushBehavior; /** * Creates a new one-dimensional brush along the x-dimension. * * The generic "Datum" refers to the type of the data of the selected svg:g element to - * which the returned BrushBEhavoir will be applied. + * which the returned BrushBehavior will be applied. */ export function brushX(): BrushBehavior; /** * Creates a new one-dimensional brush along the y-dimension. * * The generic "Datum" refers to the type of the data of the selected svg:g element to - * which the returned BrushBEhavoir will be applied. + * which the returned BrushBehavior will be applied. */ export function brushY(): BrushBehavior; diff --git a/types/d3-chord/d3-chord-tests.ts b/types/d3-chord/d3-chord-tests.ts index b66f39787a..284e307024 100644 --- a/types/d3-chord/d3-chord-tests.ts +++ b/types/d3-chord/d3-chord-tests.ts @@ -180,7 +180,7 @@ canvasRibbon(ribbon); // render ribbon for first chord // The below fails explicitly, as standard ChordSubgroup objects for source and target are missing "radius" property assumed in default // radius accessor. Given the internals of d3 this would lead to a "NaN" radius. So using static typing to raise this to -// awareness seems appropriate. The alternative, is to create RibbonGenerator using the generics to explictly set the types and +// awareness seems appropriate. The alternative, is to create RibbonGenerator using the generics to explicitly set the types and // then set the radius. Or, one could map a radius property into the Chords returned by the ChordLayout. // canvasRibbon(chords[0]); // fails, see above diff --git a/types/d3-chord/index.d.ts b/types/d3-chord/index.d.ts index b4865c962c..176cfe7af8 100644 --- a/types/d3-chord/index.d.ts +++ b/types/d3-chord/index.d.ts @@ -44,7 +44,7 @@ export interface ChordSubgroup { */ export interface Chord { /** - * Chord subgroup constituting the sodurce of Chord + * Chord subgroup constituting the source of Chord */ source: ChordSubgroup; /** @@ -122,7 +122,7 @@ export interface ChordLayout { * * The default is zero. * - * @param angle Pad angle between adjecent groups in radians. + * @param angle Pad angle between adjacent groups in radians. */ padAngle(angle: number): this; @@ -233,7 +233,7 @@ export interface Ribbon { /** * - * A ribbon generator to suport rendering of chords in a chord diagram. + * A ribbon generator to support rendering of chords in a chord diagram. * * The first generic corresponds to the type of the "this" context within which the ribbon generator and its accessor functions will be invoked. * diff --git a/types/d3-collection/index.d.ts b/types/d3-collection/index.d.ts index 5e7973e03b..89ac8d6153 100644 --- a/types/d3-collection/index.d.ts +++ b/types/d3-collection/index.d.ts @@ -7,7 +7,7 @@ // Last module patch version validated against: 1.0.4 /** - * Reference type things that can be coerced to string implicitely + * Reference type things that can be coerced to string implicitly */ export interface Stringifiable { toString(): string; @@ -64,7 +64,7 @@ export function entries(obj: object): Array<{ key: string, value: any }>; // --------------------------------------------------------------------- /** - * A datastructure similar to ES6 Maps, but with a few differences: + * A data structure similar to ES6 Maps, but with a few differences: * - Keys are coerced to strings. * - map.each, not map.forEach. (Also, no thisArg.) * - map.remove, not map.delete. @@ -194,7 +194,7 @@ export function map(obj: object): Map; // --------------------------------------------------------------------- /** - * A datastructure similar to ES6 Sets, but with a few differences: + * A data structure similar to ES6 Sets, but with a few differences: * * - Values are coerced to strings. * - set.each, not set.forEach. (Also, no thisArg.) @@ -282,11 +282,11 @@ export function set(array: T[], key: (value: T, index: number, array: T[]) => // --------------------------------------------------------------------- /** - * A more formal defintion of the nested array returned by Nest.entries(...). This data structure is intended as a reference only. + * A more formal definition of the nested array returned by Nest.entries(...). This data structure is intended as a reference only. * * As the union types cannot be ex ante simplified without knowledge * of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome - * to use in practice. This is particularly true for discrimiation of array element types. + * to use in practice. This is particularly true for discrimination of array element types. * The use of the rollup function, or lack thereof, also determines whether NestedArray has the 'values' property * with an array of type Datum at leaf level, or has a rolled-up 'value' property. */ @@ -294,7 +294,7 @@ export function set(array: T[], key: (value: T, index: number, array: T[]) => export interface NestedArray extends Array<{ key: string, values: NestedArray | Datum[] | undefined, value: RollupType | undefined }> { } /** - * A more formal defintion of the nested array returned by Nest.map(...). This data structure is intended as a reference only. + * A more formal definition of the nested array returned by Nest.map(...). This data structure is intended as a reference only. * * As the union types cannot be ex ante simplified without knowledge * of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome @@ -304,7 +304,7 @@ export interface NestedArray extends Array<{ key: string, val export interface NestedMap extends Map | Datum[] | RollupType> { } /** - * A more formal defintion of the nested array returned by Nest.object(...). This data structure is intended as a reference only. + * A more formal definition of the nested array returned by Nest.object(...). This data structure is intended as a reference only. * * As the union types cannot be ex ante simplified without knowledge * of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome diff --git a/types/d3-color/d3-color-tests.ts b/types/d3-color/d3-color-tests.ts index 47f191073b..2d324e7886 100644 --- a/types/d3-color/d3-color-tests.ts +++ b/types/d3-color/d3-color-tests.ts @@ -36,6 +36,7 @@ cRGB = cRGB.darker(0.2); cRGB = cRGB.rgb(); displayable = cRGB.displayable(); cString = cRGB.toString(); +cString = cRGB.hex(); console.log('Channels = (r : %d, g: %d, b: %d)', cRGB.r, cRGB.g, cRGB.b); console.log('Opacity = %d', cRGB.opacity); @@ -51,6 +52,7 @@ cHSL = cHSL.darker(0.2); cRGB = cHSL.rgb(); displayable = cHSL.displayable(); cString = cHSL.toString(); +cString = cHSL.hex(); console.log('Channels = (h : %d, s: %d, l: %d)', cHSL.h, cHSL.s, cHSL.l); console.log('Opacity = %d', cHSL.opacity); @@ -70,9 +72,14 @@ cLab = cLab.darker(0.2); cRGB = cLab.rgb(); displayable = cLab.displayable(); cString = cLab.toString(); +cString = cLab.hex(); console.log('Channels = (l : %d, a: %d, b: %d)', cLab.l, cLab.a, cLab.b); console.log('Opacity = %d', cLab.opacity); +// Signature tests for Gray +cLab = d3Color.gray(120); +cLab = d3Color.gray(120, 0.5); + // Signature tests for HCL let cHcl: d3Color.HCLColor; @@ -89,9 +96,16 @@ cHcl = cHcl.darker(0.2); cRGB = cHcl.rgb(); displayable = cHcl.displayable(); cString = cHcl.toString(); +cString = cHcl.hex(); console.log('Channels = (h : %d, c: %d, l: %d)', cHcl.h, cHcl.c, cHcl.l); console.log('Opacity = %d', cHcl.opacity); +cHcl = d3Color.lch(40, 50, 120); +cHcl = d3Color.lch(40, 50, 120, 0.5); +cHcl = d3Color.lch('steelblue'); +cHcl = d3Color.lch('rgba(20, 100, 200, 0.5)'); +cHcl = d3Color.lch(c); + // Signature tests for Cubehelix let cCubehelix: d3Color.CubehelixColor; @@ -108,6 +122,7 @@ cCubehelix = cCubehelix.darker(0.2); cRGB = cCubehelix.rgb(); displayable = cCubehelix.displayable(); cString = cCubehelix.toString(); +cString = cCubehelix.hex(); console.log('Channels = (h : %d, s: %d, l: %d)', cCubehelix.h, cCubehelix.s, cCubehelix.l); console.log('Opacity = %d', cCubehelix.opacity); diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index 825b82d9c4..05cd974c1f 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -1,12 +1,13 @@ -// Type definitions for D3JS d3-color module 1.0 +// Type definitions for D3JS d3-color module 1.2 // Project: https://github.com/d3/d3-color/ -// Definitions by: Tom Wanzek -// Alex Ford -// Boris Yankov -// denisname +// Definitions by: Tom Wanzek , +// Alex Ford , +// Boris Yankov , +// denisname , +// Hugues Stefanski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.3 +// Last module patch version validated against: 1.2.0 // --------------------------------------------------------------------------- // Shared Type Definitions and Interfaces @@ -22,106 +23,507 @@ export type ColorSpaceObject = RGBColor | HSLColor | LabColor | HCLColor | Cubeh * e.g. in d3-hsv). This interface */ export interface ColorCommonInstance { + /** + * Returns true if and only if the color is displayable on standard hardware. + * For example, this returns false for an RGB color if any channel value is less than zero or greater than 255, or if the opacity is not in the range [0, 1]. + */ displayable(): boolean; + /** + * Returns a string representing this color according to the CSS Object Model specification, + * such as rgb(247, 234, 186) or rgba(247, 234, 186, 0.2). + * If this color is not displayable, a suitable displayable color is returned instead. + * For example, RGB channel values greater than 255 are clamped to 255. + */ toString(): string; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. The behavior of this method is dependent on the implementing color space. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. The behavior of this method is dependent on the implementing color space. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; + /** + * Returns the RGB equivalent of this color. For RGB colors, that’s "this". + */ rgb(): RGBColor; + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. + * For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } +/** + * A Color object which serves as a base class for + * colorspace-specific sub-class implementations. + */ export interface Color { + /** + * Returns true if and only if the color is displayable on standard hardware. + * For example, this returns false for an RGB color if any channel value is less than zero or greater than 255, or if the opacity is not in the range [0, 1]. + */ displayable(): boolean; // Note: While this method is used in prototyping for colors of specific colorspaces, it should not be called directly, as 'this.rgb' would not be implemented on Color + /** + * Returns a string representing this color according to the CSS Object Model specification, + * such as rgb(247, 234, 186) or rgba(247, 234, 186, 0.2). + * If this color is not displayable, a suitable displayable color is returned instead. + * For example, RGB channel values greater than 255 are clamped to 255. + */ toString(): string; // Note: While this method is used in prototyping for colors of specific colorspaces, it should not be called directly, as 'this.rgb' would not be implemented on Color + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } +/** + * A Color factory object, which may also be used with instanceof to test if an object is a color instance. + */ export interface ColorFactory extends Function { + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an RGB or HSL color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): RGBColor | HSLColor | null; + /** + * Converts the provided color instance and returns an RGB or HSL color. + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): RGBColor | HSLColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: Color; } +/** + * An RGB color object. + */ export interface RGBColor extends Color { + /** + * Value of red channel + */ r: number; + /** + * Value of green channel + */ g: number; + /** + * Value of blue channel + */ b: number; + /** + * Opacity value + */ opacity: number; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; + /** + * Returns the RGB equivalent of this color. + */ rgb(): this; } +/** + * An RGB color factory object, which may also be used with instanceof to test if an object + * is an RGB color instance. + */ export interface RGBColorFactory extends Function { + /** + * Constructs a new RGB color based on the specified channel values and opacity. + * + * @param r Red channel value. + * @param g Green channel value. + * @param b Blue channel value. + * @param opacity Optional opacity value, defaults to 1. + */ (r: number, g: number, b: number, opacity?: number): RGBColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an RGB color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): RGBColor; + /** + * Converts the provided color instance and returns an RGB color. The color instance is converted to the RGB color space using color.rgb. + * Note that unlike color.rgb this method always returns a new instance, even if color is already an RGB color. + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): RGBColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: RGBColor; } +/** + * An HSL color object. + */ export interface HSLColor extends Color { + /** + * Hue channel value. + */ h: number; + /** + * Saturation channel value. + */ s: number; + /** + * Lightness channel value. + */ l: number; + /** + * Opacity value. + */ opacity: number; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; + /** + * Returns the RGB color equivalent of this color. + */ rgb(): RGBColor; } +/** + * An HSL color factory object, which may also be used with instanceof to test if an object + * is an HSL color instance. + */ export interface HSLColorFactory extends Function { + /** + * Constructs a new HSL color based on the specified channel values and opacity. + * + * @param h Hue channel value. + * @param s Saturation channel value. + * @param l Lightness channel value. + * @param opacity Optional opacity value, defaults to 1. + */ (h: number, s: number, l: number, opacity?: number): HSLColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an HSL color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): HSLColor; + /** + * Converts the provided color instance and returns an HSL color. + * The color instance is converted to the RGB color space using color.rgb and then converted to HSL. + * (Colors already in the HSL color space skip the conversion to RGB.) + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): HSLColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: HSLColor; } +/** + * A Lab (CIELAB) color object. + */ export interface LabColor extends Color { + /** + * Lightness typically in the range [0, 100]. + */ l: number; + /** + * Position between red/magenta and green typically in [-160, +160]. + */ a: number; + /** + * Position between yellow and blue typically in [-160, +160]. + */ b: number; + /** + * Opacity value + */ opacity: number; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; + /** + * Returns the RGB color equivalent of this color. + */ rgb(): RGBColor; } +/** + * A Lab (CIELAB) color factory object, which may also be used with instanceof to test if an object + * is a Lab color instance. + */ export interface LabColorFactory extends Function { + /** + * Constructs a new Lab color based on the specified channel values and opacity. + * + * @param l Lightness typically in the range [0, 100]. + * @param a Position between red/magenta and green typically in [-160, +160]. + * @param b Position between yellow and blue typically in [-160, +160]. + * @param opacity Optional opacity value, defaults to 1. + */ (l: number, a: number, b: number, opacity?: number): LabColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning a Lab color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): LabColor; + /** + * Converts the provided color instance and returns a Lab color. + * The color instance is converted to the RGB color space using color.rgb and then converted to Lab. + * (Colors already in the Lab color space skip the conversion to RGB, + * and colors in the HCL color space are converted directly to Lab.) + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): LabColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: LabColor; } +/** + * A gray color factory for Lab (CIELAB) colors. + */ +export type GrayColorFactory = + /** + * Constructs a new Lab color with the specified l value and a = b = 0. + * + * @param l Lightness typically in the range [0, 100]. + * @param opacity Optional opacity value, defaults to 1. + */ + (l: number, opacity?: number) => LabColor; + +/** + * An HCL (CIELCH) color object. + */ export interface HCLColor extends Color { + /** + * Hue channel value typically in [0, 360). + */ h: number; + /** + * Chroma channel value typically in [0, 230]. + */ c: number; + /** + * Luminance channel value typically in the range [0, 100]. + */ l: number; + /** + * Opacity value + */ opacity: number; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; + /** + * Returns the RGB color equivalent of this color. + */ rgb(): RGBColor; } +/** + * An HCL (CIELCH) color factory object, which may also be used with instanceof to test if an object + * is an HCL color instance. + */ export interface HCLColorFactory extends Function { + /** + * Constructs a new HCL color based on the specified channel values and opacity. + * + * @param h Hue channel value typically in [0, 360). + * @param c Chroma channel value typically in [0, 230]. + * @param l Luminance channel value typically in the range [0, 100]. + * @param opacity Optional opacity value, defaults to 1. + */ (h: number, l: number, c: number, opacity?: number): HCLColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an HCL color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): HCLColor; + /** + * Converts the provided color instance and returns an HCL color. + * The color instance is converted to the RGB color space using color.rgb and then converted to HCL. + * (Colors already in the HCL color space skip the conversion to RGB, + * and colors in the Lab color space are converted directly to HCL.) + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): HCLColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: HCLColor; } +/** + * An LCH (CIELCH) color factory function to create an HCL color object. + */ +export interface LCHColorFactory { + /** + * Constructs a new HCL color based on the specified channel values and opacity. + * + * @param l Luminance channel value typically in the range [0, 100]. + * @param c Chroma channel value typically in [0, 230]. + * @param h Hue channel value typically in [0, 360). + * @param opacity Optional opacity value, defaults to 1. + */ + (l: number, c: number, h: number, opacity?: number): HCLColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an HCL color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS color Module Level 3 specifier string. + */ + (cssColorSpecifier: string): HCLColor; + /** + * Converts the provided color instance and returns an HCL color. + * The color instance is converted to the RGB color space using color.rgb and then converted to HCL. + * (Colors already in the HCL color space skip the conversion to RGB, + * and colors in the Lab color space are converted directly to HCL.) + * + * @param color A permissible color space instance. + */ + (color: ColorSpaceObject | ColorCommonInstance): HCLColor; +} + +/** + * Dave Green’s Cubehelix color object. + */ export interface CubehelixColor extends Color { + /** + * Hue channel value. + */ h: number; + /** + * Saturation channel value. + */ s: number; + /** + * Lightness channel value. + */ l: number; + /** + * Opacity value. + */ opacity: number; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; + /** + * Returns the RGB color equivalent of this color. + */ rgb(): RGBColor; } +/** + * A color factory object for Dave Green's Cubehelix colors, which may also be used with instanceof to test if an object + * is a Cubehelix color instance. + */ export interface CubehelixColorFactory extends Function { + /** + * Constructs a new Cubehelix color based on the specified channel values and opacity. + * + * @param h Hue channel value. + * @param s Saturation channel value. + * @param l Lightness channel value. + * @param opacity Optional opacity value, defaults to 1. + */ (h: number, s: number, l: number, opacity?: number): CubehelixColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an Cubehelix color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): CubehelixColor; + /** + * Converts the provided color instance and returns a Cubehelix color. + * The color instance is specified, it is converted to the RGB color space using color.rgb and then converted to Cubehelix. + * (Colors already in the Cubehelix color space skip the conversion to RGB.) + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): CubehelixColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: CubehelixColor; } @@ -129,14 +531,47 @@ export interface CubehelixColorFactory extends Function { // Color object factories // -------------------------------------------------------------------------- +/** + * A Color factory object, which may also be used with instanceof to test if an object is a color instance. + */ export const color: ColorFactory; +/** + * An RGB color factory object, which may also be used with instanceof to test if an object + * is an RGB color instance. + */ export const rgb: RGBColorFactory; +/** + * An HSL color factory object, which may also be used with instanceof to test if an object + * is an HSL color instance. + */ export const hsl: HSLColorFactory; +/** + * A Lab (CIELAB) color factory object, which may also be used with instanceof to test if an object + * is a Lab color instance. + */ export const lab: LabColorFactory; +/** + * A gray color factory for Lab (CIELAB) colors. + */ +export const gray: GrayColorFactory; + +/** + * An HCL (CIELCH) color factory object, which may also be used with instanceof to test if an object + * is an HCL color instance. + */ export const hcl: HCLColorFactory; +/** + * An LCH (CIELCH) color factory function to create an HCL color object. + */ +export const lch: LCHColorFactory; + +/** + * A color factory object for Dave Green's Cubehelix colors, which may also be used with instanceof to test if an object + * is a Cubehelix color instance. + */ export const cubehelix: CubehelixColorFactory; diff --git a/types/d3-drag/d3-drag-tests.ts b/types/d3-drag/d3-drag-tests.ts index 3bc7e6f851..9a8012606b 100644 --- a/types/d3-drag/d3-drag-tests.ts +++ b/types/d3-drag/d3-drag-tests.ts @@ -9,7 +9,7 @@ import * as d3Drag from 'd3-drag'; import { event, select, Selection } from 'd3-selection'; -// NB: Consider alternative approachto getting live event-binding +// NB: Consider alternative approach to getting live event-binding // when using webpack as suggested by @ocombe in response to // event binding question https://github.com/d3/d3-zoom/issues/32#issuecomment-229889310 // d3.getEvent = () => require("d3-selection").event; @@ -234,7 +234,7 @@ const sourceEvent: any = e.sourceEvent; // As always, the below tests are for signature only, no functional purpose // remove event listeners for a given event type -e = e.on('start.tmp', null); // chainability test through reassigment +e = e.on('start.tmp', null); // chainability test through reassignment e = e.on('drag', dragged); // e = e.on('drag', wrongDragHandler1); // fails, wrong datum type in handler diff --git a/types/d3-drag/index.d.ts b/types/d3-drag/index.d.ts index b930081d15..9aa1ccf8d2 100644 --- a/types/d3-drag/index.d.ts +++ b/types/d3-drag/index.d.ts @@ -199,7 +199,7 @@ export interface DragBehavior; * @param csvString A string, which must be in the comma-separated values format. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function csvParse( @@ -102,7 +102,7 @@ export function csvParseRows(csvString: string): string[][]; * @param csvString A string, which must be in the comma-separated values format. * @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i) * starting at zero for the first row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function csvParseRows( @@ -177,7 +177,7 @@ export function tsvParse(tsvString: string): DSVParsedArray; * @param tsvString A string, which must be in the tab-separated values format. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function tsvParse( @@ -212,7 +212,7 @@ export function tsvParseRows(tsvString: string): string[][]; * @param tsvString A string, which must be in the tab-separated values format. * @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i) * starting at zero for the first row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function tsvParseRows( @@ -285,7 +285,7 @@ export interface DSV { * @param dsvString A string, which must be in the delimiter-separated values format with the appropriate delimiter. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ parse( @@ -314,7 +314,7 @@ export interface DSV { * @param dsvString A string, which must be in the delimiter-separated values format with the appropriate delimiter. * @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i) * starting at zero for the first row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ parseRows( diff --git a/types/d3-dsv/v0/index.d.ts b/types/d3-dsv/v0/index.d.ts index 18701f64ea..94ddbef579 100644 --- a/types/d3-dsv/v0/index.d.ts +++ b/types/d3-dsv/v0/index.d.ts @@ -5,7 +5,7 @@ /** A parser and formatter for DSV (CSV and TSV) files. Extracted from D3. */ declare function loader( - /** the symbol used to seperate cells in the row. */ + /** the symbol used to separate cells in the row. */ delimiter: string, /** example: "text/plain" */ encoding?: string): D3Dsv; diff --git a/types/d3-fetch/index.d.ts b/types/d3-fetch/index.d.ts index 6e31d70a76..25343d1bf5 100644 --- a/types/d3-fetch/index.d.ts +++ b/types/d3-fetch/index.d.ts @@ -52,7 +52,7 @@ export function csv( * @param url A valid URL string. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function csv( @@ -74,7 +74,7 @@ export function csv( * @param init An request initialization object. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function csv( @@ -112,7 +112,7 @@ export function dsv( * @param url A valid URL string. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function dsv( @@ -136,7 +136,7 @@ export function dsv( * @param init An request initialization object. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function dsv( @@ -224,7 +224,7 @@ export function tsv( * @param url A valid URL string. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function tsv( @@ -246,7 +246,7 @@ export function tsv( * @param init An request initialization object. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function tsv( diff --git a/types/d3-force/index.d.ts b/types/d3-force/index.d.ts index 1736a1ac78..35f4d06657 100644 --- a/types/d3-force/index.d.ts +++ b/types/d3-force/index.d.ts @@ -55,7 +55,7 @@ export interface SimulationNodeDatum { /** * The base data structure for the datum of a Simulation Link, as used by ForceLink. * The optional properties contained in this data structure are internally assigned - * by when initializating with ForceLink.links(...) + * by when initializing with ForceLink.links(...) * * * IMPORTANT: The source and target properties may be internally mutated in type during the @@ -634,7 +634,7 @@ export interface ForceLink number; /** - * Set the strenght accessor to use the specified constant number for all links, + * Set the strength accessor to use the specified constant number for all links, * re-evaluates the strength accessor for each link, and returns this force. * * The constant is internally wrapped into a strength accessor function. @@ -647,7 +647,7 @@ export interface ForceLink(); -// geoPathConicProjection = geoPathSVG.projection(); // fails without casting to GeoConicProjection, or alternatively custom typeguard +// geoPathConicProjection = geoPathSVG.projection(); // fails without casting to GeoConicProjection, or alternatively custom type guard // geoPathConicProjection = geoPathSVG.projection(); // fails as SampleProperties does not extend minimal interface // context(...) ------------------------------------------------------ @@ -719,11 +719,11 @@ const context: d3Geo.GeoContext = { const transformFunction: { stream(s: d3Geo.GeoStream): {} } = d3Geo.geoTransform({}); -interface CustomTranformProto extends d3Geo.GeoTransformPrototype { +interface CustomTransformProto extends d3Geo.GeoTransformPrototype { a: number; } -let customTransformProto: CustomTranformProto; +let customTransformProto: CustomTransformProto; customTransformProto = { point(x, y) { @@ -732,11 +732,11 @@ customTransformProto = { a: 10 }; -const t: { stream(s: d3Geo.GeoStream): CustomTranformProto & d3Geo.GeoStream } = d3Geo.geoTransform(customTransformProto); +const t: { stream(s: d3Geo.GeoStream): CustomTransformProto & d3Geo.GeoStream } = d3Geo.geoTransform(customTransformProto); // geoIdentity() ======================================================== -let identityTransform: d3Geo.GeoIdentityTranform; +let identityTransform: d3Geo.GeoIdentityTransform; identityTransform = d3Geo.geoIdentity(); diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index a41f67618a..8f22503d71 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for D3JS d3-geo module 1.10 // Project: https://github.com/d3/d3-geo/ -// Definitions by: Hugues Stefanski , Tom Wanzek , Alex Ford , Boris Yankov +// Definitions by: Hugues Stefanski , Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -976,7 +976,7 @@ export interface GeoConicProjection extends GeoProjection { export interface GeoContext { /** * Adds an arc to the path with center point (x, y) and radius r starting at startAngle and ending at endAngle. - * The arc is drawn in clockwise directio by default. + * The arc is drawn in clockwise direction by default. * * @param x x-coordinate of arc center point. * @param y y-coordinate of arc center point. @@ -1046,7 +1046,7 @@ export interface GeoPath(methods: T): { str // geoIdentity() ================================================================= +/** + * @deprecated Misspelled name. Use GeoIdentityTransform. + */ +export type GeoIdentityTranform = GeoIdentityTransform; + /** * Geo Identity Transform */ -export interface GeoIdentityTranform extends GeoStreamWrapper { +export interface GeoIdentityTransform extends GeoStreamWrapper { /** * Returns the current viewport clip extent which defaults to null. */ @@ -1667,7 +1672,7 @@ export interface GeoIdentityTranform extends GeoStreamWrapper { /** * Returns the identity transform which can be used to scale, translate and clip planar geometry. */ -export function geoIdentity(): GeoIdentityTranform; +export function geoIdentity(): GeoIdentityTransform; // ---------------------------------------------------------------------- // Clipping Functions diff --git a/types/d3-hierarchy/d3-hierarchy-tests.ts b/types/d3-hierarchy/d3-hierarchy-tests.ts index 4e35f02ff9..65b1f5c392 100644 --- a/types/d3-hierarchy/d3-hierarchy-tests.ts +++ b/types/d3-hierarchy/d3-hierarchy-tests.ts @@ -568,7 +568,7 @@ hierarchyRectangularNode = rectangularNodeDescendants[rectangularNodeDescendants const treemapPath: Array> = treemapRootNode.path(hierarchyRectangularNode); -// links() and HierarchyRectangulerLink<...> ------------------------------------------ +// links() and HierarchyRectangularLink<...> ------------------------------------------ let rectangularLinks: Array>; @@ -747,7 +747,7 @@ hierarchyCircularNode = circularNodeDescendants[circularNodeDescendants.length - const packPath: Array> = packRootNode.path(hierarchyCircularNode); -// links() and HierarchyRectangulerLink<...> ------------------------------------------ +// links() and HierarchyRectangularLink<...> ------------------------------------------ let circularLinks: Array>; diff --git a/types/d3-hierarchy/index.d.ts b/types/d3-hierarchy/index.d.ts index a72dfa0aba..440a779217 100644 --- a/types/d3-hierarchy/index.d.ts +++ b/types/d3-hierarchy/index.d.ts @@ -50,7 +50,7 @@ export function hierarchy(data: Datum, children?: (d: Datum) => (Datum[] // Stratify // ----------------------------------------------------------------------- -// TODO: Review the comment in the API documentation related to 'reserved properties': id, parentId, children. If this is refering to the element on node, it should be 'parent'? +// TODO: Review the comment in the API documentation related to 'reserved properties': id, parentId, children. If this is referring to the element on node, it should be 'parent'? export interface StratifyOperator { (data: Datum[]): HierarchyNode; diff --git a/types/d3-hsv/d3-hsv-tests.ts b/types/d3-hsv/d3-hsv-tests.ts index 7aa6fb7817..780f584c7c 100644 --- a/types/d3-hsv/d3-hsv-tests.ts +++ b/types/d3-hsv/d3-hsv-tests.ts @@ -51,7 +51,7 @@ cString = cHSV.toString(); console.log('Channels = (h : %d, s: %d, v: %d)', cHSV.h, cHSV.s, cHSV.v); console.log('Opacity = %d', cHSV.opacity); -// Interpolater +// Interpolator iString = interpolateHsv('seagreen', 'steelblue'); iString = interpolateHsv(rgb('seagreen'), hcl('steelblue')); @@ -61,7 +61,7 @@ iString = interpolateHsvLong('seagreen', 'steelblue'); iString = interpolateHsvLong(rgb('seagreen'), hcl('steelblue')); iString = interpolateHsvLong(rgb('seagreen'), hsv('steelblue')); -// Prototype, instanceof and typeguard +// Prototype, instanceof and type guard declare let color: RGBColor | HSVColor | null; diff --git a/types/d3-hsv/index.d.ts b/types/d3-hsv/index.d.ts index 1728af0874..7452dbcc2b 100644 --- a/types/d3-hsv/index.d.ts +++ b/types/d3-hsv/index.d.ts @@ -68,6 +68,12 @@ export interface HSVColor extends Color { * Returns the RGB equivalent of this color. */ rgb(): RGBColor; + + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } export const hsv: HSVColorFactory; diff --git a/types/d3-interpolate/d3-interpolate-tests.ts b/types/d3-interpolate/d3-interpolate-tests.ts index 6baaf06092..e88ad79cfe 100644 --- a/types/d3-interpolate/d3-interpolate-tests.ts +++ b/types/d3-interpolate/d3-interpolate-tests.ts @@ -123,7 +123,7 @@ arrNum = iArrayNum(0.5); iArrayStr = d3Interpolate.interpolateArray(['1', '2'], ['4', '8']); // explicit typing arrStr = iArrayStr(0.5); -iArrayStr = d3Interpolate.interpolateArray([1, 2], ['4', '8']); // infered typing +iArrayStr = d3Interpolate.interpolateArray([1, 2], ['4', '8']); // inferred typing arrStr = iArrayStr(0.5); // two element array with first element date and second element string @@ -156,7 +156,7 @@ console.log('Recommended transition duration = %d', iZoom.duration); // test quantize(interpolator, n) signature ------------------------------------------------ -arrNum = d3Interpolate.quantize(d3Interpolate.interpolateRound(-1, 2), 4); // infered template parameter type +arrNum = d3Interpolate.quantize(d3Interpolate.interpolateRound(-1, 2), 4); // inferred template parameter type arrStr = d3Interpolate.quantize(d3Interpolate.interpolateString('-1', '2'), 4); // explicit template parameter typing // arrStr = d3Interpolate.quantize(d3Interpolate.interpolateRound(-1, 2), 4); // test fails, due to explicit typing v argument type mismatch diff --git a/types/d3-path/index.d.ts b/types/d3-path/index.d.ts index 7c0f662018..4c1f124962 100644 --- a/types/d3-path/index.d.ts +++ b/types/d3-path/index.d.ts @@ -95,7 +95,7 @@ export interface Path { rect(x: number, y: number, w: number, h: number): void; /** - * Returns the string representation of this path according to SVG’s path data specficiation. + * Returns the string representation of this path according to SVG’s path data specification. */ toString(): string; } diff --git a/types/d3-queue/d3-queue-tests.ts b/types/d3-queue/d3-queue-tests.ts index f387ea990a..08c195d9bd 100644 --- a/types/d3-queue/d3-queue-tests.ts +++ b/types/d3-queue/d3-queue-tests.ts @@ -38,7 +38,7 @@ qNoResult = qNoResult.defer(delayedHello, 'Alice', 250); qNoResult.defer(delayedHello, 'Bob', 500); -// Task with Reuslts ------------------------------------------------- +// Task with Results ------------------------------------------------- function getFileStats(path: string, callback: (error: any | null, stats?: any) => void) { // magically get file stats and behave like fs.stat when invoking the callback @@ -57,7 +57,7 @@ qNoResult = qNoResult.await((error) => { console.log('Goodbye!'); }); -// Task with Reuslts ------------------------------------------------- +// Task with Results ------------------------------------------------- // await qWithResults diff --git a/types/d3-queue/index.d.ts b/types/d3-queue/index.d.ts index d672849622..5ad38d8d74 100644 --- a/types/d3-queue/index.d.ts +++ b/types/d3-queue/index.d.ts @@ -29,7 +29,7 @@ export interface Queue { /** * Sets the callback to be invoked when all deferred tasks have finished (individual result arguments). * - * @param callback Callback function to be executed, when error occured or all deferred tasks + * @param callback Callback function to be executed, when error occurred or all deferred tasks * have completed. The first argument to the callback is the first error that occurred, or null if no error occurred. * If an error occurred, there are no additional arguments to the callback. Otherwise, * the callback is passed each result as an additional argument. @@ -38,7 +38,7 @@ export interface Queue { /** * Sets the callback to be invoked when all deferred tasks have finished (results array). * - * @param callback Callback function to be executed, when error occured or all deferred tasks + * @param callback Callback function to be executed, when error occurred or all deferred tasks * have completed. The first argument to the callback is the first error that occurred, * or null if no error occurred. If an error occurred, there are no additional arguments to the callback. * Otherwise, the callback is also passed an array of results as the second argument. diff --git a/types/d3-random/index.d.ts b/types/d3-random/index.d.ts index 41b6034215..c6335a694b 100644 --- a/types/d3-random/index.d.ts +++ b/types/d3-random/index.d.ts @@ -57,7 +57,7 @@ export const randomNormal: RandomNormal; */ export interface RandomLogNormal extends RandomNumberGenerationSource { /** - * Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variable’s natural logrithm is mu, + * Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variable’s natural logarithm is mu, * with the given standard deviation sigma. If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1. * * @param mu Expected value, defaults to 0. diff --git a/types/d3-sankey/index.d.ts b/types/d3-sankey/index.d.ts index 237eb60f15..c619b5c8c3 100644 --- a/types/d3-sankey/index.d.ts +++ b/types/d3-sankey/index.d.ts @@ -333,7 +333,7 @@ export interface SankeyLayout { @@ -180,7 +180,7 @@ export interface ScaleContinuousNumeric { * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleLinear extends ScaleContinuousNumeric { @@ -197,9 +197,9 @@ export interface ScaleLinear extends ScaleContinuousNumeric): this; /** @@ -210,11 +210,11 @@ export interface ScaleLinear extends ScaleContinuousNumeric(interpolate: InterpolatorFactory): ScaleLinear; } @@ -228,9 +228,9 @@ export function scaleLinear(): ScaleLinear; /** * Constructs a new continuous linear scale with the unit domain [0, 1], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * The range must be set in accordance with the range element type. * * The interpolator factory may be set using the interpolate(...) method of the scale. @@ -242,7 +242,7 @@ export function scaleLinear(): ScaleLinear; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -271,7 +271,7 @@ export function scaleLinear(): ScaleLinear; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScalePower extends ScaleContinuousNumeric { @@ -288,9 +288,9 @@ export interface ScalePower extends ScaleContinuousNumeric): this; /** @@ -301,11 +301,11 @@ export interface ScalePower extends ScaleContinuousNumeric(interpolate: InterpolatorFactory): ScalePower; @@ -332,9 +332,9 @@ export function scalePow(): ScalePower; * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 1, the default interpolator and clamping disabled. * (Note that this is effectively a linear scale until you set a different exponent.) * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -348,7 +348,7 @@ export function scalePow(): ScalePower; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -368,9 +368,9 @@ export function scaleSqrt(): ScalePower; * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 0.5, the default interpolator and clamping disabled. * This is a convenience method equivalent to d3.scalePow().exponent(0.5). * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -384,7 +384,7 @@ export function scaleSqrt(): ScalePower; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -417,7 +417,7 @@ export function scaleSqrt(): ScalePower; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleLogarithmic extends ScaleContinuousNumeric { @@ -456,9 +456,9 @@ export interface ScaleLogarithmic extends ScaleContinuousNumeric< * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): this; /** @@ -469,11 +469,11 @@ export interface ScaleLogarithmic extends ScaleContinuousNumeric< * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): ScaleLogarithmic; @@ -537,9 +537,9 @@ export function scaleLog(): ScaleLogarithmic; /** * Constructs a new continuous logarithmic scale with the domain [1, 10], the base 10, the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -552,7 +552,7 @@ export function scaleLog(): ScaleLogarithmic; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -696,7 +696,7 @@ export function scaleIdentity(): ScaleIdentity; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleTime { @@ -798,9 +798,9 @@ export interface ScaleTime { * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): this; /** @@ -811,11 +811,11 @@ export interface ScaleTime { * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): ScaleTime; @@ -942,9 +942,9 @@ export function scaleTime(): ScaleTime; /** * Constructs a new time scale using local time with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -957,7 +957,7 @@ export function scaleTime(): ScaleTime; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -975,9 +975,9 @@ export function scaleUtc(): ScaleTime; /** * Constructs a new time scale using Coordinated Universal Time (UTC) with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -990,7 +990,7 @@ export function scaleUtc(): ScaleTime; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -1202,7 +1202,7 @@ export function scaleQuantize(): ScaleQuantize; * The number of values in (the cardinality of) the output range determines the number of quantiles that will be computed from the domain. * To compute the quantiles, the domain is sorted, and treated as a population of discrete values; see d3-array’s quantile. * - * The generic correponds to the data type of range elements. + * The generic corresponds to the data type of range elements. */ export interface ScaleQuantile { /** @@ -1272,7 +1272,7 @@ export function scaleQuantile(): ScaleQuantile; * Constructs a new quantile scale with an empty domain and an empty range. * The quantile scale is invalid until both a domain and range are specified. * - * The generic correponds to the data type of range elements. + * The generic corresponds to the data type of range elements. */ export function scaleQuantile(): ScaleQuantile; @@ -1613,7 +1613,7 @@ export function scaleBand(): ScaleBand; /** * Constructs a new band scale with the empty domain, the unit range [0, 1], no padding, no rounding and center alignment. * - * The generic correponds to the data type of domain elements. + * The generic corresponds to the data type of domain elements. */ export function scaleBand(): ScaleBand; diff --git a/types/d3-scale/v1/index.d.ts b/types/d3-scale/v1/index.d.ts index a9843d9547..46fe6c2a12 100644 --- a/types/d3-scale/v1/index.d.ts +++ b/types/d3-scale/v1/index.d.ts @@ -14,7 +14,7 @@ import { CountableTimeInterval, TimeInterval } from 'd3-time'; /** * An Interpolator factory returns an interpolator function. * - * The first generic correponds to the data type of the interpolation boundaries. + * The first generic corresponds to the data type of the interpolation boundaries. * The second generic corresponds to the data type of the return type of the interpolator. */ export interface InterpolatorFactory { @@ -180,7 +180,7 @@ export interface ScaleContinuousNumeric { * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleLinear extends ScaleContinuousNumeric { @@ -197,9 +197,9 @@ export interface ScaleLinear extends ScaleContinuousNumeric): this; /** @@ -210,11 +210,11 @@ export interface ScaleLinear extends ScaleContinuousNumeric(interpolate: InterpolatorFactory): ScaleLinear; } @@ -228,9 +228,9 @@ export function scaleLinear(): ScaleLinear; /** * Constructs a new continuous linear scale with the unit domain [0, 1], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * The range must be set in accordance with the range element type. * * The interpolator factory may be set using the interpolate(...) method of the scale. @@ -242,7 +242,7 @@ export function scaleLinear(): ScaleLinear; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -271,7 +271,7 @@ export function scaleLinear(): ScaleLinear; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScalePower extends ScaleContinuousNumeric { @@ -288,9 +288,9 @@ export interface ScalePower extends ScaleContinuousNumeric): this; /** @@ -301,11 +301,11 @@ export interface ScalePower extends ScaleContinuousNumeric(interpolate: InterpolatorFactory): ScalePower; @@ -332,9 +332,9 @@ export function scalePow(): ScalePower; * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 1, the default interpolator and clamping disabled. * (Note that this is effectively a linear scale until you set a different exponent.) * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -348,7 +348,7 @@ export function scalePow(): ScalePower; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -368,9 +368,9 @@ export function scaleSqrt(): ScalePower; * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 0.5, the default interpolator and clamping disabled. * This is a convenience method equivalent to d3.scalePow().exponent(0.5). * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -384,7 +384,7 @@ export function scaleSqrt(): ScalePower; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -417,7 +417,7 @@ export function scaleSqrt(): ScalePower; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleLogarithmic extends ScaleContinuousNumeric { @@ -456,9 +456,9 @@ export interface ScaleLogarithmic extends ScaleContinuousNumeric< * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): this; /** @@ -469,11 +469,11 @@ export interface ScaleLogarithmic extends ScaleContinuousNumeric< * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): ScaleLogarithmic; @@ -537,9 +537,9 @@ export function scaleLog(): ScaleLogarithmic; /** * Constructs a new continuous logarithmic scale with the domain [1, 10], the base 10, the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -552,7 +552,7 @@ export function scaleLog(): ScaleLogarithmic; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -696,7 +696,7 @@ export function scaleIdentity(): ScaleIdentity; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleTime { @@ -798,9 +798,9 @@ export interface ScaleTime { * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): this; /** @@ -811,11 +811,11 @@ export interface ScaleTime { * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): ScaleTime; @@ -942,9 +942,9 @@ export function scaleTime(): ScaleTime; /** * Constructs a new time scale using local time with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -957,7 +957,7 @@ export function scaleTime(): ScaleTime; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -975,9 +975,9 @@ export function scaleUtc(): ScaleTime; /** * Constructs a new time scale using Coordinated Universal Time (UTC) with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -990,7 +990,7 @@ export function scaleUtc(): ScaleTime; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -1267,7 +1267,7 @@ export function scaleQuantize(): ScaleQuantize; * The number of values in (the cardinality of) the output range determines the number of quantiles that will be computed from the domain. * To compute the quantiles, the domain is sorted, and treated as a population of discrete values; see d3-array’s quantile. * - * The generic correponds to the data type of range elements. + * The generic corresponds to the data type of range elements. */ export interface ScaleQuantile { /** @@ -1337,7 +1337,7 @@ export function scaleQuantile(): ScaleQuantile; * Constructs a new quantile scale with an empty domain and an empty range. * The quantile scale is invalid until both a domain and range are specified. * - * The generic correponds to the data type of range elements. + * The generic corresponds to the data type of range elements. */ export function scaleQuantile(): ScaleQuantile; @@ -1678,7 +1678,7 @@ export function scaleBand(): ScaleBand; /** * Constructs a new band scale with the empty domain, the unit range [0, 1], no padding, no rounding and center alignment. * - * The generic correponds to the data type of domain elements. + * The generic corresponds to the data type of domain elements. */ export function scaleBand(): ScaleBand; diff --git a/types/d3-selection/d3-selection-tests.ts b/types/d3-selection/d3-selection-tests.ts index e4f50c89e4..54ddb5ea11 100644 --- a/types/d3-selection/d3-selection-tests.ts +++ b/types/d3-selection/d3-selection-tests.ts @@ -162,8 +162,8 @@ const svgEl: d3Selection.Selection = let firstG: d3Selection.Selection = svgEl.select('g'); // let firstG_2: d3Selection.Selection = svgEl.select('g'); // fails, parent element of selection does not change with .select(...) -// firstG = svgEl.select('g'); // fails, element type defaults to 'BaseType', but SVGGElement expexted on left-hand side -// firstG = svgEl.select('svg'); // fails, element type of SVGSVGElement provided, but SVGGElement expexted on left-hand side (silly test to begin with) +// firstG = svgEl.select('g'); // fails, element type defaults to 'BaseType', but SVGGElement expected on left-hand side +// firstG = svgEl.select('svg'); // fails, element type of SVGSVGElement provided, but SVGGElement expected on left-hand side (silly test to begin with) // test, when it is not certain, whether an element of the type to be selected exists let maybeG: d3Selection.Selection; @@ -173,7 +173,7 @@ maybeG = svgEl.select('g'); // Using select(...) sub-selection with a selector function argument. function svgGroupSelector(this: SVGSVGElement, d: SVGDatum, i: number, groups: SVGSVGElement[] | ArrayLike): SVGGElement { - return this.querySelector('g')!; // this-type compatible with group element-type to which the selector function will be appplied + return this.querySelector('g')!; // this-type compatible with group element-type to which the selector function will be applied } firstG = svgEl.select(svgGroupSelector); @@ -224,7 +224,7 @@ let gElementsOldData: d3Selection.Selection): NodeListOf { - return this.querySelectorAll('g'); // this-type compatible with group element-type to which the selector function will be appplied + return this.querySelectorAll('g'); // this-type compatible with group element-type to which the selector function will be applied } gElementsOldData = svgEl.selectAll(svgGroupSelectorAll); @@ -302,11 +302,11 @@ gElementsOldData = svgEl.selectAll(d3Selection.selecto // Scenario 1: Filter retaining the element type of the select group (i.e. no type narrowing during filtering) -let filterdGElements: d3Selection.Selection; +let filteredGElements: d3Selection.Selection; -filterdGElements = gElementsOldData.filter('.top-level'); +filteredGElements = gElementsOldData.filter('.top-level'); -filterdGElements = gElementsOldData.filter(function(d, i, g) { +filteredGElements = gElementsOldData.filter(function(d, i, g) { const that: SVGGElement = this; // const that2: HTMLElement = this; // fails, type mismatch const datum: CircleDatum = d; @@ -322,23 +322,23 @@ filterdGElements = gElementsOldData.filter(function(d, i, g) { // Scenario 2: Filtering narrows the type of selected elements in a known way // assume the class ".any-svg-type" can only be assigned to SVGElements in the DOM -let filterdGElements2: d3Selection.Selection; +let filteredGElements2: d3Selection.Selection; -filterdGElements2 = d3Selection.selectAll('.any-svg-type').filter('g'); -// filterdGElements2 = d3Selection.selectAll('.any-type').filter('g'); // fails without using narrowing generic on filter method +filteredGElements2 = d3Selection.selectAll('.any-svg-type').filter('g'); +// filteredGElements2 = d3Selection.selectAll('.any-type').filter('g'); // fails without using narrowing generic on filter method -filterdGElements2 = d3Selection.selectAll('.any-svg-type').filter(function() { +filteredGElements2 = d3Selection.selectAll('.any-svg-type').filter(function() { const that: SVGElement = this; return that.tagName === 'g' || that.tagName === 'G'; }); -// filterdGElements2 = d3Selection.selectAll('.any-svg-type').filter(function(){ +// filteredGElements2 = d3Selection.selectAll('.any-svg-type').filter(function(){ // const that: SVGElement = this; // return that.tagName === 'g'|| that.tagName === 'G'; // }); // fails without using narrowing generic on filter method // matcher() ----------------------------------------------------------------------------- -filterdGElements = gElementsOldData.filter(d3Selection.matcher('.top-level')); +filteredGElements = gElementsOldData.filter(d3Selection.matcher('.top-level')); // --------------------------------------------------------------------------------------- // Tests of Modification @@ -644,7 +644,7 @@ let circles2: d3Selection.Selection = (this: T, datum: Datum, /** * TransitionLike is a helper interface to represent a quasi-Transition, without specifying the full Transition interface in this file. - * For example, whereever d3-zoom allows a Transition to be passed in as an argument, it internally immediately invokes its `selection()` + * For example, wherever d3-zoom allows a Transition to be passed in as an argument, it internally immediately invokes its `selection()` * method to retrieve the underlying Selection object before proceeding. * d3-brush uses a subset of Transition methods internally. * The use of this interface instead of the full imported Transition interface is [referred] to achieve @@ -480,7 +480,7 @@ export interface Selection(type: string): Selection; /** - * Appends a new element of the type provided by the element creator functionas the last child of each selected element, + * Appends a new element of the type provided by the element creator function as the last child of each selected element, * or before the next following sibling in the update selection if this is an enter selection. * The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data; * however, note that selection.order may still be required if updating elements change order diff --git a/types/d3-shape/index.d.ts b/types/d3-shape/index.d.ts index 5408508683..47e5c10feb 100644 --- a/types/d3-shape/index.d.ts +++ b/types/d3-shape/index.d.ts @@ -32,7 +32,7 @@ export interface DefaultArcObject { */ endAngle: number; /** - * Optional. Pad angle of arcin radians. + * Optional. Pad angle of arc in radians. */ padAngle?: number; } @@ -741,7 +741,7 @@ export interface Line { /** * Returns the current curve factory, which defaults to curveLinear. * - * The generic allows to cast the curve factory to a specifc type, if known. + * The generic allows to cast the curve factory to a specific type, if known. */ curve(): C; /** @@ -916,7 +916,7 @@ export interface LineRadial { /** * Returns the current curve factory, which defaults to curveLinear. * - * The generic allows to cast the curve factory to a specifc type, if known. + * The generic allows to cast the curve factory to a specific type, if known. */ curve(): C; /** @@ -1213,7 +1213,7 @@ export interface Area { /** * Returns the current curve factory, which defaults to curveLinear. * - * The generic allows to cast the curve factory to a specifc type, if known. + * The generic allows to cast the curve factory to a specific type, if known. */ curve(): C; /** @@ -1518,7 +1518,7 @@ export interface AreaRadial { /** * Returns the current curve factory, which defaults to curveLinear. * - * The generic allows to cast the curve factory to a specifc type, if known. + * The generic allows to cast the curve factory to a specific type, if known. */ curve(): C; /** @@ -2280,7 +2280,7 @@ export interface SymbolType { * use a transform (see: SVG, Canvas) to move the arc to a different position. * * The first generic corresponds to the "this" context within which the symbol generator is invoked. - * The second generic corrsponds to the data type of the datum underlying the symbol. + * The second generic corresponds to the data type of the datum underlying the symbol. */ export interface Symbol { /** @@ -2382,7 +2382,7 @@ export function symbol(): Symbol; // tslint:disable-line ban-types /** * Constructs a new symbol generator with the default settings. * - * The generic corrsponds to the data type of the datum underlying the symbol. + * The generic corresponds to the data type of the datum underlying the symbol. */ export function symbol(): Symbol; // tslint:disable-line ban-types @@ -2390,7 +2390,7 @@ export function symbol(): Symbol; // tslint:disable-line ban- * Constructs a new symbol generator with the default settings. * * The first generic corresponds to the "this" context within which the symbol generator is invoked. - * The second generic corrsponds to the data type of the datum underlying the symbol. + * The second generic corresponds to the data type of the datum underlying the symbol. */ export function symbol(): Symbol; // tslint:disable-line ban-types @@ -2460,11 +2460,11 @@ export function pointRadial(angle: number, radius: number): [number, number]; */ export interface SeriesPoint extends Array { /** - * Correponds to y0, the lower value (baseline). + * Corresponds to y0, the lower value (baseline). */ 0: number; /** - * Correponds to y1, the upper value (topline). + * Corresponds to y1, the upper value (topline). */ 1: number; /** @@ -2565,7 +2565,7 @@ export interface Stack { value(value: (d: Datum, key: Key, j: number, data: Datum[]) => number): this; /** - * Returns the current order acccesor, which defaults to stackOrderNone; this uses the order given by the key accessor. + * Returns the current order accessor, which defaults to stackOrderNone; this uses the order given by the key accessor. */ order(): (series: Series) => number[]; /** @@ -2596,7 +2596,7 @@ export interface Stack { order(order: (series: Series) => number[]): this; /** - * Returns the current offset acccesor, which defaults to stackOffsetNone; this uses a zero baseline. + * Returns the current offset accessor, which defaults to stackOffsetNone; this uses a zero baseline. */ offset(): (series: Series, order: number[]) => void; /** diff --git a/types/d3-time/index.d.ts b/types/d3-time/index.d.ts index 3d88edbf27..270d64d33c 100644 --- a/types/d3-time/index.d.ts +++ b/types/d3-time/index.d.ts @@ -22,7 +22,7 @@ export interface TimeInterval { * This function is idempotent: if the specified date is already floored to the current interval, * a new date with an identical time is returned. * Furthermore, the returned date is the minimum expressible value of the associated interval, - * such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date. + * such that interval.floor(interval.floor(date) - 1) returns the preceding interval boundary date. * * Note that the == and === operators do not compare by value with Date objects, * and thus you cannot use them to tell whether the specified date has already been floored. @@ -42,7 +42,7 @@ export interface TimeInterval { * This method is idempotent: if the specified date is already floored to the current interval, * a new date with an identical time is returned. * Furthermore, the returned date is the minimum expressible value of the associated interval, - * such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date. + * such that interval.floor(interval.floor(date) - 1) returns the preceding interval boundary date. * * Note that the == and === operators do not compare by value with Date objects, * and thus you cannot use them to tell whether the specified date has already been floored. @@ -165,7 +165,7 @@ export interface CountableTimeInterval extends TimeInterval { /** * Constructs a new custom interval given the specified floor and offset functions. * - * The returned custom interval is not countable, i.e. does not exposee the methods "count(..)" and "every(...)". + * The returned custom interval is not countable, i.e. does not expose the methods "count(..)" and "every(...)". * * @param floor A floor function which takes a single date as an argument and rounds it down to the nearest interval boundary. * @param offset An offset function which takes a date and an integer step as arguments and advances @@ -444,15 +444,15 @@ export const timeYear: CountableTimeInterval; */ export function timeYears(start: Date, stop: Date, step?: number): Date[]; -// utc Universal Coordinated Time ---------------------------------------------------------- +// utc Coordinated Universal Time ---------------------------------------------------------- /** - * Milliseconds Interval in Univarsal Coordinated Time (UTC); the shortest available time unit. + * Milliseconds Interval in Coordinated Universal Time (UTC); the shortest available time unit. */ export const utcMillisecond: CountableTimeInterval; /** - * This is a convenience alias for utcMilliesecond.range(...). + * This is a convenience alias for utcMillisecond.range(...). * * @param start A start date object for the range. * @param stop A stop date object for the range. @@ -461,7 +461,7 @@ export const utcMillisecond: CountableTimeInterval; export function utcMilliseconds(start: Date, stop: Date, step?: number): Date[]; /** - * Seconds Interval in Univarsal Coordinated Time (UTC); seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds. + * Seconds Interval in Coordinated Universal Time (UTC); seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds. */ export const utcSecond: CountableTimeInterval; @@ -475,7 +475,7 @@ export const utcSecond: CountableTimeInterval; export function utcSeconds(start: Date, stop: Date, step?: number): Date[]; /** - * Minutes Interval in Univarsal Coordinated Time (UTC); minutes (e.g., 01:02:00 AM); 60 seconds. + * Minutes Interval in Coordinated Universal Time (UTC); minutes (e.g., 01:02:00 AM); 60 seconds. * Note that ECMAScript ignores leap seconds. */ export const utcMinute: CountableTimeInterval; @@ -490,7 +490,7 @@ export const utcMinute: CountableTimeInterval; export function utcMinutes(start: Date, stop: Date, step?: number): Date[]; /** - * Hours Interval in Univarsal Coordinated Time (UTC); Hours (e.g., 01:00 AM); 60 minutes. + * Hours Interval in Coordinated Universal Time (UTC); Hours (e.g., 01:00 AM); 60 minutes. */ export const utcHour: CountableTimeInterval; @@ -504,7 +504,7 @@ export const utcHour: CountableTimeInterval; export function utcHours(start: Date, stop: Date, step?: number): Date[]; /** - * Days Interval in Univarsal Coordinated Time (UTC); days (e.g., February 7, 2012 at 12:00 AM); 24 hours. + * Days Interval in Coordinated Universal Time (UTC); days (e.g., February 7, 2012 at 12:00 AM); 24 hours. */ export const utcDay: CountableTimeInterval; @@ -533,7 +533,7 @@ export const utcWeek: CountableTimeInterval; export function utcWeeks(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Sunday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 5, 2012 at 12:00 AM). + * Week Interval for Sunday-based weeks in Coordinated Universal Time (UTC) (e.g., February 5, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcSunday: CountableTimeInterval; @@ -548,7 +548,7 @@ export const utcSunday: CountableTimeInterval; export function utcSundays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Monday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 6, 2012 at 12:00 AM). + * Week Interval for Monday-based weeks in Coordinated Universal Time (UTC) (e.g., February 6, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcMonday: CountableTimeInterval; @@ -563,7 +563,7 @@ export const utcMonday: CountableTimeInterval; export function utcMondays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Tuesday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 7, 2012 at 12:00 AM). + * Week Interval for Tuesday-based weeks in Coordinated Universal Time (UTC) (e.g., February 7, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcTuesday: CountableTimeInterval; @@ -578,7 +578,7 @@ export const utcTuesday: CountableTimeInterval; export function utcTuesdays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Wednesday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 8, 2012 at 12:00 AM). + * Week Interval for Wednesday-based weeks in Coordinated Universal Time (UTC) (e.g., February 8, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcWednesday: CountableTimeInterval; @@ -593,7 +593,7 @@ export const utcWednesday: CountableTimeInterval; export function utcWednesdays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Thursday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 9, 2012 at 12:00 AM). + * Week Interval for Thursday-based weeks in Coordinated Universal Time (UTC) (e.g., February 9, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcThursday: CountableTimeInterval; @@ -608,7 +608,7 @@ export const utcThursday: CountableTimeInterval; export function utcThursdays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Friday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 10, 2012 at 12:00 AM). + * Week Interval for Friday-based weeks in Coordinated Universal Time (UTC) (e.g., February 10, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcFriday: CountableTimeInterval; @@ -623,7 +623,7 @@ export const utcFriday: CountableTimeInterval; export function utcFridays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Saturday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 11, 2012 at 12:00 AM). + * Week Interval for Saturday-based weeks in Coordinated Universal Time (UTC) (e.g., February 11, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcSaturday: CountableTimeInterval; @@ -638,7 +638,7 @@ export const utcSaturday: CountableTimeInterval; export function utcSaturdays(start: Date, stop: Date, step?: number): Date[]; /** - * Month Interval in Univarsal Coordinated Time (UTC); months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days. + * Month Interval in Coordinated Universal Time (UTC); months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days. */ export const utcMonth: CountableTimeInterval; @@ -652,7 +652,7 @@ export const utcMonth: CountableTimeInterval; export function utcMonths(start: Date, stop: Date, step?: number): Date[]; /** - * Year Interval in Univarsal Coordinated Time (UTC); years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days. + * Year Interval in Coordinated Universal Time (UTC); years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days. */ export const utcYear: CountableTimeInterval; diff --git a/types/d3-transition/d3-transition-tests.ts b/types/d3-transition/d3-transition-tests.ts index ba0ae99750..9ee4a8e43d 100644 --- a/types/d3-transition/d3-transition-tests.ts +++ b/types/d3-transition/d3-transition-tests.ts @@ -142,13 +142,13 @@ let newEnterTransition: d3Transition.Transition; -let differentDatumTypeTransition: d3Transition.Transition; +let differentDatumTypeTransition: d3Transition.Transition; // Comparable use cases arise e.g. when using an existing transition to generate a new transition // on a different selection to synchronize them (see e.g. Mike Bostock's Brush & Zoom II Example https://bl.ocks.org/mbostock/f48fcdb929a620ed97877e4678ab15e6) differentElementTypeTransition = select('body').selectAll('svg').transition(); newEnterTransition = enterCircles.transition(differentElementTypeTransition); -differentDatumTypeTransition = select('svg').selectAll('circle').transition(); +differentDatumTypeTransition = select('svg').selectAll('circle').transition(); newEnterTransition = enterCircles.transition(differentDatumTypeTransition); // -------------------------------------------------------------------------- @@ -234,18 +234,18 @@ exitTransition = exitTransition.filter(function(d, i, g) { const index: number = i; const group: SVGCircleElement[] | ArrayLike = g; // console.log(this.x) // fails, x property not defined on SVGCircleElement - return this.r.baseVal.value < i * d.r; // this-type SVGCircleElement, datum tpye CircleDatum + return this.r.baseVal.value < i * d.r; // this-type SVGCircleElement, datum type CircleDatum }); // Scenario 2: Filtering narrows the type of selected elements in a known way // assume the class ".any-svg-type" can only be assigned to SVGElements in the DOM -let filterdGElements2: d3Transition.Transition; +let filteredGElements2: d3Transition.Transition; -filterdGElements2 = selectAll('.any-svg-type').transition().filter('g'); -// filterdGElements2 = selectAll('.any-type').transition().filter('g'); // fails without using narrowing generic on filter method +filteredGElements2 = selectAll('.any-svg-type').transition().filter('g'); +// filteredGElements2 = selectAll('.any-type').transition().filter('g'); // fails without using narrowing generic on filter method -filterdGElements2 = selectAll('.any-svg-type').transition().filter(function(d, i, g) { +filteredGElements2 = selectAll('.any-svg-type').transition().filter(function(d, i, g) { const that: SVGElement = this; // const that2: HTMLElement = this; // fails, type mismatch const datum: CircleDatum = d; @@ -253,7 +253,7 @@ filterdGElements2 = selectAll('.any-svg-type').transition().fil const group: SVGElement[] | ArrayLike = g; return that.tagName === 'g' || that.tagName === 'G'; }); -// filterdGElements2 = selectAll('.any-svg-type').transition().filter(function(){ +// filteredGElements2 = selectAll('.any-svg-type').transition().filter(function(){ // const that: SVGElement = this; // return that.tagName === 'g'|| that.tagName === 'G'; // }); // fails without using narrowing generic on filter method diff --git a/types/d3-zoom/d3-zoom-tests.ts b/types/d3-zoom/d3-zoom-tests.ts index 669b4af8ff..8051898b8b 100644 --- a/types/d3-zoom/d3-zoom-tests.ts +++ b/types/d3-zoom/d3-zoom-tests.ts @@ -84,7 +84,7 @@ interface GroupDatum { } // -------------------------------------------------------------------------- -// Test Define ZoomBehaviour +// Test Define ZoomBehavior // -------------------------------------------------------------------------- // Canvas Example ----------------------------------------------------------- @@ -235,7 +235,7 @@ const duration: number = svgZoom.duration(); // interpolate() -------------------------------------------------------------- -// chainable setter accepts interpoateZoom, interpolate and interpolateArray +// chainable setter accepts interpolateZoom, interpolate and interpolateArray svgZoom = svgZoom.interpolate(interpolateZoom); svgZoom = svgZoom.interpolate(interpolate); svgZoom = svgZoom.interpolate(interpolateArray); @@ -269,7 +269,7 @@ if (zoomHandler) { svgZoom.on('zoom', zoomHandler); } // -------------------------------------------------------------------------- -// Test Attach ZoomBehaviour +// Test Attach ZoomBehavior // -------------------------------------------------------------------------- // Canvas Example ----------------------------------------------------------- @@ -290,14 +290,14 @@ const svgOverlay: Selection = svg.ap const svgOverlayTransition = svgOverlay.transition(); // -------------------------------------------------------------------------- -// Test Use ZoomBehaviour +// Test Use ZoomBehavior // -------------------------------------------------------------------------- // transform() ------------------------------------------------------------------------------------- // use on selection svgZoom.transform(svgOverlay, d3Zoom.zoomIdentity); -// svgZoom.transform(groupsSelection, d3Zoom.zoomIdentity); // fails, as groupSelection mismachtes DOM Element type and datum type +// svgZoom.transform(groupsSelection, d3Zoom.zoomIdentity); // fails, as groupSelection mismatches DOM Element type and datum type svgZoom.transform(svgOverlay, function(datum, index, groups) { const that: SVGRectElement = this; @@ -310,7 +310,7 @@ svgZoom.transform(svgOverlay, function(datum, index, groups) { }); // use on transition svgOverlayTransition.call(svgZoom.transform, d3Zoom.zoomIdentity); -// svgZoom.transform(groupsTransition, d3Zoom.zoomIdentity); // fails, as groupTransition mismachtes DOM Element type and datum type +// svgZoom.transform(groupsTransition, d3Zoom.zoomIdentity); // fails, as groupTransition mismatches DOM Element type and datum type svgZoom.transform(svgOverlayTransition, d3Zoom.zoomIdentity); svgZoom.transform(svgOverlayTransition, function(datum, index, groups) { @@ -327,7 +327,7 @@ svgZoom.transform(svgOverlayTransition, function(datum, index, groups) { // use on selection svgZoom.translateBy(svgOverlay, 20, 50); -// svgZoom.translateBy(groupsSelection, 20, 50); // fails, as groupSelection mismachtes DOM Element type and datum type +// svgZoom.translateBy(groupsSelection, 20, 50); // fails, as groupSelection mismatches DOM Element type and datum type svgZoom.translateBy( svgOverlay, @@ -376,7 +376,7 @@ svgZoom.translateBy( // use on transition svgZoom.translateBy(svgOverlayTransition, 20, 50); -// svgZoom.translateBy(groupsTransition, 20, 50); // fails, as groupTransition mismachtes DOM Element type and datum type +// svgZoom.translateBy(groupsTransition, 20, 50); // fails, as groupTransition mismatches DOM Element type and datum type svgZoom.translateBy( svgOverlayTransition, @@ -427,7 +427,7 @@ svgZoom.translateBy( // use on selection svgZoom.translateTo(svgOverlay, 20, 50); -// svgZoom.translateTo(groupsSelection, 20, 50); // fails, as groupSelection mismachtes DOM Element type and datum type +// svgZoom.translateTo(groupsSelection, 20, 50); // fails, as groupSelection mismatches DOM Element type and datum type svgZoom.translateTo( svgOverlay, @@ -476,7 +476,7 @@ svgZoom.translateTo( // use on transition svgZoom.translateTo(svgOverlayTransition, 20, 50); -// svgZoom.translateTo(groupsTransition, 20, 50); // fails, as groupTransition mismachtes DOM Element type and datum type +// svgZoom.translateTo(groupsTransition, 20, 50); // fails, as groupTransition mismatches DOM Element type and datum type svgZoom.translateTo( svgOverlayTransition, @@ -527,7 +527,7 @@ svgZoom.translateTo( // use on selection svgZoom.scaleBy(svgOverlay, 3); -// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismachtes DOM Element type and datum type +// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismatches DOM Element type and datum type svgZoom.scaleBy(svgOverlay, function(datum, index, groups) { const that: SVGRectElement = this; @@ -540,7 +540,7 @@ svgZoom.scaleBy(svgOverlay, function(datum, index, groups) { }); // use on transition svgZoom.scaleBy(svgOverlayTransition, 3); -// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismachtes DOM Element type and datum type +// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismatches DOM Element type and datum type svgZoom.scaleBy(svgOverlayTransition, function(datum, index, groups) { const that: SVGRectElement = this; @@ -556,7 +556,7 @@ svgZoom.scaleBy(svgOverlayTransition, function(datum, index, groups) { // use on selection svgZoom.scaleTo(svgOverlay, 3); -// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismachtes DOM Element type and datum type +// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismatches DOM Element type and datum type svgZoom.scaleTo(svgOverlay, function(datum, index, groups) { const that: SVGRectElement = this; @@ -569,7 +569,7 @@ svgZoom.scaleTo(svgOverlay, function(datum, index, groups) { }); // use on transition svgZoom.scaleTo(svgOverlayTransition, 3); -// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismachtes DOM Element type and datum type +// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismatches DOM Element type and datum type svgZoom.scaleTo(svgOverlayTransition, function(datum, index, groups) { const that: SVGRectElement = this; diff --git a/types/d3-zoom/index.d.ts b/types/d3-zoom/index.d.ts index cf9b1ac89d..5ba719d227 100644 --- a/types/d3-zoom/index.d.ts +++ b/types/d3-zoom/index.d.ts @@ -693,7 +693,7 @@ export interface ZoomBehavior ((t: number) => ZoomView)): this; @@ -921,7 +921,7 @@ export interface ZoomTransform { * * For details see {@link https://github.com/d3/d3-zoom#zoom-transforms} * - * @param node An element for which to retrieve its current zoomt transform. + * @param node An element for which to retrieve its current zoom transform. */ export function zoomTransform(node: ZoomedElementBaseType): ZoomTransform; diff --git a/types/d3/d3-tests.ts b/types/d3/d3-tests.ts index 3942256a76..706c096968 100644 --- a/types/d3/d3-tests.ts +++ b/types/d3/d3-tests.ts @@ -2,6 +2,6 @@ import * as d3 from 'd3'; const version: string = d3.version; -// NOTE: Tests for all re-exports of consituent D3 modules are omitted as excessive. +// NOTE: Tests for all re-exports of constituent D3 modules are omitted as excessive. // The standard bundle definition is a straightforward pass-through with the exception of the // above tested "version" property. diff --git a/types/datatables.net/datatables.net-tests.ts b/types/datatables.net/datatables.net-tests.ts index 0c9f3db3cc..423dcaf4c9 100644 --- a/types/datatables.net/datatables.net-tests.ts +++ b/types/datatables.net/datatables.net-tests.ts @@ -533,6 +533,9 @@ $('#example').on('click', 'tbody td', () => { cells.every(() => { }); cells.every((cellRowIdx, cellColIdx, tableLoop, cellLoop) => { }); +cells.every(function(cellRowIdx, cellColIdx, tableLoop, cellLoop) { + const cell: DataTables.CellMethods = this; +}); let cell = dt.cell(":contains('Not shipped')"); cell = dt.cell(() => { }); @@ -815,6 +818,9 @@ dt.columns.adjust().draw(false); // adjust column sizing and redraw dt.columns().every(() => { }); dt.columns().every((colIdx, tableLoop, colLoop) => { }); +dt.columns().every(function(colIdx, tableLoop, colLoop) { + const col: DataTables.ColumnMethods = this; +}); $('#example').on('column-visibility.dt', (e: object, settings: DataTables.Settings, column: number, state: boolean, recalc: boolean | undefined) => { const widthRecalced = (recalc || recalc === undefined); @@ -864,6 +870,9 @@ const rows_12 = dt.rows("selector").nodes(); const rows_13 = dt.rows.add([{}, {}]); dt.rows().every(() => { }); dt.rows().every((rowIdx, tableLoop, rowLoop) => { }); +dt.rows().every(function(rowIdx, tableLoop, rowLoop) { + const row: DataTables.RowMethods = this; +}); const rows_14: DataTables.Api = dt.rows("selector").ids(); const rows_15: DataTables.Api = dt.rows("selector").ids(false); diff --git a/types/datatables.net/index.d.ts b/types/datatables.net/index.d.ts index c0a37145ab..2fd3f3ae45 100644 --- a/types/datatables.net/index.d.ts +++ b/types/datatables.net/index.d.ts @@ -684,7 +684,7 @@ declare namespace DataTables { * * @param fn Function to execute for every cell selected. */ - every(fn: (cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): Api; + every(fn: (this: CellMethods, cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): Api; /** * Get index information about the selected cells @@ -812,7 +812,7 @@ declare namespace DataTables { * * @param fn Function to execute for every column selected. */ - every(fn: (colIdx: number, tableLoop: number, colLoop: number) => void): Api; + every(fn: (this: ColumnMethods, colIdx: number, tableLoop: number, colLoop: number) => void): Api; /** * Get the column indexes of the selected columns. @@ -995,7 +995,7 @@ declare namespace DataTables { * * @param fn Function to execute for every row selected. */ - every(fn: (rowIdx: number, tableLoop: number, rowLoop: number) => void): Api; + every(fn: (this: RowMethods, rowIdx: number, tableLoop: number, rowLoop: number) => void): Api; /** * Get the ids of the selected rows. Since: 1.10.8 diff --git a/types/discourse-sso/discourse-sso-tests.ts b/types/discourse-sso/discourse-sso-tests.ts new file mode 100644 index 0000000000..efe7eba95b --- /dev/null +++ b/types/discourse-sso/discourse-sso-tests.ts @@ -0,0 +1,16 @@ +import * as discourseSSO from 'discourse-sso'; +const sso = new discourseSSO('sso secret string'); + +if (sso.validate('payload', 'sig')) { + const nonce = sso.getNonce('payload'); + + const userParams: discourseSSO.UserParams = { + nonce, + external_id: '1', + email: 'omg@mail.com', + username: 'myuser', + name: 'This Guy' + }; + + const loginString: string = sso.buildLoginString(userParams); +} diff --git a/types/discourse-sso/index.d.ts b/types/discourse-sso/index.d.ts new file mode 100644 index 0000000000..b8030e0735 --- /dev/null +++ b/types/discourse-sso/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for discourse-sso 1.0 +// Project: https://github.com/ArmedGuy/discourse_sso_node +// Definitions by: Arnav Gupta +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class DiscourseSSO { + constructor(ssoSecret: string); + validate(payload: string, sig: string): boolean; + getNonce(payload: string): string; + buildLoginString(params: DiscourseSSO.UserParams): string; +} + +declare namespace DiscourseSSO { + interface UserParams { + nonce: string; + external_id: string; + email: string; + admin?: boolean; + moderator?: boolean; + username?: string; + name?: string; + avatar_url?: string; + add_groups?: string[]; + remove_groups?: string[]; + } +} +export = DiscourseSSO; diff --git a/types/discourse-sso/tsconfig.json b/types/discourse-sso/tsconfig.json new file mode 100644 index 0000000000..a0f1edbad5 --- /dev/null +++ b/types/discourse-sso/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "discourse-sso-tests.ts" + ] +} diff --git a/types/discourse-sso/tslint.json b/types/discourse-sso/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/discourse-sso/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/echarts/index.d.ts b/types/echarts/index.d.ts index b217be12eb..15892864e5 100644 --- a/types/echarts/index.d.ts +++ b/types/echarts/index.d.ts @@ -1,13 +1,17 @@ // Type definitions for echarts // Project: http://echarts.baidu.com/ -// Definitions by: Xie Jingyang , AntiMoron +// Definitions by: Xie Jingyang +// AntiMoron +// Liveangela // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 declare namespace echarts { - function init(dom: HTMLDivElement | HTMLCanvasElement, theme?: Object | string, opts?: { + function init(dom: HTMLDivElement | HTMLCanvasElement, theme?: object | string, opts?: { devicePixelRatio?: number renderer?: string + width?: number | string + height?: number | string }): ECharts; const graphic: Graphic; @@ -15,10 +19,10 @@ declare namespace echarts { interface Graphic { clipPointsByRect(points: number[][], rect: ERectangle): number[][]; clipRectByRect(targetRect: ERectangle, rect: ERectangle): ERectangle; - LinearGradient: { new(x: number, y: number, x2: number, y2: number, colorStops: Array, globalCoord?: boolean): LinearGradient } + LinearGradient: { new(x: number, y: number, x2: number, y2: number, colorStops: object[], globalCoord?: boolean): LinearGradient } } - function connect(group: string | Array): void; + function connect(group: string | string[]): void; function disConnect(group: string): void; @@ -26,9 +30,9 @@ declare namespace echarts { function getInstanceByDom(target: HTMLDivElement | HTMLCanvasElement): ECharts; - function registerMap(mapName: string, geoJson: Object, specialAreas?: Object): void; + function registerMap(mapName: string, geoJson: object, specialAreas?: object): void; - function registerTheme(themeName: string, theme: Object): void; + function registerTheme(themeName: string, theme: object): void; interface MapObj { /** geoJson data for map */ @@ -40,7 +44,7 @@ declare namespace echarts { function getMap(mapName: string): MapObj; interface LinearGradient { - colorStops: Array; + colorStops: object[]; global: boolean; type: string; x: number @@ -60,17 +64,17 @@ declare namespace echarts { getDom(): HTMLCanvasElement | HTMLDivElement - getOption(): Object + getOption(): object resize(): void - dispatchAction(payload: Object): void + dispatchAction(payload: object): void - on(eventName: string, handler: Function, context?: Object): void + on(eventName: string, handler: Function, context?: object): void off(eventName: string, handler?: Function): void - showLoading(type?: string, opts?: Object): void + showLoading(type?: string, opts?: object): void hideLoading(): void @@ -99,13 +103,17 @@ declare namespace echarts { dispose(): void /** 转换逻辑点到像素 */ - convertToPixel(finder: ConvertFinder | string, value: string | Array): string | Array + convertToPixel(finder: ConvertFinder | string, value: string | any[]): string | any[] - convertFromPixel(finder: ConvertFinder | string, value: Array | string): Array | string + convertFromPixel(finder: ConvertFinder | string, value: any[] | string): any[] | string containPixel(finder: ConvertFinder | string, /** 要被判断的点,为像素坐标值,以 echarts 实例的 dom 节点的左上角为坐标 [0, 0] 点。*/ value: any[]): boolean + + getModel(): { + getComponent(finder: string): any; + } } interface ConvertFinder { @@ -135,31 +143,54 @@ declare namespace echarts { interface EChartOption { title?: EChartTitleOption - legend?: Object, - grid?: Object, - xAxis?: Object, - yAxis?: Object, - polar?: Object, - radiusAxis?: Object, - angleAxis?: Object, - radar?: Object, - dataZoom?: Array, - visualMap?: Array, - tooltip?: Object, - toolbox?: Object, - geo?: Object, - parallel?: Object, - parallelAxis?: Object, - timeline?: Object, - series?: Array, - color?: Array, + legend?: object, + grid?: object, + xAxis?: object, + yAxis?: object, + polar?: object, + radiusAxis?: object, + angleAxis?: object, + radar?: object, + dataZoom?: object[], + visualMap?: object[], + tooltip?: object, + axisPointer?: object, + toolbox?: object, + brush?: object, + geo?: object, + parallel?: object, + parallelAxis?: object, + singleAxis?: object, + timeline?: object, + graphic?: object | object[], + calendar?: object, + dataset?: object, + aria?: object, + series?: object[], + color?: string[], backgroundColor?: string, - textStyle?: Object, + textStyle?: object, animation?: boolean, + animationThreshold?: number, animationDuration?: number, animationEasing?: string, - animationDurationUpdate?: number, - animationEasingUpdate?: string + animationDelay?: number | Function, + animationDurationUpdate?: number | Function, + animationEasingUpdate?: string, + animationDelayUpdate?: number | Function, + progressive?: number, + progressiveThreshold?: number, + blendMode?: string, + hoverLayerThreshold?: number, + useUTC?: boolean, + /** echarts-gl options */ + globe?: object, + geo3D?: object, + mapbox3D?: object, + grid3D?: object, + xAxis3D?: object, + yAxis3D?: object, + zAxis3D?: object } interface EChartTitleOption { @@ -167,11 +198,11 @@ declare namespace echarts { text?: string; link?: string, target?: string, - textStyle?: Object, + textStyle?: object, subtext?: string, sublink?: string, subtarget?: string, - subtextStyle?: Object, + subtextStyle?: object, padding?: number, itemGap?: number, zlevel?: number, diff --git a/types/echarts/tsconfig.json b/types/echarts/tsconfig.json index 82e6284376..71e6b79545 100644 --- a/types/echarts/tsconfig.json +++ b/types/echarts/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -20,4 +20,4 @@ "files": [ "index.d.ts" ] -} \ No newline at end of file +} diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index a35ed40dec..a1cfc84334 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -1685,6 +1685,10 @@ declare module 'ember' { target: Target, method: ObserverMethod ): void; + addObserver( + key: keyof this, + method: ObserverMethod + ): void; /** * Remove an observer you have previously registered on this object. Pass * the same key, target, and method you passed to `addObserver()` and your @@ -1695,6 +1699,10 @@ declare module 'ember' { target: Target, method: ObserverMethod ): any; + removeObserver( + key: keyof this, + method: ObserverMethod + ): any; /** * Retrieves the value of a property, or a default value in the case that the * property returns `undefined`. @@ -3010,6 +3018,11 @@ declare module 'ember' { method: ObserverMethod, once?: boolean ): void; + function addListener( + obj: Context, + key: keyof Context, + method: ObserverMethod + ): void; /** * Remove an event listener */ @@ -3019,6 +3032,11 @@ declare module 'ember' { target: Target, method: ObserverMethod ): any; + function removeListener( + obj: Context, + key: keyof Context, + method: ObserverMethod + ): any; /** * Send an event. The execution of suspended listeners * is skipped, and once listeners are removed. A listener without @@ -3112,6 +3130,11 @@ declare module 'ember' { target: Target, method: ObserverMethod ): void; + function addObserver( + obj: Context, + key: keyof Context, + method: ObserverMethod + ): void; /** * Remove an observer you have previously registered on this object. Pass * the same key, target, and method you passed to `addObserver()` and your @@ -3123,6 +3146,11 @@ declare module 'ember' { target: Target, method: ObserverMethod ): any; + function removeObserver( + obj: Context, + key: keyof Context, + method: ObserverMethod + ): any; /** * Gets the value of a property on an object. If the property is computed, * the function will be invoked. If the property is not defined but the diff --git a/types/ember/test/observable.ts b/types/ember/test/observable.ts index cf871807b2..a642da271f 100755 --- a/types/ember/test/observable.ts +++ b/types/ember/test/observable.ts @@ -14,6 +14,13 @@ class MyComponent extends Ember.Component { this.removeObserver('foo', this, this.fooDidChange); Ember.removeObserver(this, 'foo', this, 'fooDidChange'); Ember.removeObserver(this, 'foo', this, this.fooDidChange); + const lambda = () => { + this.fooDidChange(this, 'foo'); + }; + this.addObserver('foo', lambda); + this.removeObserver('foo', lambda); + Ember.addObserver(this, 'foo', lambda); + Ember.removeObserver(this, 'foo', lambda); } fooDidChange(sender: MyComponent, key: 'foo') { diff --git a/types/expect-puppeteer/expect-puppeteer-tests.ts b/types/expect-puppeteer/expect-puppeteer-tests.ts index 84a7e65486..4ad0ce1f3c 100644 --- a/types/expect-puppeteer/expect-puppeteer-tests.ts +++ b/types/expect-puppeteer/expect-puppeteer-tests.ts @@ -13,8 +13,9 @@ const testGlobal = async (instance: ElementHandle | Page) => { await expect(instance).toMatch("selector"); await expect(instance).toMatch("selector", { timeout: 777 }); - await expect(instance).toMatchElement("selector", "value"); - await expect(instance).toMatchElement("selector", "value", { polling: "mutation" }); + await expect(instance).toMatchElement("selector"); + await expect(instance).toMatchElement("selector", { polling: "raf", timeout: 777 }); + await expect(instance).toMatchElement("selector", { polling: "mutation", text: "text" }); await expect(instance).toSelect("selector", "valueOrText"); await expect(instance).toSelect("selector", "valueOrText", { polling: "raf" }); diff --git a/types/expect-puppeteer/index.d.ts b/types/expect-puppeteer/index.d.ts index ce20675d37..4d599f99fe 100644 --- a/types/expect-puppeteer/index.d.ts +++ b/types/expect-puppeteer/index.d.ts @@ -42,7 +42,7 @@ interface ExpectPuppeteer { toDisplayDialog(block: () => Promise): Promise; toFill(selector: string, value: string, options?: ExpectTimingActions): Promise; toMatch(selector: string, options?: ExpectTimingActions): Promise; - toMatchElement(selector: string, value: string, options?: ExpectTimingActions): Promise; + toMatchElement(selector: string, options?: ExpectToClickOptions): Promise; toSelect(selector: string, valueOrText: string, options?: ExpectTimingActions): Promise; toUploadFile(selector: string, filePath: string, options?: ExpectTimingActions): Promise; } @@ -57,7 +57,7 @@ declare global { toDisplayDialog(block: () => Promise): Promise; toFill(selector: string, value: string, options?: ExpectTimingActions): Promise; toMatch(selector: string, options?: ExpectTimingActions): Promise; - toMatchElement(selector: string, value: string, options?: ExpectTimingActions): Promise; + toMatchElement(selector: string, options?: ExpectToClickOptions): Promise; toSelect(selector: string, valueOrText: string, options?: ExpectTimingActions): Promise; toUploadFile(selector: string, filePath: string, options?: ExpectTimingActions): Promise; } diff --git a/types/extract-files/extract-files-tests.ts b/types/extract-files/extract-files-tests.ts new file mode 100644 index 0000000000..862f29d5f3 --- /dev/null +++ b/types/extract-files/extract-files-tests.ts @@ -0,0 +1,9 @@ +import { ReactNativeFile, ReactNativeFileOptions } from "extract-files"; + +const options: ReactNativeFileOptions = { + name: "", + type: "", + uri: "", +}; + +new ReactNativeFile(options); diff --git a/types/extract-files/index.d.ts b/types/extract-files/index.d.ts new file mode 100644 index 0000000000..412dc09a98 --- /dev/null +++ b/types/extract-files/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for extract-files 3.1 +// Project: https://github.com/jaydenseric/extract-files#readme +// Definitions by: Edward Sammut Alessi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface ReactNativeFileOptions { + uri: string; + type: string; + name: string; +} + +export class ReactNativeFile { + uri: string; + type: string; + name: string; + + constructor(options: ReactNativeFileOptions); + + static list(files: ReactNativeFileOptions[]): ReactNativeFile[]; +} diff --git a/types/extract-files/tsconfig.json b/types/extract-files/tsconfig.json new file mode 100644 index 0000000000..6c462da54e --- /dev/null +++ b/types/extract-files/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "extract-files-tests.ts" + ] +} diff --git a/types/extract-files/tslint.json b/types/extract-files/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/extract-files/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/fabric/fabric-impl.d.ts b/types/fabric/fabric-impl.d.ts index e35b0ebe0d..13bde18c3e 100644 --- a/types/fabric/fabric-impl.d.ts +++ b/types/fabric/fabric-impl.d.ts @@ -2098,6 +2098,11 @@ interface IObjectOptions { */ backgroundColor?: string; + /** + * When `true`, object is cached on an additional canvas. + */ + objectCaching?: boolean; + /** * When defined, an object is rendered via stroke and this property specifies its color */ diff --git a/types/facebook-instant-games/facebook-instant-games-tests.ts b/types/facebook-instant-games/facebook-instant-games-tests.ts index 8d33e2c970..949782c41a 100644 --- a/types/facebook-instant-games/facebook-instant-games-tests.ts +++ b/types/facebook-instant-games/facebook-instant-games-tests.ts @@ -1,58 +1,134 @@ -class FBInstantTest { - winStreak: number; +const locale: string = FBInstant.getLocale()!; +const platform: string = FBInstant.getPlatform(); +const sdkVersion: string = FBInstant.getSDKVersion(); +FBInstant.initializeAsync().then(() => {}); +FBInstant.setLoadingProgress(10); +const supportedAPIs = FBInstant.getSupportedAPIs(); +const entryPointData = FBInstant.getEntryPointData(); +FBInstant.getEntryPointAsync().then(entryPointName => {}); +FBInstant.setSessionData({sessionData: "sessionData"}); +FBInstant.startGameAsync().then(() => {}); - init() { - FBInstant.initializeAsync().then(() => { - FBInstant.setLoadingProgress(100); - FBInstant.startGameAsync().then(() => { - this.startGame(); - }); - }); - } +const sharePayload = { + intent: "INVITE" as "INVITE", + image: "", + text: "text", + data: {score: 10}, +}; +FBInstant.shareAsync(sharePayload); - startGame() { - const contextId = FBInstant.context.getID(); - const contextType = FBInstant.context.getType(); +const customUpdatePayload = { + action: "CUSTOM" as "CUSTOM", + template: "template", + cta: "cta", + image: "image", + text: { + default: 'Edgar played their move', + localizations: { + en_US: 'Edgar played their move', + es_LA: '\u00A1Edgar jug\u00F3 su jugada!' + } + }, +}; +FBInstant.updateAsync(customUpdatePayload).then(() => {}); - const playerName = FBInstant.player.getName(); - const playerPic = FBInstant.player.getPhoto(); - const playerId = FBInstant.player.getID(); - } +const leaderboardUpdatePayload: FBInstant.LeaderboardUpdatePayload = { + action: "LEADERBOARD", + name: "name", + text: "text" +}; +FBInstant.updateAsync(leaderboardUpdatePayload).then(() => {}); +FBInstant.switchGameAsync("appID").then(() => {}); - saveState() { - FBInstant.player.setDataAsync({ - score: this.winStreak - }); - } +FBInstant.canCreateShortcutAsync().then((canCreateShortcut: boolean) => {}); +FBInstant.createShortcutAsync().then(() => {}); +FBInstant.quit(); +const apiError = FBInstant.logEvent("eventName", 10, {key1: "value1", key2: "value2"}); +FBInstant.onPause(() => { }); - getState() { - FBInstant.player.getDataAsync(['score']) - .then((data) => { - if (typeof data['score'] !== 'undefined') { - this.winStreak = +data['score']; - } - }); - } +FBInstant.getInterstitialAdAsync("placementID").then(adInstance => {}); +FBInstant.getRewardedVideoAsync("placementID").then(adInstance => { + const placementID: string = adInstance.getPlacementID(); + adInstance.loadAsync().then(() => {}); + adInstance.showAsync().then(() => {}); +}); - update() { - FBInstant.updateAsync({ - action: 'CUSTOM', - cta: 'Play', - image: '', - text: { - default: 'Edgar played their move', - localizations: { - en_US: 'Edgar played their move', - es_LA: '\u00A1Edgar jug\u00F3 su jugada!' - } - }, - template: 'play_turn', - data: { myReplayData: '...' }, - strategy: 'IMMEDIATE', - notification: 'NO_PUSH' - }).then(() => { - // closes the game after the update is posted. - FBInstant.quit(); - }); - } -} +FBInstant.matchPlayerAsync("matchTag", false).then(() => {}); +FBInstant.checkCanPlayerMatchAsync().then((canPlayerMatchAsync: boolean) => {}); +FBInstant.getLeaderboardAsync("name").then((leaderboard: FBInstant.Leaderboard) => { + leaderboard.getConnectedPlayerEntriesAsync(10, 0).then(leaderboardEntries => { + const leaderboardEntry = leaderboardEntries[0]; + const extraData: string = leaderboardEntry.getExtraData()!; + const formattedScore: string = leaderboardEntry.getFormattedScore(); + + const leaderboardPlayer = leaderboardEntry.getPlayer(); + const leaderboardPlayerID: string = leaderboardPlayer.getID()!; + const leaderboardPlayerName: string = leaderboardPlayer.getName(); + const leaderboardPlayerPhoto: string = leaderboardPlayer.getPhoto()!; + + const rank: number = leaderboardEntry.getRank(); + const score: number = leaderboardEntry.getScore(); + const timestamp: number = leaderboardEntry.getTimestamp(); + }); +}); + +FBInstant.player.canSubscribeBotAsync().then((canSubscribeBot: boolean) => {}); +FBInstant.player.flushDataAsync().then(() => {}); +FBInstant.player.getConnectedPlayersAsync().then((connectedPlayers: FBInstant.ConnectedPlayer[]) => { + const connectedPlayer: FBInstant.ConnectedPlayer = connectedPlayers[0]; + const id: string = connectedPlayer.getID(); + const name: string = connectedPlayer.getName()!; + const photo: string = connectedPlayer.getPhoto()!; +}); +FBInstant.player.getDataAsync(["score"]).then(data => { + const score: number = data["score"] as number; +}); +const playerID: string = FBInstant.player.getID()!; +const playerName: string = FBInstant.player.getName()!; +const playerPhoto: string = FBInstant.player.getPhoto()!; +FBInstant.player.getSignedPlayerInfoAsync('metadata').then(signedPlayerInfo => { + const playerID: string = signedPlayerInfo.getPlayerID(); + const signature: string = signedPlayerInfo.getSignature(); +}); +FBInstant.player.getStatsAsync(["score"]).then(result => { + const score: number = result["score"]; +}); +FBInstant.player.incrementStatsAsync({score: 1}).then(result => { + const incrementedScore: number = result["score"]; +}); +FBInstant.player.setDataAsync({score: 10}).then(() => {}); +FBInstant.player.setStatsAsync({score: 10}).then(() => {}); +FBInstant.player.subscribeBotAsync().then(() => {}); + +const contextOptions: FBInstant.ContextOptions = { + filters: ["NEW_CONTEXT_ONLY"], + maxSize: 10, + minSize: 1 +}; +FBInstant.context.chooseAsync(contextOptions); +FBInstant.context.createAsync("playerID").then(() => {}); +const contextID: string = FBInstant.context.getID()!; +FBInstant.context.getPlayersAsync().then((contextPlayers: FBInstant.ContextPlayer[]) => { + const contextPlayer: FBInstant.ContextPlayer = contextPlayers[0]; + const id: string = contextPlayer.getID(); + const name: string = contextPlayer.getName()!; + const photo: string = contextPlayer.getPhoto()!; +}); +const type = FBInstant.context.getType(); +const contextSizeResponse = FBInstant.context.isSizeBetween(1, 10)!; +const sizeIsBetween: boolean = contextSizeResponse.answer; +const maxSize: number = contextSizeResponse.maxSize!; +const minSize: number = contextSizeResponse.minSize!; + +FBInstant.context.switchAsync("id").then(() => {}); + +FBInstant.payments.consumePurchaseAsync("purchaseToken").then(() => {}); +FBInstant.payments.getCatalogAsync().then((products: FBInstant.Product[]) => { + const product = products[0]; + const description: string = product.description!; + const imageURI: string = product.imageURI!; + const price: string = product.price; + const priceCurrencyCode: string = product.priceCurrencyCode; + const productID: string = product.productID; + const title: string = product.title; +}); diff --git a/types/facebook-instant-games/index.d.ts b/types/facebook-instant-games/index.d.ts index 1e8a8d76fd..74c93c6c96 100644 --- a/types/facebook-instant-games/index.d.ts +++ b/types/facebook-instant-games/index.d.ts @@ -1,200 +1,1077 @@ -// Type definitions for facebook-instant-games 6.1 +// Type definitions for facebook-instant-games 6.2 // Project: https://developers.facebook.com/docs/games/instant-games -// Definitions by: Menushka Weeratunga +// Definitions by: Menushka Weeratunga , Øyvind Johansen Amundrud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/** + * Top level namespace for the Instant Games SDK. + */ declare namespace FBInstant { + /** + * Contains functions and properties related to the current player. + */ let player: Player; + + /** + * Contains functions and properties related to the current game context. + */ let context: Context; + + /** + * Contains functions and properties related to payments and purchases of game products. + */ let payments: Payments; - function getLocale(): string; - function getPlatform(): string; + /** + * The current locale. Use this to determine what language the current game should be localized with. + * The value will not be accurate until FBInstant.startGameAsync() resolves. + * + * @returns The current locale. + */ + function getLocale(): string | null; + + /** + * The platform on which the game is currently running. The value will always be null until FBInstant.initializeAsync() resolves. + */ + function getPlatform(): Platform; + + /** + * The string representation of this SDK version. + * + * @returns The SDK version. + */ function getSDKVersion(): string; - function initializeAsync(): Promise; - function setLoadingProgress(progress: number): void; + + /** + * Initializes the SDK library. This should be called before any other SDK functions. + * + * @returns A promise that resolves when the SDK is ready to use. + * @throws INVALID_OPERATION + */ + function initializeAsync(): Promise; + + /** + * Report the game's initial loading progress. + * + * @param percentage A number between 0 and 100. + */ + function setLoadingProgress(percentage: number): void; + + /** + * Provides a list of API functions that are supported by the client. + * + * @returns List of API functions that the client explicitly supports. + */ function getSupportedAPIs(): string[]; + + /** + * Returns any data object associated with the entry point that the game was launched from. + * + * The contents of the object are developer-defined, and can occur from entry points on different platforms. + * This will return null for older mobile clients, as well as when there is no data associated with the particular entry point. + * + * @returns Data associated with the current entry point. + */ function getEntryPointData(): any; + + /** + * Returns the entry point that the game was launched from. + * This function should be called after FBInstant.startGameAsync() resolves. + * + * @returns The name of the entry point from which the user started the game. + */ function getEntryPointAsync(): Promise; + + /** + * Sets the data associated with the individual gameplay session for the current context. + * + * This function should be called whenever the game would like to update the current session data. + * This session data may be used to populate a variety of payloads, such as game play webhooks. + * + * @param sessionData An arbitrary data object, which must be less than or equal to 1000 characters when stringified. + */ function setSessionData(sessionData: any): void; - function startGameAsync(): Promise; + + /** + * This indicates that the game has finished initial loading and is ready to start. + * Context information will be up-to-date when the returned promise resolves. + * + * @returns A promise that resolves when the game should start. + * @throws INVALID_PARAM + * @throws CLIENT_UNSUPPORTED_OPERATION + */ + function startGameAsync(): Promise; + + /** + * This invokes a dialog to let the user share specified content, either as a message in Messenger or as a post on the user's timeline. + * A blob of data can be attached to the share which every game session launched from the share will be able to access from FBInstant.getEntryPointData(). + * This data must be less than or equal to 1000 characters when stringified. The user may choose to cancel the share action and close the dialog, and the + * returned promise will resolve when the dialog is closed regardless if the user actually shared the content or not. + * + * @param payload Specify what to share. See example for details. + * @returns A promise that resolves when the share is completed or cancelled. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws INVALID_OPERATION + */ function shareAsync(payload: SharePayload): Promise; - function updateAsync(payload: UpdatePayload | LeaderboardUpdatePayload): Promise; - function switchGameAsync(appID: string, data?: string): Promise; + + /** + * Informs Facebook of an update that occurred in the game. This will temporarily yield control to Facebook and Facebook will decide what to do based on what the update is. + * The returned promise will resolve/reject when Facebook returns control to the game. + * + * @param payload A payload that describes the update. + * @returns A promise that resolves when Facebook gives control back to the game. + * @throws INVALID_PARAM + * @throws PENDING_REQUEST + * @throws INVALID_OPERATION + */ + function updateAsync(payload: CustomUpdatePayload | LeaderboardUpdatePayload): Promise; + + /** + * Request that the client switch to a different Instant Game. The API will reject if the switch fails - else, the client will load the new game. + * + * @param appID The Application ID of the Instant Game to switch to. The application must be an Instant Game, and must belong to the same business as the current game. + * To associate different games with the same business, you can use Business Manager: https://developers.facebook.com/docs/apps/business-manager#update-business. + * @param data An optional data payload. This will be set as the entrypoint data for the game being switched to. Must be less than or equal to 1000 characters when stringified. + * @throws USER_INPUT + * @throws INVALID_PARAM + * @throws PENDING_REQUEST + * @throws CLIENT_REQUIRES_UPDATE + */ + function switchGameAsync(appID: string, data?: any): Promise; + + /** + * Returns whether or not the user is eligible to have shortcut creation requested. + * + * Will return false if createShortcutAsync was already called this session or the user is ineligible for shortcut creation. + * + * @returns Promise that resolves with true if the game can request the player create a shortcut to the game, and false otherwise + * @throws PENDING_REQUEST + * @throws CLIENT_REQUIRES_UPDATE + * @throws INVALID_OPERATION + */ function canCreateShortcutAsync(): Promise; + + /** + * Prompts the user to create a shortcut to the game if they are eligible to Can only be called once per session. (see canCreateShortcutAsync) + * @throws USER_INPUT + * @throws PENDING_REQUEST + * @throws CLIENT_REQUIRES_UPDATE + * @throws INVALID_OPERATION + */ function createShortcutAsync(): Promise; + + /** + * Quits the game. + */ function quit(): void; - function logEvent(eventName: string, valueToSum?: number, parameter?: any): APIError; + + /** + * Log an app event with FB Analytics. See https://developers.facebook.com/docs/javascript/reference/v2.8#app_events for more details about FB Analytics. + * + * @param eventName Name of the event. Must be 2 to 40 characters, and can only contain '_', '-', ' ', and alphanumeric characters. + * @param valueToSum An optional numeric value that FB Analytics can calculate a sum with. + * @param parameter An optional object that can contain up to 25 key-value pairs to be logged with the event. Keys must be 2 to 40 characters, + * and can only contain '_', '-', ' ', and alphanumeric characters. Values must be less than 100 characters in length. + * @returns The error if the event failed to log; otherwise returns null. + */ + function logEvent(eventName: string, valueToSum?: number, parameter?: { [key: string]: string; }): APIError | null; + + /** + * Set a callback to be fired when a pause event is triggered. + * @param func A function to call when a pause event occurs. + */ function onPause(func: () => void): void; + + /** + * Attempt to create an instance of interstitial ad. This instance can then be preloaded and presented. + * @param placementID The placement ID that's been setup in your Audience Network settings. + * @returns A promise that resolves with a AdInstance, or rejects with a APIError if it couldn't be created. + * @throws ADS_TOO_MANY_INSTANCES + * @throws CLIENT_UNSUPPORTED_OPERATION + */ function getInterstitialAdAsync(placementID: string): Promise; + + /** + * Attempt to create an instance of rewarded video. This instance can then be preloaded and presented. + * @param placementID The placement ID that's been setup in your Audience Network settings. + * @returns A promise that resolves with a AdInstance, or rejects with a APIError if it couldn't be created. + * @throws ADS_TOO_MANY_INSTANCES + * @throws CLIENT_UNSUPPORTED_OPERATION + */ function getRewardedVideoAsync(placementID: string): Promise; + + /** + * Attempts to match the current player with other users looking for people to play with. If successful, a new Messenger group + * thread will be created containing the matched players and the player will be context switched to that thread. + * The default minimum and maximum number of players in one matched thread are 2 and 20 respectively, depending on how many players + * are trying to get matched around the same time. The values can be changed in fbapp-config.json. See the + * [Bundle Config documentation]https://developers.facebook.com/docs/games/instant-games/bundle-config for documentation about fbapp-config.json. + * + * @param matchTag Optional extra information about the player used to group them with similar players. Players will only be grouped with other players with exactly the same tag. + * The tag must only include letters, numbers, and underscores and be 100 characters or less in length. + * @param switchContextWhenMatched Optional extra parameter that specifies whether the player should be immediately switched to the new context when a match is found. + * By default this will be false which will mean the player needs explicitly press play after being matched to switch to the new context. + * @returns A promise that resolves when the player has been added to a group thread and switched into the thread's context. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws USER_INPUT + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws INVALID_OPERATION + */ function matchPlayerAsync(matchTag?: string, switchContextWhenMatched?: boolean): Promise; + + /** + * Checks if the current player is eligible for the matchPlayerAsync API. + * @returns A promise that resolves with true if the player is eligible to match with other players and false otherwise. + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + */ function checkCanPlayerMatchAsync(): Promise; + + /** + * Fetch a specific leaderboard belonging to this Instant Game. + * + * @param name The name of the leaderboard. Each leaderboard for an Instant Game must have its own distinct name. + * @returns A promise that resolves with the matching leaderboard, rejecting if one is not found. + * @throws LEADERBOARD_NOT_FOUND + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws INVALID_OPERATION + * @throws INVALID_PARAM + */ function getLeaderboardAsync(name: string): Promise; interface Player { - getID(): string; - getSignedPlayerInfoAsync(requestPayload: string): Promise; + /** + * A unique identifier for the player. A Facebook user's player ID will remain constant, + * and is scoped to a specific game. This means that different games will have different + * player IDs for the same user. This function should not be called until FBInstant.initializeAsync() + * has resolved. + * + * @returns A unique identifier for the player. + */ + getID(): string | null; + + /** + * Fetch the player's unique identifier along with a signature that verifies that the identifier indeed + * comes from Facebook without being tampered with. This function should not be called until + * FBInstant.initializeAsync() has resolved. + * + * @param requestPayload A developer-specified payload to include in the signed response. + * @returns A promise that resolves with a SignedPlayerInfo object. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + */ + getSignedPlayerInfoAsync(requestPayload?: string): Promise; + + /** + * Returns a promise that resolves with whether the player can subscribe to the game bot or not. + * Developer can only call subscribeBotAsync() after checking canSubscribeBotAsync(), and the player will + * only be able to see this bot subscription dialog once for a specific game. + * + * @returns Whether a player can subscribe to the game bot or not. + */ canSubscribeBotAsync(): Promise; + + /** + * Request that the player subscribe the bot associated to the game. The API will reject if the subscription + * fails - else, the player will subscribe the game bot. + * + * @returns A promise that resolves if player successfully subscribed to the game bot, or rejects if request failed or player chose to not subscribe. + * @throws INVALID_PARAM + * @throws PENDING_REQUEST + * @throws CLIENT_REQUIRES_UPDATE + */ subscribeBotAsync(): Promise; - getName(): string; - getPhoto(): string; - getDataAsync(keys?: string[]): Promise; + + /** + * The player's localized display name. This function should not be called until FBInstant.startGameAsync() has resolved. + * + * @returns The player's localized display name. + */ + getName(): string | null; + + /** + * A url to the player's public profile photo. The photo will always be a square, and with dimensions of at least 200x200. + * When rendering it in the game, the exact dimensions should never be assumed to be constant. It's recommended to always + * scale the image to a desired size before rendering. The value will always be null until FBInstant.startGameAsync() resolves. + * + * WARNING: Due to CORS, using these photos in the game canvas can cause it to be tainted, which will prevent the canvas data from being extracted. + * To prevent this, set the cross-origin attribute of the images you use to 'anonymous'. + * + * @returns Url to the player's public profile photo. + */ + getPhoto(): string | null; + + /** + * Retrieve data from the designated cloud storage of the current player. + * + * @param keys An array of unique keys to retrieve data for. + * @returns A promise that resolves with an object which contains the current key-value pairs for each key specified in the input array, if they exist. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + */ + getDataAsync(keys: string[]): Promise; + + /** + * Set data to be saved to the designated cloud storage of the current player. The game can store up to 1MB of data for each unique player. + * + * @param data An object containing a set of key-value pairs that should be persisted to cloud storage. The object must contain only serializable + * values - any non-serializable values will cause the entire modification to be rejected. + * @returns A promise that resolves when the input values are set. NOTE: The promise resolving does not necessarily mean that the input has already been persisted. + * Rather, it means that the data was valid and has been scheduled to be saved. It also guarantees that all values that were set are now available in player.getDataAsync. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ setDataAsync(data: DataObject): Promise; + + /** + * Immediately flushes any changes to the player data to the designated cloud storage. This function is expensive, and should primarily be + * used for critical changes where persistence needs to be immediate and known by the game. Non-critical changes should rely on the platform + * to persist them in the background. NOTE: Calls to player.setDataAsync will be rejected while this function's result is pending. + * + * @returns A promise that resolves when changes have been persisted successfully, and rejects if the save fails. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ flushDataAsync(): Promise; + + /** + * Retrieve stats from the designated cloud storage of the current player. + * + * @param keys An optional array of unique keys to retrieve stats for. If the function is called without it, it will fetch all stats. + * @returns A promise that resolves with an object which contains the current key-value pairs for each key specified in the input array, if they exist. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + */ getStatsAsync(keys?: string[]): Promise; + + /** + * Set stats to be saved to the designated cloud storage of the current player. + * + * @param stats An object containing a set of key-value pairs that should be persisted to cloud storage as stats, which can be surfaced or used in a + * variety of ways to benefit player engagement.The object must contain only numerical values - any non-numerical values will cause the entire modification to be rejected. + * @returns A promise that resolves when the input values are set. NOTE: The promise resolving does not necessarily mean that the input has already been persisted. + * Rather, it means that the data was validated and has been scheduled to be saved. It also guarantees that all values that were set are now available in player.getStatsAsync. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ setStatsAsync(stats: StatsObject): Promise; + + /** + * Increment stats saved in the designated cloud storage of the current player. + * + * @param increments An object containing a set of key-value pairs indicating how much to increment each stat in cloud storage. + * The object must contain only numerical values - any non-numerical values will cause the entire modification to be rejected. + * @returns A promise that resolves with an object which contains the updated key-value pairs for each key specified in the input dictionary. + * NOTE: The promise resolving does not necessarily mean that the changes have already been persisted. Rather, it means that the increments were + * valid and have been scheduled to be performed. It also guarantees that all values that were incremented are now available in player.getStatsAsync. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ incrementStatsAsync(increments: IncrementObject): Promise; + + /** + * Fetches an array of ConnectedPlayer objects containing information about players that are connected to the current player. + * @returns A promise that resolves with a list of connected player objects. NOTE: This promise will not resolve until FBInstant.startGameAsync() has resolved. + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + */ getConnectedPlayersAsync(): Promise; } interface Context { - getID(): string; + /** + * A unique identifier for the current game context. This represents a specific context that the game is being played in + * (for example, a particular messenger conversation or facebook post). The identifier will be null if game is being played in + * a solo context. This function should not be called until FBInstant.startGameAsync has resolved. + * + * @returns A unique identifier for the current game context. + */ + getID(): string | null; + + /** + * The type of the current game context. POST - A facebook post. THREAD - A messenger thread. + * GROUP - A facebook group. SOLO - Default context, where the player is the only participant. + * This function should not be called until FBInstant.startGameAsync has resolved. + * + * @returns Type of the current game context + */ getType(): Type; - isSizeBetween(minSize: number, maxSize: number): ContextSizeResponse; + + /** + * This function determines whether the number of participants in the current game context is between a given minimum and maximum, inclusive. + * If one of the bounds is null only the other bound will be checked against. It will always return the original result for the first call made in + * a context in a given game play session. Subsequent calls, regardless of arguments, will return the answer to the original query until a context + * change occurs and the query result is reset. This function should not be called until FBInstant.startGameAsync has resolved. + * This will be null if one or both of the supplied arguments are not valid, if we do not have a size available for the current context, + * or if the API is called before startGameAsync() resolves. + * + * @param minSize The minimum bound of the context size query. + * @param maxSize The maximum bound of the context size query. + * @returns ContextSizeResponse + */ + isSizeBetween(minSize?: number, maxSize?: number): ContextSizeResponse | null; + + /** + * Request a switch into a specific context. If the player does not have permission to enter that context, + * or if the player does not provide permission for the game to enter that context, + * this will reject. Otherwise, the promise will resolve when the game has switched into the specified context. + * + * @param id ID of the desired context. + * @returns A promise that resolves when the game has switched into the specified context, or rejects otherwise. + * @throws INVALID_PARAM + * @throws SAME_CONTEXT + * @throws NETWORK_FAILURE + * @throws USER_INPUT + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ switchAsync(id: string): Promise; + + /** + * Opens a context selection dialog for the player. If the player selects an available context, the client will attempt to switch into that context, + * and resolve if successful. Otherwise, if the player exits the menu or the client fails to switch into the new context, this function will reject. + * + * @param options An object specifying conditions on the contexts that should be offered. + * @returns A promise that resolves when the game has switched into the context chosen by the user. Otherwise, the promise will reject (if the user cancels out of the dialog, for example). + * @throws INVALID_PARAM + * @throws SAME_CONTEXT + * @throws NETWORK_FAILURE + * @throws USER_INPUT + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ chooseAsync(options: ContextOptions): Promise; + + /** + * Attempts to create or switch into a context between a specified player and the current player. The returned promise will reject if the player listed is not a Connected Player of the current + * player or if the player does not provide permission to enter the new context. Otherwise, the promise will resolve when the game has switched into the new context. + * + * @param playerID ID of the player + * @returns A promise that resolves when the game has switched into the new context, or rejects otherwise. + * @throws INVALID_PARAM + * @throws SAME_CONTEXT + * @throws NETWORK_FAILURE + * @throws USER_INPUT + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ createAsync(playerID: string): Promise; + + /** + * Gets an array of ContextPlayer objects containing information about active players — people who actively played the game in the current context in the last 90 days. + * This may include the current player. + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws INVALID_OPERATION + */ getPlayersAsync(): Promise; } + /** + * An Instant Game leaderboard + */ interface Leaderboard { + /** + * The name of the leaderboard. + */ getName(): string; - getContextID(): string; + + /** + * The ID of the context that the leaderboard is associated with, or null if the leaderboard is not tied to a particular context. + */ + getContextID(): string | null; + + /** + * Fetches the total number of player entries in the leaderboard. + * + * @returns A unique identifier for the player. + * @throws NETWORK_FAILURE + * @throws RATE_LIMITED + */ getEntryCountAsync(): Promise; + + /** + * Updates the player's score. If the player has an existing score, the old score will only be replaced if the new score is better than it. + * NOTE: If the leaderboard is associated with a specific context, the game must be in that context to set a score for the player. + * + * @param score The new score for the player. Must be a 64-bit integer number. + * @param extraData Metadata to associate with the stored score. Must be less than 2KB in size. + * @returns Resolves with the current leaderboard entry for the player after the update. + * @throws LEADERBOARD_WRONG_CONTEXT + * @throws NETWORK_FAILURE + * @throws INVALID_PARAM + * @throws INVALID_OPERATION + * @throws RATE_LIMITED + */ setScoreAsync(score: number, extraData: string): Promise; - getPlayerEntryAsync(): Promise; + + /** + * Retrieves the leaderboard's entry for the current player, or null if the player has not set one yet. + * + * @returns Resolves with the current leaderboard entry for the player. + * @throws NETWORK_FAILURE + * @throws INVALID_OPERATION + * @throws RATE_LIMITED + */ + getPlayerEntryAsync(): Promise; + + /** + * Retrieves a set of leaderboard entries, ordered by score ranking in the leaderboard. + * + * @param count The number of entries to attempt to fetch from the leaderboard. Defaults to 10 if not specified. Up to a maximum of 100 entries may be fetched per query. + * @param offset The offset from the top of the leaderboard that entries will be fetched from. + * @returns Resolves with the leaderboard entries that match the query. + * @throws NETWORK_FAILURE + * @throws RATE_LIMITED + */ getEntriesAsync(count: number, offset: number): Promise; + + /** + * Retrieves the leaderboard score entries of the current player's connected players (including the current player), ordered by local rank within the set of connected players. + * @param count The number of entries to attempt to fetch from the leaderboard. Defaults to 10 if not specified. Currently, up to a maximum of 100 entries may be fetched per query. + * @param offset The offset from the set of ordered connected player score entries to fetch from. + * @returns Resolves with the leaderboard entries that match the query. + */ + getConnectedPlayerEntriesAsync(count: number, offset: number): Promise; } + /** + * A score entry for an Instant Game leaderboard + */ interface LeaderboardEntry { + /** + * Gets the score associated with the entry. + * @returns Returns an integer score value. + */ getScore(): number; + + /** + * Gets the score associated with the entry, formatted with the score format associated with the leaderboard. + * @returns Returns a formatted score. + */ getFormattedScore(): string; + + /** + * Gets the timestamp of when the leaderboard entry was last updated. + * @returns Returns a Unix timestamp. + */ getTimestamp(): number; + + /** + * Gets the rank of the player's score in the leaderboard + * @returns Returns the entry's leaderboard ranking. + */ getRank(): number; - getExtraData(): string; + + /** + * Gets the developer-specified payload associated with the score, or null if one was not set. + * @returns An optional developer-specified payload associated with the score. + */ + getExtraData(): string | null; + + /** + * Gets information about the player associated with the entry. + */ getPlayer(): LeaderboardPlayer; } + /** + * Details about the player associated with a score entry. + */ interface LeaderboardPlayer { + /** + * Gets the player's localized display name. + * + * @returns The player's localized display name. + */ getName(): string; - getPhoto(): string; - getID(): string; + + /** + * Returns a url to the player's public profile photo. + * + * @returns Url to the player's public profile photo. + */ + getPhoto(): string | null; + + /** + * Gets the game's unique identifier for the player. + * + * @returns The game-scoped identifier for the player. + */ + getID(): string | null; } + /** + * Represents information about a player who is connected to the current player. + */ interface ConnectedPlayer { + /** + * Get the id of the connected player. + * + * @returns The ID of the connected player + */ getID(): string; - getName(): string; - getPhoto(): string; + + /** + * Get the player's full name. + * + * @returns The player's full name + */ + getName(): string | null; + + /** + * Get the player's public profile photo. + * + * @returns A url to the player's public profile photo + */ + getPhoto(): string | null; } + /** + * Represents information about the player along with a signature to verify that it indeed comes from Facebook. + */ interface SignedPlayerInfo { + /** + * Get the id of the player. + * @returns The ID of the player + */ getPlayerID(): string; + + /** + * A signature to verify this object indeed comes from Facebook. The string is base64url encoded and signed with an HMAC version of your App Secret, + * based on the OAuth 2.0 spec. + * + * You can validate it with the following 4 steps: + * + * Split the signature into two parts delimited by the '.' character. + * + * Decode the first part (the encoded signature) with base64url encoding. + * + * Decode the second part (the response payload) with base64url encoding, which should be a string representation of a JSON object that has the following fields: + * ** algorithm - always equals to HMAC-SHA256 + * ** issued_at - a unix timestamp of when this response was issued. + * ** player_id - unique identifier of the player. + * ** request_payload - the requestPayload string you specified when calling FBInstant.player.getSignedPlayerInfoAsync. + * + * Hash the whole response payload string using HMAC SHA-256 and your app secret and confirm that it is equal to the encoded signature. + * + * You may also wish to validate the issued_at timestamp in the response payload to ensure the request was made recently. + * + * Signature validation should only happen on your server. Never do it on the client side as it will compromise your app secret key. + * + * @returns The signature string. + */ getSignature(): string; } + /** + * Represents information about a player who is in the context that the current player is playing in. + */ interface ContextPlayer { + /** + * Get the id of the context player. + * + * @returns The ID of the context player + */ getID(): string; - getName(): string; - getPhoto(): string; + + /** + * Get the player's localized display name. + * + * @returns The player's localized display name. + */ + getName(): string | null; + + /** + * Get the player's public profile photo. + * + * @returns A url to the player's public profile photo + */ + getPhoto(): string | null; } + /** + * Represents an instance of an ad. + */ interface AdInstance { + /** + * Return the Audience Network placement ID of this ad instance. + */ getPlacementID(): string; + + /** + * Preload the ad. The returned promise resolves when the preload completes, and rejects if it failed. + * @throws ADS_FREQUENT_LOAD + * @throws ADS_NO_FILL + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + */ loadAsync(): Promise; + + /** + * Present the ad. The returned promise resolves when user finished watching the ad, and rejects if it failed to present or was closed during the ad. + * @throws ADS_NOT_LOADED + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws INVALID_OPERATION + */ showAsync(): Promise; } interface Payments { + /** + * Fetches the game's product catalog. + * + * @returns The set of products that are registered to the game. + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws PAYMENTS_NOT_INITIALIZED + * @throws NETWORK_FAILURE + */ + getCatalogAsync(): Promise; + + /** + * Begins the purchase flow for a specific product. Will immediately reject if called before FBInstant.startGameAsync() has resolved. + * + * @param purchaseConfig The purchase's configuration details. + * @returns A Promise that resolves when the product is successfully purchased by the player. Otherwise, it rejects. + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws PAYMENTS_NOT_INITIALIZED + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws INVALID_OPERATION + */ purchaseAsync(purchaseConfig: PurchaseConfig): Promise; + + /** + * Fetches all of the player's unconsumed purchases. As a best practice, the game should fetch the current player's purchases + * as soon as the client indicates that it is ready to perform payments-related operations. The game can then process and consume + * any purchases that are waiting to be consumed. + * + * @returns The set of purchases that the player has made for the game. + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws PAYMENTS_NOT_INITIALIZED + * @throws NETWORK_FAILURE + */ getPurchasesAsync(): Promise; + + /** + * Consumes a specific purchase belonging to the current player. Before provisioning a product's effects to the player, + * the game should request the consumption of the purchased product. Once the purchase is successfully consumed, the game + * should immediately provide the player with the effects of their purchase. + * + * @param purchaseToken The purchase token of the purchase that should be consumed. + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws PAYMENTS_NOT_INITIALIZED + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + */ consumePurchaseAsync(purchaseToken: string): Promise; + + /** + * Sets a callback to be triggered when Payments operations are available. + * @param callback The callback function to be executed when Payments are available. + */ onReady(callback: () => void): void; } + /** + * Represents a game's product information. + */ interface Product { + /** + * The title of the product + */ title: string; + + /** + * he product's game-specified identifier + */ productID: string; + + /** + * The product description + */ description?: string; + + /** + * A link to the product's associated image + */ imageURI?: string; + + /** + * The price of the product + */ price: string; + + /** + * The currency code for the product + */ priceCurrencyCode: string; } + /** + * The answer field is true if the current context size is between the minSize and maxSize values that are specified in the object, and false otherwise. + */ interface ContextSizeResponse { answer: boolean; minSize?: number; maxSize?: number; } + /** + * Represents an individual purchase of a game product. + */ interface Purchase { + /** + * A developer-specified string, provided during the purchase of the product + */ developerPayload?: string; + + /** + * The identifier for the purchase transaction + */ paymentID: string; + + /** + * The product's game-specified identifier + */ productID: string; + + /** + * Unix timestamp of when the purchase occurred + */ purchaseTime: string; + + /** + * A token representing the purchase that may be used to consume the purchase + */ purchaseToken: string; + + /** + * Server-signed encoding of the purchase request + */ signedRequest: SignedPurchaseRequest; } interface ContextOptions { + /** + * The set of filters to apply to the context suggestions. + */ filters?: ContextFilter[]; + + /** + * The maximum number of participants that a suggested context should ideally have. + */ maxSize?: number; + + /** + * The minimum number of participants that a suggested context should ideally have. + */ minSize?: number; } + /** + * Represents content to be shared by the user. + */ interface SharePayload { - intent?: Intent; - image?: string; - text?: string; + /** + * Indicates the intent of the share. + */ + intent: Intent; + + /** + * A base64 encoded image to be shared. + */ + image: string; + + /** + * A text message to be shared. + */ + text: string; + + /** + * A blob of data to attach to the share. All game sessions launched from the share will be able to access this blob through FBInstant.getEntryPointData(). + */ data?: any; } + /** + * An API Error returned by the Instant Games SDK + */ interface APIError { + /** + * The relevant error code + */ code: ErrorCodeType; + /** + * A message describing the error + */ message: string; } + /** + * The configuration of a purchase request for a product registered to the game. + */ interface PurchaseConfig { + /** + * The identifier of the product to purchase + */ productID: string; + + /** + * An optional developer-specified payload, to be included in the returned purchase's signed request. + */ developerPayload?: string; } - interface UpdatePayload { - action?: UpdateAction; - template?: string; + /** + * Represents a custom update for FBInstant.updateAsync. + */ + interface CustomUpdatePayload { + /** + * For custom updates, this should be 'CUSTOM'. + */ + action: UpdateAction; + + /** + * ID of the template this custom update is using. Templates should be predefined in fbapp-config.json. + * See the [Bundle Config documentation]https://developers.facebook.com/docs/games/instant-games/bundle-config + * or documentation about fbapp-config.json. + */ + template: string; + + /** + * Optional call-to-action button text. By default we will use a localized 'Play' as the button text. To provide localized + * versions of your own call to action, pass an object with the default cta as the value of 'default' and another object mapping + * locale keys to translations as the value of 'localizations'. + */ cta?: (string | LocalizableContent); - image?: string; - text?: (string | LocalizableContent); + + /** + * Data URL of a base64 encoded image. + */ + image: string; + + /** + * A text message, or an object with the default text as the value of 'default' and another object mapping locale keys to + * translations as the value of 'localizations'. + */ + text: (string | LocalizableContent); + + /** + * A blob of data to attach to the update. All game sessions launched from the update will be able to access this blob + * through FBInstant.getEntryPointData(). Must be less than or equal to 1000 characters when stringified. + */ data?: any; + + /** + * Specifies how the update should be delivered. This can be one of the following: + * + * 'IMMEDIATE' - The update should be posted immediately. + * + * 'LAST' - The update should be posted when the game session ends. The most recent update sent using the 'LAST' strategy will be the one sent. + * + * 'IMMEDIATE_CLEAR' - The update is posted immediately, and clears any other pending updates (such as those sent with the 'LAST' strategy). + * + * If no strategy is specified, we default to 'IMMEDIATE'. + */ strategy?: string; + + /** + * Specifies notification setting for the custom update. This can be 'NO_PUSH' or 'PUSH', and defaults to 'NO_PUSH'. + * Use push notification only for updates that are high-signal and immediately actionable for the recipients. + * Also note that push notification is not always guaranteed, depending on user setting and platform policies. + */ notification?: string; } + /** + * Represents a leaderboard update for FBInstant.updateAsync. + */ interface LeaderboardUpdatePayload { + /** + * For a leaderboard update, this should be 'LEADERBOARD'. text. By default we will use a localized 'Play Now' as the button text. + */ action: UpdateAction; + + /** + * The name of the leaderboard to feature in the update. + */ name: string; + + /** + * Optional text message. If not specified, a localized fallback message will be provided instead. + */ text?: string; } + /** + * Represents a string with localizations and a default value to fall back on. + */ interface LocalizableContent { + /** + * The default value of the string to use if the viewer's locale is not a key in the localizations object. + */ default: string; + /** + * Specifies what string to use for viewers in each locale. See https://origincache.facebook.com/developers/resources/?id=FacebookLocales.xml for a complete list of supported locale values. + */ localizations: LocalizationsDict; } - interface DataObject { [ key: string ]: string | number; } + interface DataObject { [ key: string ]: any; } interface StatsObject { [ key: string ]: number; } interface IncrementObject { [ key: string ]: number; } - type LocalizationsDict = any; + /** + * Represents a mapping from locales to translations of a given string. Each property is an optional five-character Facebook locale code of the form xx_XX. + * See https://origincache.facebook.com/developers/resources/?id=FacebookLocales.xml for a complete list of supported locale codes. + */ + interface LocalizationsDict { + [x: string]: string; + } type SignedPurchaseRequest = string; + /** + * A filter that may be applied to a Context Choose operation + * 'NEW_CONTEXT_ONLY' - Prefer to only surface contexts the game has not been played in before. + * 'INCLUDE_EXISTING_CHALLENGES' - Include the "Existing Challenges" section, which surfaces actively played-in contexts that the player is a part of. + * 'NEW_PLAYERS_ONLY' - In sections containing individuals, prefer people who have not played the game. + */ type ContextFilter = "NEW_CONTEXT_ONLY" | "INCLUDE_EXISTING_CHALLENGES" | "NEW_PLAYERS_ONLY"; + /** + * Represents the type of the update action to perform. + * + * "CUSTOM": A custom update, with all content specified by the game. + * "LEADERBOARD": An update associated with an Instant Game leaderboard. + */ type UpdateAction = "CUSTOM" | "LEADERBOARD"; + /** + * Represents the current platform that the user is playing on. + */ type Platform = "IOS" | "ANDROID" | "WEB" | "MOBILE_WEB"; type Type = "POST" | "THREAD" | "GROUP" | "SOLO"; @@ -202,20 +1079,20 @@ declare namespace FBInstant { type Intent = "INVITE" | "REQUEST" | "CHALLENGE" | "SHARE"; type ErrorCodeType = "ADS_FREQUENT_LOAD" | - "ADS_NO_FILL" | - "ADS_NOT_LOADED" | - "ADS_TOO_MANY_INSTANCES" | - "ANALYTICS_POST_EXCEPTION" | - "CLIENT_REQUIRES_UPDATE" | - "CLIENT_UNSUPPORTED_OPERATION" | - "INVALID_OPERATION" | - "INVALID_PARAM" | - "LEADERBOARD_NOT_FOUND" | - "LEADERBOARD_WRONG_CONTEXT" | - "NETWORK_FAILURE" | - "PENDING_REQUEST" | - "RATE_LIMITED" | - "SAME_CONTEXT" | - "UNKNOWN" | - "USER_INPUT"; + "ADS_NO_FILL" | + "ADS_NOT_LOADED" | + "ADS_TOO_MANY_INSTANCES" | + "ANALYTICS_POST_EXCEPTION" | + "CLIENT_REQUIRES_UPDATE" | + "CLIENT_UNSUPPORTED_OPERATION" | + "INVALID_OPERATION" | + "INVALID_PARAM" | + "LEADERBOARD_NOT_FOUND" | + "LEADERBOARD_WRONG_CONTEXT" | + "NETWORK_FAILURE" | + "PENDING_REQUEST" | + "RATE_LIMITED" | + "SAME_CONTEXT" | + "UNKNOWN" | + "USER_INPUT"; } diff --git a/types/favicons/favicons-tests.ts b/types/favicons/favicons-tests.ts new file mode 100644 index 0000000000..485ea1d505 --- /dev/null +++ b/types/favicons/favicons-tests.ts @@ -0,0 +1,28 @@ +import favicons, { Configuration } from "favicons"; + +let config: Partial = { + path: "/foo/bar" +}; + +config = { + icons: { + android: true + } +}; + +let html = ""; +favicons("path/to/file.png", config, (err, res) => { + html = res.html.join(""); + + for (const { name, contents } of [...res.files, ...res.images]) { + html = name + contents.toString(); + } +}); + +favicons("file.png", (err, res) => { + html = res.html.join(""); + + for (const { name, contents } of [...res.files, ...res.images]) { + html = name + contents.toString(); + } +}); diff --git a/types/favicons/index.d.ts b/types/favicons/index.d.ts new file mode 100644 index 0000000000..47a9a9d24a --- /dev/null +++ b/types/favicons/index.d.ts @@ -0,0 +1,93 @@ +// Type definitions for favicons 5.1 +// Project: https://github.com/evilebottnawi/favicons/blob/master/package.json +// Definitions by: Mohsen Azimi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +export interface Configuration { + /** Path for overriding default icons path @default "/" */ + path: string; + /** Your application's name @default null */ + appName: string | null; + /** Your application's description @default null */ + appDescription: string | null; + /** Your (or your developer's) name @default null */ + developerName: string | null; + /** Your (or your developer's) URL @default null */ + developerURL: string | null; + /** Primary text direction for name, short_name, and description @default "auto" */ + dir: string; + /** Primary language for name and short_name @default "en-US */ + lang: string; + /** Background colour for flattened icons @default "#fff" */ + background: string; + /** Theme color user for example in Android's task switcher @default "#fff" */ + theme_color: string; + /** Preferred display mode: "fullscreen", "standalone", "minimal-ui" or "browser" @default "standalone" */ + display: "fullscreen" | "standalone" | "minimal-ui" | "browser"; + /** Default orientation: "any", "natural", "portrait" or "landscape" @default "any" */ + orientation: "any" | "natural" | "portrait" | "landscape"; + /** Start URL when launching the application from a device @default "/?homescreen=1" */ + start_url: string; + /** Your application's version string @default "1.0" */ + version: string; + /** Print logs to console? @default false */ + logging: boolean; + /** + * Platform Options: + * - offset - offset in percentage + * - background: + * * false - use default + * * true - force use default, e.g. set background for Android icons + * * color - set background for the specified icons + */ + icons: Partial<{ + /* Create Android homescreen icon. */ + android: boolean | { offset: string; background: string }; + /* Create Apple touch icons. */ + appleIcon: boolean | { offset: string; background: string }; + /* Create Apple startup images. */ + appleStartup: boolean | { offset: string; background: string }; + /* Create Opera Coast icon. */ + coast: boolean | { offset: string; background: string }; + /* Create regular favicons. */ + favicons: boolean; + /* Create Firefox OS icons. */ + firefox: boolean | { offset: string; background: string }; + /* Create Windows 8 tile icons. */ + windows: boolean | { background: string }; + /* Create Yandex browser icon. */ + yandex: boolean | { background: string }; + }>; +} + +export interface FavIconResponse { + images: Array<{ name: string; contents: Buffer }>; + files: Array<{ name: string; contents: Buffer }>; + html: string[]; +} + +export type Callback = (error: Error | null, response: FavIconResponse) => void; + +/** You can programmatically access Favicons configuration (icon filenames, HTML, manifest files, etc) with this export */ +export const config: Configuration; + +/** + * Generate favicons + * @param source Source image(s) + * @param configuration + * @param callback + */ +declare function favicons( + source: string | Buffer | string[], + callback?: Callback +): void; +declare function favicons( + source: string | Buffer | string[], + configuration?: Partial, + callback?: Callback +): void; + +export default favicons; diff --git a/types/favicons/tsconfig.json b/types/favicons/tsconfig.json new file mode 100644 index 0000000000..03d0b43577 --- /dev/null +++ b/types/favicons/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "favicons-tests.ts"] +} diff --git a/types/favicons/tslint.json b/types/favicons/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/favicons/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/firebird/tsconfig.json b/types/firebird/tsconfig.json index e5e2d1b6ac..ad3f26314d 100644 --- a/types/firebird/tsconfig.json +++ b/types/firebird/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "scripthost" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/gl-texture2d/gl-texture2d-tests.ts b/types/gl-texture2d/gl-texture2d-tests.ts index f51046f420..2f19753538 100644 --- a/types/gl-texture2d/gl-texture2d-tests.ts +++ b/types/gl-texture2d/gl-texture2d-tests.ts @@ -54,11 +54,20 @@ texture2d(gl, ndarray([1, 2, 3])); const texture = texture2d(gl, canvas); -texture.bind(); -texture.bind(1); texture.dispose(); texture.generateMipmap(); +texture.bind(); +texture.bind(1); + +texture.setPixels(canvas); +texture.setPixels(video); +texture.setPixels(image); +texture.setPixels(imageData); +texture.setPixels(ndarray([1, 2, 3])); +texture.setPixels(canvas, [1, 1]); +texture.setPixels(canvas, [1, 1], 0); + texture.magFilter = 1; texture.minFilter = 1; texture.mipSamples = 1; diff --git a/types/gl-texture2d/index.d.ts b/types/gl-texture2d/index.d.ts index 2b44b9985a..4d979d99f9 100644 --- a/types/gl-texture2d/index.d.ts +++ b/types/gl-texture2d/index.d.ts @@ -29,6 +29,7 @@ declare class Texture { bind(id?: number): number; dispose(): void; generateMipmap(): void; + setPixels(data: InputType | RawObject | ndarray, offset?: [number, number], mipLevel?: GLenum): void; } declare function texture2d(gl: WebGLRenderingContext, array: ndarray): Texture; diff --git a/types/google-apps-script/google-apps-script.spreadsheet.d.ts b/types/google-apps-script/google-apps-script.spreadsheet.d.ts index b656032a96..dd2bc1d9f3 100644 --- a/types/google-apps-script/google-apps-script.spreadsheet.d.ts +++ b/types/google-apps-script/google-apps-script.spreadsheet.d.ts @@ -1,7 +1,8 @@ -// Type definitions for Google Apps Script 2018-05-03 +// Type definitions for Google Apps Script 2018-05-23 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // linlex +// agektmr // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -22,6 +23,25 @@ declare namespace GoogleAppsScript { */ export enum BorderStyle { DOTTED, DASHED, SOLID } + /** + * Access boolean conditions in `ConditionalFormatRules`. Each conditional + * format rule may contain a single boolean condition. The boolean condition + * itself contains a boolean criteria (with values) and formatting settings. + * The criteria is evaluated against the content of a cell resulting in + * either a `true` or `false` value. If the criteria evaluates to `true`, + * the condition's formatting settings are applied to the cell. + */ + export interface BooleanCondition { + getBackground(): string; + getBold(): boolean; + getCriteriaType(): BooleanCriteria; + getCriteriaValue(): Object[]; + getFontColor(): string, + getItalic(): boolean; + getStrikethrough(): boolean; + getUnderline(): boolean; + } + /** * The chart's position within a sheet. Can be updated using the EmbeddedChart.modify() * function. @@ -588,6 +608,42 @@ declare namespace GoogleAppsScript { useAlternatingRowStyle(alternate: boolean): EmbeddedTableChartBuilder; } + /** + * Access gradient (color) conditions in `ConditionalFormatRuleApis`. Each + * conditional format rule may contain a single gradient condition. A + * gradient condition is defined by three points along a number scale (min, + * mid, and max), each of which has a color, a value, and a + * `InterpolationType`. The content of a cell is compared to the values in + * the number scale and the color applied to the cell is interpolated based + * on the cell content's proximity to the gradient condition min, mid, and + * max points. + * + * // Logs all the information inside gradient conditional format rules on * a sheet. + * var sheet = SpreadsheetApp.getActiveSheet(); + * var rules = sheet.getConditionalFormatRules(); + * for (int i = 0; i < rules.length; i++) { + * var gradient = rules[i].getGradientCondition(); + * Logger.log("The conditional format gradient information for rule %d:\n + * MinColor %s, MinType %s, MinValue %s, \n + * MidColor %s, MidType %s, MidValue %s, \n + * MaxColor %s, MaxType %s, MaxValue %s \n", i, + * gradient.getMinColor(), gradient.getMinType(), gradient.getMinValue(), + * gradient.getMidColor(), gradient.getMidType(), gradient.getMidValue(), + * gradient.getMaxColor(), gradient.getMaxType(), gradient.getMaxValue()); + * } + **/ + export interface GradientCondition { + getMaxColor(): string; + getMaxType(): InterpolationType; + getMaxValue(): string; + getMidColor(): string; + getMidType(): InterpolationType; + getMidValue(): string; + getMinColor(): string; + getMinType(): InterpolationType; + getMinValue(): string; + } + /** * Create, access and modify named ranges in a spreadsheet. * Named ranges are ranges that have associated string aliases. @@ -1244,7 +1300,7 @@ declare namespace GoogleAppsScript { /** * Sets the conditional format rule's gradient minpoint fields. */ - setGradientMinpointWithValue(color: string, type: SpreadsheetApp.InterpolationType, value: string): ConditionalFormatRuleBuilder; + setGradientMinpointWithValue(color: string, type: InterpolationType, value: string): ConditionalFormatRuleBuilder; /** * Sets text italics for the conditional format rule's format. diff --git a/types/h2o2/tsconfig.json b/types/h2o2/tsconfig.json index 767fa4e7b7..870a359f9b 100644 --- a/types/h2o2/tsconfig.json +++ b/types/h2o2/tsconfig.json @@ -25,6 +25,9 @@ ], "inert": [ "inert/v4" + ], + "wreck": [ + "wreck/v7" ] }, "noEmit": true, diff --git a/types/http-assert/index.d.ts b/types/http-assert/index.d.ts index aac93be123..e48d69fa59 100644 --- a/types/http-assert/index.d.ts +++ b/types/http-assert/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for http-assert 1.2 +// Type definitions for http-assert 1.3 // Project: https://github.com/jshttp/http-assert // Definitions by: jKey Lu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -10,6 +10,7 @@ * @param opts custom properties to attach to the error object */ declare function assert(value: any, status?: number, msg?: string, opts?: {}): void; +declare function assert(value: any, status?: number, opts?: {}): void; declare namespace assert { /** diff --git a/types/iferr/iferr-tests.ts b/types/iferr/iferr-tests.ts new file mode 100644 index 0000000000..f7377358cf --- /dev/null +++ b/types/iferr/iferr-tests.ts @@ -0,0 +1,38 @@ +/// + +import * as fs from "fs"; +import iferr = require("iferr"); + +const { tiferr, throwerr, printerr } = iferr; + +const { readFile } = fs; + +const errcb = (err: Error | undefined) => { throw err; }; + +readFile("test.txt", iferr(errcb, result => { + Buffer.from("test", "utf8") === result; +})); + +readFile("test.txt", "utf8", iferr(errcb, result => { + "test" === result; +})); + +readFile("test.txt", tiferr(errcb, result => { + Buffer.from("test", "utf8") === result; +})); + +readFile("test.txt", "utf8", tiferr(errcb, result => { + "test" === result; +})); + +readFile("test.txt", throwerr(result => { + Buffer.from("test", "utf8") === result; +})); + +readFile("test.txt", "utf8", throwerr(result => { + "test" === result; +})); + +readFile("test.txt", printerr); + +readFile("test.txt", "utf8", printerr); diff --git a/types/iferr/index.d.ts b/types/iferr/index.d.ts new file mode 100644 index 0000000000..c65c270b49 --- /dev/null +++ b/types/iferr/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for iferr 1.0 +// Project: https://github.com/shesek/iferr +// Definitions by: segayuu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type nodeCallback = (err: Error | undefined, ...a: T[]) => any; + +// Delegates to `succ` on sucecss or to `fail` on error +// ex: Thing.load(123, iferr(cb, thing => ...)) +declare function iferr(fail: (err: Error | undefined) => void, succ: (...result: T[]) => void): nodeCallback; + +declare namespace iferr { + // Delegates to `succ` on sucecss or to `fail` on error + // ex: Thing.load(123, iferr(cb, thing => ...)) + function iferr(fail: (err: Error | undefined) => void, succ: (...result: T[]) => void): nodeCallback; + + // Like iferr, but also catches errors thrown from `succ` and passes to `fail` + function tiferr(fail: (err: Error | undefined) => void, succ: (...result: T[]) => void): nodeCallback; + + // Delegate to the success function on success, throws the error otherwise + // ex: Thing.load(123, throwerr(thing => ...)) + function throwerr(succ: (...result: T[]) => void): nodeCallback; + + // Prints errors when one is passed, or does nothing otherwise + // ex: Thing.load(123, printerr) + function printerr(): nodeCallback; +} + +export = iferr; diff --git a/types/iferr/tsconfig.json b/types/iferr/tsconfig.json new file mode 100644 index 0000000000..db97bdf495 --- /dev/null +++ b/types/iferr/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "iferr-tests.ts" + ] +} diff --git a/types/iferr/tslint.json b/types/iferr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/iferr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/inert/index.d.ts b/types/inert/index.d.ts index d8c1d90422..3bcbb81a29 100644 --- a/types/inert/index.d.ts +++ b/types/inert/index.d.ts @@ -127,7 +127,7 @@ declare const inert: Plugin; export = inert; declare module 'hapi' { - interface RouteOptions { + interface HandlerDecorations { /** * The file handler * diff --git a/types/jquery-slugify/index.d.ts b/types/jquery-slugify/index.d.ts new file mode 100644 index 0000000000..2bb0da56e1 --- /dev/null +++ b/types/jquery-slugify/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for jquery-slugify 1.2 +// Project: https://github.com/madflow/jquery-slugify +// Definitions by: Anderson Friaça +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +export type Options = Partial<{ + preSlug: ((source: string) => string); + postSlug: ((source: string) => string); + slugFunc: ((input: string, options: Options) => string); + separator: string; + lang: string | boolean; + symbols: boolean; + maintainCase: boolean; + titleCase: string[] | boolean; + truncate: number; + uric: boolean; + uricNoSlash: boolean; + mark: boolean; + custom: string[]; +}>; + +declare global { + interface JQuery { + slugify(source: string, options?: Options): JQuery; + } + + interface JQueryStatic { + slugify(source: string, options?: Options): string; + } +} diff --git a/types/jquery-slugify/jquery-slugify-tests.ts b/types/jquery-slugify/jquery-slugify-tests.ts new file mode 100644 index 0000000000..af19a4b635 --- /dev/null +++ b/types/jquery-slugify/jquery-slugify-tests.ts @@ -0,0 +1,7 @@ +$.slugify("jquery slugify"); + +$('#slug-target').slugify('#slug-source'); + +$("#slug-target").slugify("#slug-source", { + separator: '_' +}); diff --git a/types/react-monaco-editor/tsconfig.json b/types/jquery-slugify/tsconfig.json similarity index 87% rename from types/react-monaco-editor/tsconfig.json rename to types/jquery-slugify/tsconfig.json index 8d55416feb..1b5b101efc 100644 --- a/types/react-monaco-editor/tsconfig.json +++ b/types/jquery-slugify/tsconfig.json @@ -16,10 +16,10 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, - "jsx": "react" + "esModuleInterop": true }, "files": [ "index.d.ts", - "react-monaco-editor-tests.tsx" + "jquery-slugify-tests.ts" ] } \ No newline at end of file diff --git a/types/jquery-slugify/tslint.json b/types/jquery-slugify/tslint.json new file mode 100644 index 0000000000..d04fe2e1fa --- /dev/null +++ b/types/jquery-slugify/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} \ No newline at end of file diff --git a/types/jszip/index.d.ts b/types/jszip/index.d.ts index bca2b6899c..ba3ea392c9 100644 --- a/types/jszip/index.d.ts +++ b/types/jszip/index.d.ts @@ -31,6 +31,7 @@ interface InputByType { uint8array: Uint8Array; arraybuffer: ArrayBuffer; blob: Blob; + stream: NodeJS.ReadableStream; } interface OutputByType { @@ -44,7 +45,7 @@ interface OutputByType { nodebuffer: Buffer; } -type InputFileFormat = InputByType[keyof InputByType] | NodeJS.ReadableStream; +type InputFileFormat = InputByType[keyof InputByType]; declare namespace JSZip { type InputType = keyof InputByType; diff --git a/types/jszip/jszip-tests.ts b/types/jszip/jszip-tests.ts index 5d332a8070..2910b5f729 100644 --- a/types/jszip/jszip-tests.ts +++ b/types/jszip/jszip-tests.ts @@ -1,5 +1,7 @@ import JSZip = require('jszip'); +import { Readable } from "stream"; + const SEVERITY = { DEBUG: 0, INFO: 1, @@ -10,9 +12,12 @@ const SEVERITY = { function createTestZip(): JSZip { const zip = new JSZip(); + const stream = new Readable(); + stream.push("test stream"); zip.file("test.txt", "test string"); zip.file("test", null, { dir: true }); zip.file("test/test.txt", "test string"); + zip.file("stream.txt", stream); return zip; } @@ -105,6 +110,14 @@ function testJSZip() { log(SEVERITY.ERROR, "wrong number of files"); } }).catch((e: any) => log(SEVERITY.ERROR, e)); + + newJszip.file("stream.txt").async('text').then((text: string) => { + if (text === "test stream") { + log(SEVERITY.INFO, "all ok"); + } else { + log(SEVERITY.ERROR, "no matching file found"); + } + }).catch((e: any) => log(SEVERITY.ERROR, e)); }).catch((e: any) => { console.error(e); }); } diff --git a/types/just-extend/index.d.ts b/types/just-extend/index.d.ts new file mode 100644 index 0000000000..7aceac4b35 --- /dev/null +++ b/types/just-extend/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for just-extend 1.1 +// Project: https://github.com/angus-c/just#readme +// Definitions by: Peter Safranek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare function extend(obj1: object, ...objn: any[]): object; + +declare function extend(deep: boolean, obj1: object, ...objn: any[]): object; + +export = extend; diff --git a/types/just-extend/just-extend-tests.ts b/types/just-extend/just-extend-tests.ts new file mode 100644 index 0000000000..74d5101430 --- /dev/null +++ b/types/just-extend/just-extend-tests.ts @@ -0,0 +1,52 @@ +import extend = require("just-extend"); + +// Pass single `object`. +extend({}); // $ExpectType object +extend([]); // $ExpectType object +extend(() => {}); // $ExpectType object + +// Pass single `object`, then `any`. +extend({}, 0); // $ExpectType object +extend({}, ""); // $ExpectType object +extend({}, false); // $ExpectType object +extend({}, null); // $ExpectType object +extend({}, undefined); // $ExpectType object +extend({}, {}); // $ExpectType object +extend({}, []); // $ExpectType object +extend({}, () => {}); // $ExpectType object + +// Pass variadic args. +extend({}, 0, "", false, null, undefined, {}, [], () => {}); // $ExpectType object + +// Pass `boolean`, then single `object`. +extend(true, {}); // $ExpectType object +extend(true, []); // $ExpectType object +extend(true, () => {}); // $ExpectType object + +// Pass `boolean`, single `object`, then `any`. +extend(true, {}, 0); // $ExpectType object +extend(true, {}, ""); // $ExpectType object +extend(true, {}, false); // $ExpectType object +extend(true, {}, null); // $ExpectType object +extend(true, {}, undefined); // $ExpectType object +extend(true, {}, {}); // $ExpectType object +extend(true, {}, []); // $ExpectType object +extend(true, {}, () => {}); // $ExpectType object + +// Pass `boolean`, then variadic args. +extend(true, {}, 0, "", false, null, undefined, {}, [], () => {}); // $ExpectType object + +// Incorrect extendee `object`. +extend(); // $ExpectError +extend(0); // $ExpectError +extend(""); // $ExpectError +extend(false); // $ExpectError +extend(null); // $ExpectError +extend(undefined); // $ExpectError + +// Pass `boolean` with incorrect extendee `object`. +extend(true, 0); // $ExpectError +extend(true, ""); // $ExpectError +extend(true, false); // $ExpectError +extend(true, null); // $ExpectError +extend(true, undefined); // $ExpectError diff --git a/types/just-extend/tsconfig.json b/types/just-extend/tsconfig.json new file mode 100644 index 0000000000..deec8db29c --- /dev/null +++ b/types/just-extend/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "just-extend-tests.ts" + ] +} diff --git a/types/just-extend/tslint.json b/types/just-extend/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/just-extend/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index aee22c16f1..6481b59faf 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -1,10 +1,12 @@ -// Type definitions for JW Player V8.0 +// Type definitions for JW Player V8.2 // Project: https://github.com/jwplayer/jwplayer/ // Definitions by: Martin Duparc // Tomer Kruvi // Philipp Gürtler // Daniel McGraw +// Benjamin Dobson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 // JW Player is the leading HTML5 & Flash video player, optimized for mobile and the desktop. Easy enough for beginners, advanced enough for pros. @@ -89,6 +91,12 @@ interface AdImpressionParam extends CallbackParam { wrapper: any[]; } +interface AdScheduleParam extends CallbackParam { + tag: string; + client: string; + adbreaks: object[]; +} + interface AdStartedParam extends CallbackParam { creativetype: string; tag: string; @@ -288,7 +296,11 @@ interface JWPlayer { once(event: 'adRequest', callback: EventCallback): void; off(event: 'adRequest'): void; trigger(event: 'adRequest', args: AdRequestParam): void; - on(event: 'adStarted', callback: EventCallback): void; + on(event: 'adSchedule', callback: EventCallback): void; + once(event: 'adSchedule', callback: EventCallback): void; + off(event: 'adSchedule'): void; + trigger(event: 'adSchedule', args: AdScheduleParam): void; + on(event: 'adStarted', callback: EventCallback): void; once(event: 'adStarted', callback: EventCallback): void; off(event: 'adStarted'): void; trigger(event: 'adStarted', args: AdStartedParam): void; @@ -424,7 +436,11 @@ interface JWPlayer { once(event: 'seek', callback: EventCallback): void; off(event: 'seek'): void; trigger(event: 'seek', args: SeekParam): void; - on(event: 'setupError', callback: EventCallback): void; + on(event: 'seeked', callback: () => void): void; + once(event: 'seeked', callback: () => void): void; + off(event: 'seeked'): void; + trigger(event: 'seeked'): void + on(event: 'setupError', callback: EventCallback): void; once(event: 'setupError', callback: EventCallback): void; off(event: 'setupError'): void; trigger(event: 'setupError', args: ErrorParam): void; diff --git a/types/karma-chai-sinon/index.d.ts b/types/karma-chai-sinon/index.d.ts index 76ee313a40..1ce2672b23 100644 --- a/types/karma-chai-sinon/index.d.ts +++ b/types/karma-chai-sinon/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/tubalmartin/karma-chai-sinon // Definitions by: Václav Ostrožlík // Definitions: https://github.com/borisyankov/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// import Sinon = require("sinon"); diff --git a/types/lazy-value/tsconfig.json b/types/lazy-value/tsconfig.json index e2e784e24f..caca4e6292 100644 --- a/types/lazy-value/tsconfig.json +++ b/types/lazy-value/tsconfig.json @@ -9,9 +9,7 @@ "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": [ "../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/loadjs/index.d.ts b/types/loadjs/index.d.ts new file mode 100644 index 0000000000..9373308815 --- /dev/null +++ b/types/loadjs/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for loadjs 3.5 +// Project: https://github.com/muicss/loadjs +// Definitions by: Christian Rackerseder +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +export as namespace loadjs; + +export = loadjs; + +declare function loadjs(files: string | string[], bundleIdOrLoaded: string | loadjs.LoadedFn): void; +declare function loadjs(files: string[], bundleId: string, optionsOrCallback: loadjs.LoadOptions | loadjs.LoadedFn): void; + +declare namespace loadjs { + type LoadedFn = () => void; + + interface LoadOptions { + before?(path: string, scriptEl: string): void; + success?(): void; + error?(depsNotFound: string): void; + async?: boolean; + numRetries?: number; + } + + interface ReadyOptions { + success?(): void; + error?(depsNotFound: string): void; + } + + function ready(bundleIds: string | string[], optionsOrCallback: ReadyOptions | LoadedFn): typeof loadjs; + function isDefined(bundleId: string): boolean; + function done(bundleId: string): void; + function reset(): void; +} diff --git a/types/loadjs/test/loadjs-tests.ts b/types/loadjs/test/loadjs-tests.ts new file mode 100644 index 0000000000..0b3aad142d --- /dev/null +++ b/types/loadjs/test/loadjs-tests.ts @@ -0,0 +1,23 @@ +import importedLoadJs = require('loadjs'); + +const loadOptions: importedLoadJs.LoadOptions = { + before: (path, scriptEl) => {}, + success: () => {}, + error: (pathsNotFound) => {}, + async: true, + numRetries: 3 +}; + +const readyOptions: importedLoadJs.ReadyOptions = { + success: () => {}, + error: (depsNotFound) => {}, +}; + +importedLoadJs('/path/to/foo.js', () => {}); +importedLoadJs(['/path/to/foo.js', '/path/to/bar.js'], () => {}); +importedLoadJs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar'); +importedLoadJs.ready('foobar', () => {}).ready('foobar', () => {}); +importedLoadJs.ready(['foo', 'bar'], () => {}).ready(['foo', 'bar'], () => {}); +importedLoadJs.isDefined('foobar'); +importedLoadJs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar', loadOptions); +importedLoadJs.ready('foobar', readyOptions); diff --git a/types/loadjs/test/loadjs-umd-tests.ts b/types/loadjs/test/loadjs-umd-tests.ts new file mode 100644 index 0000000000..94ee4f5090 --- /dev/null +++ b/types/loadjs/test/loadjs-umd-tests.ts @@ -0,0 +1,17 @@ +loadjs('/path/to/foo.js', () => {}); +loadjs(['/path/to/foo.js', '/path/to/bar.js'], () => {}); +loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar'); +loadjs.ready('foobar', () => {}).ready('foobar', () => {}); +loadjs.ready(['foo', 'bar'], () => {}).ready(['foo', 'bar'], () => {}); +loadjs.isDefined('foobar'); +loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar', { + before: (path, scriptEl) => {}, + success: () => {}, + error: (pathsNotFound) => {}, + async: true, + numRetries: 3 +}); +loadjs.ready('foobar', { + success: () => {}, + error: (depsNotFound) => {}, +}); diff --git a/types/loadjs/tsconfig.json b/types/loadjs/tsconfig.json new file mode 100644 index 0000000000..b60931cce6 --- /dev/null +++ b/types/loadjs/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "test/loadjs-tests.ts", + "test/loadjs-umd-tests.ts" + ] +} diff --git a/types/loadjs/tslint.json b/types/loadjs/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/loadjs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/lodash/common/array.d.ts b/types/lodash/common/array.d.ts index 5591bce088..6d4aff3056 100644 --- a/types/lodash/common/array.d.ts +++ b/types/lodash/common/array.d.ts @@ -929,28 +929,28 @@ declare module "../index" { // flattenDepth interface LoDashStatic { - /** - * Recursively flatten array up to depth times. - * - * @param array The array to recursively flatten. - * @param number The maximum recursion depth. - * @return Returns the new flattened array. - */ - flattenDepth(array: ListOfRecursiveArraysOrValues | null | undefined, depth?: number): T[]; + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + flattenDepth(array: ListOfRecursiveArraysOrValues | null | undefined, depth?: number): T[]; } interface LoDashImplicitWrapper { - /** - * @see _.flattenDeep - */ - flattenDepth(this: LoDashImplicitWrapper | null | undefined>, depth?: number): LoDashImplicitWrapper; + /** + * @see _.flattenDeep + */ + flattenDepth(this: LoDashImplicitWrapper | null | undefined>, depth?: number): LoDashImplicitWrapper; } interface LoDashExplicitWrapper { - /** - * @see _.flattenDeep - */ - flattenDepth(this: LoDashExplicitWrapper | null | undefined>, depth?: number): LoDashExplicitWrapper; + /** + * @see _.flattenDeep + */ + flattenDepth(this: LoDashExplicitWrapper | null | undefined>, depth?: number): LoDashExplicitWrapper; } // fromPairs diff --git a/types/lodash/common/common.d.ts b/types/lodash/common/common.d.ts index 28c4437073..d0856a006b 100644 --- a/types/lodash/common/common.d.ts +++ b/types/lodash/common/common.d.ts @@ -217,6 +217,8 @@ declare module "../index" { type PropertyName = string | number | symbol; type PropertyPath = Many; + type Omit = Pick; + /** Common interface between Arrays and jQuery objects */ type List = ArrayLike; diff --git a/types/lodash/common/object.d.ts b/types/lodash/common/object.d.ts index e0b1f3ebf1..5e2d539c23 100644 --- a/types/lodash/common/object.d.ts +++ b/types/lodash/common/object.d.ts @@ -2860,15 +2860,23 @@ declare module "../index" { */ omit( object: T | null | undefined, - ...paths: PropertyPath[] + ...paths: Array> ): T; + /** + * @see _.omit + */ + omit( + object: T | null | undefined, + ...paths: Array> + ): Omit; + /** * @see _.omit */ omit( object: T | null | undefined, - ...paths: PropertyPath[] + ...paths: Array> ): PartialObject; } @@ -2878,15 +2886,23 @@ declare module "../index" { */ omit( this: LoDashImplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashImplicitWrapper; + /** + * @see _.omit + */ + omit( + this: LoDashImplicitWrapper, + ...paths: Array> + ): LoDashImplicitWrapper>; + /** * @see _.omit */ omit( this: LoDashImplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashImplicitWrapper>; } @@ -2896,15 +2912,23 @@ declare module "../index" { */ omit( this: LoDashExplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashExplicitWrapper; + /** + * @see _.omit + */ + omit( + this: LoDashExplicitWrapper, + ...paths: Array> + ): LoDashExplicitWrapper>; + /** * @see _.omit */ omit( this: LoDashExplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashExplicitWrapper>; } diff --git a/types/lodash/fp.d.ts b/types/lodash/fp.d.ts index d577414aa4..da68ea250e 100644 --- a/types/lodash/fp.d.ts +++ b/types/lodash/fp.d.ts @@ -1,6 +1,6 @@ // AUTO-GENERATED: do not modify this file directly. // If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: -// npm run fp +// npm install && npm run generate import lodash = require("./index"); @@ -60,7 +60,14 @@ declare namespace _ { } type LodashAssign1x1 = (source: TSource) => TObject & TSource; type LodashAssign1x2 = (object: TObject) => TObject & TSource; - type LodashAssignAll = (object: ReadonlyArray) => any; + interface LodashAssignAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: [TObject]): TObject; + (object: ReadonlyArray): any; + } interface LodashAssignAllWith { (customizer: lodash.AssignCustomizer): LodashAssignAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashAssignAllWith1x2; @@ -75,7 +82,14 @@ declare namespace _ { } type LodashAssignIn1x1 = (source: TSource) => TObject & TSource; type LodashAssignIn1x2 = (object: TObject) => TObject & TSource; - type LodashAssignInAll = (object: ReadonlyArray) => TResult; + interface LodashAssignInAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: [TObject]): TObject; + (object: ReadonlyArray): TResult; + } interface LodashAssignInAllWith { (customizer: lodash.AssignCustomizer): LodashAssignInAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashAssignInAllWith1x2; @@ -453,7 +467,14 @@ declare namespace _ { } type LodashDefaults1x1 = (object: TObject) => TSource & TObject; type LodashDefaults1x2 = (source: TSource) => TSource & TObject; - type LodashDefaultsAll = (object: ReadonlyArray) => any; + interface LodashDefaultsAll { + (object: [TObject, TSource]): TSource & TObject; + (object: [TObject, TSource1, TSource2]): TSource2 & TSource1 & TObject; + (object: [TObject, TSource1, TSource2, TSource3]): TSource3 & TSource2 & TSource1 & TObject; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TSource4 & TSource3 & TSource2 & TSource1 & TObject; + (object: [TObject]): TObject; + (object: ReadonlyArray): any; + } interface LodashDefaultsDeep { (sources: any): LodashDefaultsDeep1x1; (sources: lodash.__, object: any): LodashDefaultsDeep1x2; @@ -546,11 +567,11 @@ declare namespace _ { type LodashDifferenceWith1x6 = (comparator: lodash.Comparator2) => T1[]; interface LodashUnset { (path: lodash.PropertyPath): LodashUnset1x1; - (path: lodash.__, object: any): LodashUnset1x2; - (path: lodash.PropertyPath, object: any): boolean; + (path: lodash.__, object: T): LodashUnset1x2; + (path: lodash.PropertyPath, object: T): T; } - type LodashUnset1x1 = (object: any) => boolean; - type LodashUnset1x2 = (path: lodash.PropertyPath) => boolean; + type LodashUnset1x1 = (object: T) => T; + type LodashUnset1x2 = (path: lodash.PropertyPath) => T; interface LodashDivide { (dividend: number): LodashDivide1x1; (dividend: lodash.__, divisor: number): LodashDivide1x2; @@ -704,7 +725,14 @@ declare namespace _ { } type LodashExtend1x1 = (source: TSource) => TObject & TSource; type LodashExtend1x2 = (object: TObject) => TObject & TSource; - type LodashExtendAll = (object: ReadonlyArray) => TResult; + interface LodashExtendAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: [TObject]): TObject; + (object: ReadonlyArray): TResult; + } interface LodashExtendAllWith { (customizer: lodash.AssignCustomizer): LodashExtendAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashExtendAllWith1x2; @@ -2171,7 +2199,13 @@ declare namespace _ { } type LodashMerge1x1 = (source: TSource) => TObject & TSource; type LodashMerge1x2 = (object: TObject) => TObject & TSource; - type LodashMergeAll = (object: ReadonlyArray) => any; + interface LodashMergeAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: ReadonlyArray): any; + } interface LodashMergeAllWith { (customizer: lodash.MergeWithCustomizer): LodashMergeAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashMergeAllWith1x2; @@ -2235,18 +2269,24 @@ declare namespace _ { type LodashNth1x2 = (n: number) => T | undefined; type LodashNthArg = (n: number) => (...args: any[]) => any; interface LodashOmit { - (paths: lodash.PropertyPath): LodashOmit1x1; + (paths: lodash.Many): LodashOmit1x1; (paths: lodash.__, object: T | null | undefined): LodashOmit1x2; - (paths: lodash.PropertyPath, object: T | null | undefined): T; + (paths: lodash.Many, object: T | null | undefined): T; + (paths: lodash.Many): LodashOmit2x1; (paths: lodash.__, object: T | null | undefined): LodashOmit2x2; - (paths: lodash.PropertyPath, object: T | null | undefined): lodash.PartialObject; + (paths: lodash.Many, object: T | null | undefined): lodash.Omit; + (paths: lodash.Many, object: T | null | undefined): lodash.PartialObject; } interface LodashOmit1x1 { (object: T | null | undefined): T; (object: T | null | undefined): lodash.PartialObject; } - type LodashOmit1x2 = (paths: lodash.PropertyPath) => T; - type LodashOmit2x2 = (paths: lodash.PropertyPath) => lodash.PartialObject; + type LodashOmit1x2 = (paths: lodash.Many) => T; + type LodashOmit2x1 = (object: T | null | undefined) => lodash.Omit; + interface LodashOmit2x2 { + (paths: lodash.Many): lodash.Omit; + (paths: lodash.Many): lodash.PartialObject; + } interface LodashOmitBy { (predicate: lodash.ValueKeyIteratee): LodashOmitBy1x1; (predicate: lodash.__, object: T | null | undefined): LodashOmitBy1x2; @@ -2435,21 +2475,252 @@ declare namespace _ { type LodashParseInt1x1 = (string: string) => number; type LodashParseInt1x2 = (radix: number) => number; interface LodashPartial { - (args: ReadonlyArray): LodashPartial1x1; - (args: lodash.__, func: (...args: any[]) => any): LodashPartial1x2; - (args: ReadonlyArray, func: (...args: any[]) => any): (...args: any[]) => any; + (func: lodash.Function1): LodashPartial1x1; + (func: lodash.__, arg1: [T1]): LodashPartial1x2; + (func: lodash.Function1, arg1: [T1]): lodash.Function0; + (func: lodash.Function2): LodashPartial2x1; + (func: lodash.Function2, arg1: [T1]): lodash.Function1< T2, R>; + (func: lodash.__, plc1: [lodash.__, T2]): LodashPartial3x2; + (func: lodash.Function2, plc1: [lodash.__, T2]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2]): LodashPartial4x2; + (func: lodash.Function2, arg1: [T1, T2]): lodash.Function0< R>; + (func: lodash.Function3): LodashPartial5x1; + (func: lodash.Function3, arg1: [T1]): lodash.Function2< T2, T3, R>; + (func: lodash.Function3, plc1: [lodash.__, T2]): lodash.Function2; + (func: lodash.Function3, arg1: [T1, T2]): lodash.Function1< T3, R>; + (func: lodash.__, plc1: [lodash.__, lodash.__, T3]): LodashPartial8x2; + (func: lodash.Function3, plc1: [lodash.__, lodash.__, T3]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3]): LodashPartial9x2; + (func: lodash.Function3, arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (func: lodash.__, plc1: [lodash.__, T2, T3]): LodashPartial10x2; + (func: lodash.Function3, plc1: [lodash.__, T2, T3]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3]): LodashPartial11x2; + (func: lodash.Function3, arg1: [T1, T2, T3]): lodash.Function0< R>; + (func: lodash.Function4): LodashPartial12x1; + (func: lodash.Function4, arg1: [T1]): lodash.Function3< T2, T3, T4, R>; + (func: lodash.Function4, plc1: [lodash.__, T2]): lodash.Function3; + (func: lodash.Function4, arg1: [T1, T2]): lodash.Function2< T3, T4, R>; + (func: lodash.Function4, plc1: [lodash.__, lodash.__, T3]): lodash.Function3; + (func: lodash.Function4, arg1: [T1, lodash.__, T3]): lodash.Function2< T2, T4, R>; + (func: lodash.Function4, plc1: [lodash.__, T2, T3]): lodash.Function2; + (func: lodash.Function4, arg1: [T1, T2, T3]): lodash.Function1< T4, R>; + (func: lodash.__, plc1: [lodash.__, lodash.__, lodash.__, T4]): LodashPartial19x2; + (func: lodash.Function4, plc1: [lodash.__, lodash.__, lodash.__, T4]): lodash.Function3; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__, T4]): LodashPartial20x2; + (func: lodash.Function4, arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (func: lodash.__, plc1: [lodash.__, T2, lodash.__, T4]): LodashPartial21x2; + (func: lodash.Function4, plc1: [lodash.__, T2, lodash.__, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, lodash.__, T4]): LodashPartial22x2; + (func: lodash.Function4, arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (func: lodash.__, plc1: [lodash.__, lodash.__, T3, T4]): LodashPartial23x2; + (func: lodash.Function4, plc1: [lodash.__, lodash.__, T3, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3, T4]): LodashPartial24x2; + (func: lodash.Function4, arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (func: lodash.__, plc1: [lodash.__, T2, T3, T4]): LodashPartial25x2; + (func: lodash.Function4, plc1: [lodash.__, T2, T3, T4]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3, T4]): LodashPartial26x2; + (func: lodash.Function4, arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + (func: (...args: any[]) => any): LodashPartial27x1; + (func: lodash.__, args: ReadonlyArray): LodashPartial27x2; + (func: (...args: any[]) => any, args: ReadonlyArray): (...args: any[]) => any; placeholder: lodash.__; } - type LodashPartial1x1 = (func: (...args: any[]) => any) => (...args: any[]) => any; - type LodashPartial1x2 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartial1x1 = (arg1: [T1]) => lodash.Function0; + interface LodashPartial1x2 { + (func: lodash.Function1): lodash.Function0; + (func: lodash.Function2): lodash.Function1< T2, R>; + (func: lodash.Function3): lodash.Function2< T2, T3, R>; + (func: lodash.Function4): lodash.Function3< T2, T3, T4, R>; + } + interface LodashPartial2x1 { + (arg1: [T1]): lodash.Function1< T2, R>; + (plc1: [lodash.__, T2]): lodash.Function1; + (arg1: [T1, T2]): lodash.Function0< R>; + } + interface LodashPartial3x2 { + (func: lodash.Function2): lodash.Function1; + (func: lodash.Function3): lodash.Function2; + (func: lodash.Function4): lodash.Function3; + } + interface LodashPartial4x2 { + (func: lodash.Function2): lodash.Function0< R>; + (func: lodash.Function3): lodash.Function1< T3, R>; + (func: lodash.Function4): lodash.Function2< T3, T4, R>; + } + interface LodashPartial5x1 { + (arg1: [T1]): lodash.Function2< T2, T3, R>; + (plc1: [lodash.__, T2]): lodash.Function2; + (arg1: [T1, T2]): lodash.Function1< T3, R>; + (plc1: [lodash.__, lodash.__, T3]): lodash.Function2; + (arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (plc1: [lodash.__, T2, T3]): lodash.Function1; + (arg1: [T1, T2, T3]): lodash.Function0< R>; + } + interface LodashPartial8x2 { + (func: lodash.Function3): lodash.Function2; + (func: lodash.Function4): lodash.Function3; + } + interface LodashPartial9x2 { + (func: lodash.Function3): lodash.Function1< T2, R>; + (func: lodash.Function4): lodash.Function2< T2, T4, R>; + } + interface LodashPartial10x2 { + (func: lodash.Function3): lodash.Function1; + (func: lodash.Function4): lodash.Function2; + } + interface LodashPartial11x2 { + (func: lodash.Function3): lodash.Function0< R>; + (func: lodash.Function4): lodash.Function1< T4, R>; + } + interface LodashPartial12x1 { + (arg1: [T1]): lodash.Function3< T2, T3, T4, R>; + (plc1: [lodash.__, T2]): lodash.Function3; + (arg1: [T1, T2]): lodash.Function2< T3, T4, R>; + (plc1: [lodash.__, lodash.__, T3]): lodash.Function3; + (arg1: [T1, lodash.__, T3]): lodash.Function2< T2, T4, R>; + (plc1: [lodash.__, T2, T3]): lodash.Function2; + (arg1: [T1, T2, T3]): lodash.Function1< T4, R>; + (plc1: [lodash.__, lodash.__, lodash.__, T4]): lodash.Function3; + (arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (plc1: [lodash.__, T2, lodash.__, T4]): lodash.Function2; + (arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (plc1: [lodash.__, lodash.__, T3, T4]): lodash.Function2; + (arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (plc1: [lodash.__, T2, T3, T4]): lodash.Function1; + (arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + } + type LodashPartial19x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartial20x2 = (func: lodash.Function4) => lodash.Function2< T2, T3, R>; + type LodashPartial21x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartial22x2 = (func: lodash.Function4) => lodash.Function1< T3, R>; + type LodashPartial23x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartial24x2 = (func: lodash.Function4) => lodash.Function1< T2, R>; + type LodashPartial25x2 = (func: lodash.Function4) => lodash.Function1; + type LodashPartial26x2 = (func: lodash.Function4) => lodash.Function0< R>; + type LodashPartial27x1 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartial27x2 = (func: (...args: any[]) => any) => (...args: any[]) => any; interface LodashPartialRight { - (args: ReadonlyArray): LodashPartialRight1x1; - (args: lodash.__, func: (...args: any[]) => any): LodashPartialRight1x2; - (args: ReadonlyArray, func: (...args: any[]) => any): (...args: any[]) => any; + (func: lodash.Function1): LodashPartialRight1x1; + (func: lodash.__, arg1: [T1]): LodashPartialRight1x2; + (func: lodash.Function1, arg1: [T1]): lodash.Function0; + (func: lodash.Function2): LodashPartialRight2x1; + (func: lodash.__, arg1: [T1, lodash.__]): LodashPartialRight2x2; + (func: lodash.Function2, arg1: [T1, lodash.__]): lodash.Function1< T2, R>; + (func: lodash.__, arg2: [T2]): LodashPartialRight3x2; + (func: lodash.Function2, arg2: [T2]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2]): LodashPartialRight4x2; + (func: lodash.Function2, arg1: [T1, T2]): lodash.Function0< R>; + (func: lodash.Function3): LodashPartialRight5x1; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__]): LodashPartialRight5x2; + (func: lodash.Function3, arg1: [T1, lodash.__, lodash.__]): lodash.Function2< T2, T3, R>; + (func: lodash.__, arg2: [T2, lodash.__]): LodashPartialRight6x2; + (func: lodash.Function3, arg2: [T2, lodash.__]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, lodash.__]): LodashPartialRight7x2; + (func: lodash.Function3, arg1: [T1, T2, lodash.__]): lodash.Function1< T3, R>; + (func: lodash.__, arg3: [T3]): LodashPartialRight8x2; + (func: lodash.Function3, arg3: [T3]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3]): LodashPartialRight9x2; + (func: lodash.Function3, arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (func: lodash.__, arg2: [T2, T3]): LodashPartialRight10x2; + (func: lodash.Function3, arg2: [T2, T3]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3]): LodashPartialRight11x2; + (func: lodash.Function3, arg1: [T1, T2, T3]): lodash.Function0< R>; + (func: lodash.Function4): LodashPartialRight12x1; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__, lodash.__]): LodashPartialRight12x2; + (func: lodash.Function4, arg1: [T1, lodash.__, lodash.__, lodash.__]): lodash.Function3< T2, T3, T4, R>; + (func: lodash.__, arg2: [T2, lodash.__, lodash.__]): LodashPartialRight13x2; + (func: lodash.Function4, arg2: [T2, lodash.__, lodash.__]): lodash.Function3; + (func: lodash.__, arg1: [T1, T2, lodash.__, lodash.__]): LodashPartialRight14x2; + (func: lodash.Function4, arg1: [T1, T2, lodash.__, lodash.__]): lodash.Function2< T3, T4, R>; + (func: lodash.__, arg3: [T3, lodash.__]): LodashPartialRight15x2; + (func: lodash.Function4, arg3: [T3, lodash.__]): lodash.Function3; + (func: lodash.__, arg1: [T1, lodash.__, T3, lodash.__]): LodashPartialRight16x2; + (func: lodash.Function4, arg1: [T1, lodash.__, T3, lodash.__]): lodash.Function2< T2, T4, R>; + (func: lodash.__, arg2: [T2, T3, lodash.__]): LodashPartialRight17x2; + (func: lodash.Function4, arg2: [T2, T3, lodash.__]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, T3, lodash.__]): LodashPartialRight18x2; + (func: lodash.Function4, arg1: [T1, T2, T3, lodash.__]): lodash.Function1< T4, R>; + (func: lodash.__, arg4: [T4]): LodashPartialRight19x2; + (func: lodash.Function4, arg4: [T4]): lodash.Function3; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__, T4]): LodashPartialRight20x2; + (func: lodash.Function4, arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (func: lodash.__, arg2: [T2, lodash.__, T4]): LodashPartialRight21x2; + (func: lodash.Function4, arg2: [T2, lodash.__, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, lodash.__, T4]): LodashPartialRight22x2; + (func: lodash.Function4, arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (func: lodash.__, arg3: [T3, T4]): LodashPartialRight23x2; + (func: lodash.Function4, arg3: [T3, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3, T4]): LodashPartialRight24x2; + (func: lodash.Function4, arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (func: lodash.__, arg2: [T2, T3, T4]): LodashPartialRight25x2; + (func: lodash.Function4, arg2: [T2, T3, T4]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3, T4]): LodashPartialRight26x2; + (func: lodash.Function4, arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + (func: (...args: any[]) => any): LodashPartialRight27x1; + (func: lodash.__, args: ReadonlyArray): LodashPartialRight27x2; + (func: (...args: any[]) => any, args: ReadonlyArray): (...args: any[]) => any; placeholder: lodash.__; } - type LodashPartialRight1x1 = (func: (...args: any[]) => any) => (...args: any[]) => any; - type LodashPartialRight1x2 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartialRight1x1 = (arg1: [T1]) => lodash.Function0; + type LodashPartialRight1x2 = (func: lodash.Function1) => lodash.Function0; + interface LodashPartialRight2x1 { + (arg1: [T1, lodash.__]): lodash.Function1< T2, R>; + (arg2: [T2]): lodash.Function1; + (arg1: [T1, T2]): lodash.Function0< R>; + } + type LodashPartialRight2x2 = (func: lodash.Function2) => lodash.Function1< T2, R>; + type LodashPartialRight3x2 = (func: lodash.Function2) => lodash.Function1; + type LodashPartialRight4x2 = (func: lodash.Function2) => lodash.Function0< R>; + interface LodashPartialRight5x1 { + (arg1: [T1, lodash.__, lodash.__]): lodash.Function2< T2, T3, R>; + (arg2: [T2, lodash.__]): lodash.Function2; + (arg1: [T1, T2, lodash.__]): lodash.Function1< T3, R>; + (arg3: [T3]): lodash.Function2; + (arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (arg2: [T2, T3]): lodash.Function1; + (arg1: [T1, T2, T3]): lodash.Function0< R>; + } + type LodashPartialRight5x2 = (func: lodash.Function3) => lodash.Function2< T2, T3, R>; + type LodashPartialRight6x2 = (func: lodash.Function3) => lodash.Function2; + type LodashPartialRight7x2 = (func: lodash.Function3) => lodash.Function1< T3, R>; + type LodashPartialRight8x2 = (func: lodash.Function3) => lodash.Function2; + type LodashPartialRight9x2 = (func: lodash.Function3) => lodash.Function1< T2, R>; + type LodashPartialRight10x2 = (func: lodash.Function3) => lodash.Function1; + type LodashPartialRight11x2 = (func: lodash.Function3) => lodash.Function0< R>; + interface LodashPartialRight12x1 { + (arg1: [T1, lodash.__, lodash.__, lodash.__]): lodash.Function3< T2, T3, T4, R>; + (arg2: [T2, lodash.__, lodash.__]): lodash.Function3; + (arg1: [T1, T2, lodash.__, lodash.__]): lodash.Function2< T3, T4, R>; + (arg3: [T3, lodash.__]): lodash.Function3; + (arg1: [T1, lodash.__, T3, lodash.__]): lodash.Function2< T2, T4, R>; + (arg2: [T2, T3, lodash.__]): lodash.Function2; + (arg1: [T1, T2, T3, lodash.__]): lodash.Function1< T4, R>; + (arg4: [T4]): lodash.Function3; + (arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (arg2: [T2, lodash.__, T4]): lodash.Function2; + (arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (arg3: [T3, T4]): lodash.Function2; + (arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (arg2: [T2, T3, T4]): lodash.Function1; + (arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + } + type LodashPartialRight12x2 = (func: lodash.Function4) => lodash.Function3< T2, T3, T4, R>; + type LodashPartialRight13x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartialRight14x2 = (func: lodash.Function4) => lodash.Function2< T3, T4, R>; + type LodashPartialRight15x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartialRight16x2 = (func: lodash.Function4) => lodash.Function2< T2, T4, R>; + type LodashPartialRight17x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartialRight18x2 = (func: lodash.Function4) => lodash.Function1< T4, R>; + type LodashPartialRight19x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartialRight20x2 = (func: lodash.Function4) => lodash.Function2< T2, T3, R>; + type LodashPartialRight21x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartialRight22x2 = (func: lodash.Function4) => lodash.Function1< T3, R>; + type LodashPartialRight23x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartialRight24x2 = (func: lodash.Function4) => lodash.Function1< T2, R>; + type LodashPartialRight25x2 = (func: lodash.Function4) => lodash.Function1; + type LodashPartialRight26x2 = (func: lodash.Function4) => lodash.Function0< R>; + type LodashPartialRight27x1 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartialRight27x2 = (func: (...args: any[]) => any) => (...args: any[]) => any; interface LodashPartition { (callback: lodash.ValueIteratee): LodashPartition1x1; (callback: lodash.__, collection: lodash.List | null | undefined): LodashPartition1x2; @@ -4055,7 +4326,13 @@ declare namespace _ { } type LodashZip1x1 = (arrays2: lodash.List) => Array<[T1 | undefined, T2 | undefined]>; type LodashZip1x2 = (arrays1: lodash.List) => Array<[T1 | undefined, T2 | undefined]>; - type LodashZipAll = (arrays: ReadonlyArray | null | undefined>) => Array>; + interface LodashZipAll { + (arrays1: [lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined]>; + (arrays1: [lodash.List, lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined, T3 | undefined]>; + (arrays1: [lodash.List, lodash.List, lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined]>; + (arrays1: [lodash.List, lodash.List, lodash.List, lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined, T5 | undefined]>; + (arrays: ReadonlyArray | null | undefined>): Array>; + } interface LodashZipObject { (props: lodash.List): LodashZipObject1x1; (props: lodash.__, values: lodash.List): LodashZipObject1x2; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index fbb164c4c5..88a5a88bfc 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -9,6 +9,20 @@ interface AbcObject { c: boolean; } +const abcObject: AbcObject = anything; +const array: AbcObject[] | null | undefined = anything; +const list: _.List | null | undefined = anything; +const dictionary: _.Dictionary | null | undefined = anything; +const numericDictionary: _.NumericDictionary | null | undefined = anything; +const arrayParam: AbcObject[] = []; +const listParam: _.List = []; +const comparator = (a: AbcObject, b: AbcObject) => true; +const listIterator = (value: AbcObject, index: number, collection: _.List) => true; +const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; +const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; +const valueIterator = (value: AbcObject) => true; +const stringIterator = (value: string) => ""; + // Wrapped array shortcut methods _([1, 2, 3, 4]).pop(); // $ExpectType number | undefined _([1, 2, 3, 4]).push(5, 6, 7); // $ExpectType LoDashImplicitWrapper @@ -32,8 +46,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.chunk(list); // $ExpectType AbcObject[][] _.chunk(list, 42); // $ExpectType AbcObject[][] @@ -60,10 +72,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const arrayParam: AbcObject[] = []; - const listParam: _.List = []; - _.difference(list); // $ExpectType AbcObject[] _.difference(list, listParam); // $ExpectType AbcObject[] _.difference(list, listParam, arrayParam, listParam); // $ExpectType AbcObject[] @@ -82,19 +90,14 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const arrayParam: AbcObject[] = []; - const listParam: _.List = []; - const iteratee = (value: AbcObject) => 1; - _.differenceBy(list); // $ExpectType AbcObject[] _.differenceBy(list, listParam); // $ExpectType AbcObject[] _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType AbcObject[] - _.differenceBy(list, listParam, iteratee); // $ExpectType AbcObject[] - _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, valueIterator); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); // $ExpectType AbcObject[] // $ExpectType AbcObject[] - _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); + _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); _.differenceBy(list, listParam, "a"); // $ExpectType AbcObject[] _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType AbcObject[] @@ -109,10 +112,10 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType LoDashImplicitWrapper - _(list).differenceBy(listParam, iteratee); // $ExpectType LoDashImplicitWrapper - _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, valueIterator); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper - _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); + _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); _(list).differenceBy(listParam, "a"); // $ExpectType LoDashImplicitWrapper _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType LoDashImplicitWrapper @@ -127,10 +130,10 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceBy(arrayParam, iteratee); // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, valueIterator); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); + _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, valueIterator); _.chain(list).differenceBy(arrayParam, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, "a"); // $ExpectType LoDashExplicitWrapper @@ -142,8 +145,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - fp.differenceBy(iteratee, list, arrayParam); // $ExpectType AbcObject[] - fp.differenceBy(iteratee)(list)(listParam); // $ExpectType AbcObject[] + fp.differenceBy(valueIterator, list, arrayParam); // $ExpectType AbcObject[] + fp.differenceBy(valueIterator)(list)(listParam); // $ExpectType AbcObject[] fp.differenceBy("a", list, arrayParam); // $ExpectType AbcObject[] fp.differenceBy({a: 1}, list, arrayParam); // $ExpectType AbcObject[] @@ -188,21 +191,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper { - value; // $ExpectType T1 | T2 | T3 - return 0; - }); - // $ExpectType T1[] - _.differenceBy([t1], [t2], [t3], [t4], (value) => { - value; // $ExpectType T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType T1[] - _.differenceBy([t1], [t2], [t3], [t4], [""], (value) => { - value; // $ExpectType string | T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType T1[] _.differenceBy([t1], [t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; @@ -226,21 +214,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _([t1]).differenceBy([t2], [t3], (value) => { - value; // $ExpectType T1 | T2 | T3 - return 0; - }); - // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], [t3], [t4], (value) => { - value; // $ExpectType T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], [t3], [t4], [""], (value) => { - value; // $ExpectType string | T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashImplicitWrapper _([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; @@ -264,21 +237,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], (value) => { - value; // $ExpectType T1 | T2 | T3 - return 0; - }); - // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], [t4], (value) => { - value; // $ExpectType T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], [t4], [""], (value) => { - value; // $ExpectType string | T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashExplicitWrapper _.chain([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; @@ -292,24 +250,13 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = [] as any; - const arrayParam: AbcObject[] = []; - const listParam: _.List = []; - const comparator = (a: AbcObject, b: AbcObject) => true; - _.differenceWith(list); // $ExpectType AbcObject[] - _.differenceWith(list, arrayParam); // $ExpectType AbcObject[] - _.differenceWith(list, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType AbcObject[] _.differenceWith(list, arrayParam, comparator); // $ExpectType AbcObject[] _.differenceWith(list, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType AbcObject[] - _(list).differenceWith(arrayParam); // $ExpectType LoDashImplicitWrapper - _(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashImplicitWrapper _(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashImplicitWrapper _(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashImplicitWrapper - _.chain(list).differenceWith(arrayParam); // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashExplicitWrapper @@ -359,8 +306,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.drop(list); // $ExpectType AbcObject[] _.drop(list, 42); // $ExpectType AbcObject[] _(list).drop(42); // $ExpectType LoDashImplicitWrapper @@ -381,145 +326,132 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - const predicateFn2 = (value: AbcObject) => true; - _.dropWhile(list); // $ExpectType AbcObject[] - _.dropWhile(list, predicateFn); // $ExpectType AbcObject[] + _.dropWhile(list, listIterator); // $ExpectType AbcObject[] _.dropWhile(list, ""); // $ExpectType AbcObject[] _.dropWhile(list, {a: 42}); // $ExpectType AbcObject[] _(list).dropWhile(); // $ExpectType LoDashImplicitWrapper - _(list).dropWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).dropWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).dropWhile(""); // $ExpectType LoDashImplicitWrapper _(list).dropWhile({a: 42}); // $ExpectType LoDashImplicitWrapper _.chain(list).dropWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).dropWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).dropWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).dropWhile({a: 42}); // $ExpectType LoDashExplicitWrapper - fp.dropWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.dropWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.dropWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.dropWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.dropWhile("", list); // $ExpectType AbcObject[] fp.dropWhile({ a: 42 }, list); // $ExpectType AbcObject[] _.dropRightWhile(list); // $ExpectType AbcObject[] - _.dropRightWhile(list, predicateFn); // $ExpectType AbcObject[] + _.dropRightWhile(list, listIterator); // $ExpectType AbcObject[] _.dropRightWhile(list, ""); // $ExpectType AbcObject[] _.dropRightWhile(list, {a: 42}); // $ExpectType AbcObject[] _(list).dropRightWhile(); // $ExpectType LoDashImplicitWrapper - _(list).dropRightWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).dropRightWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).dropRightWhile(""); // $ExpectType LoDashImplicitWrapper _(list).dropRightWhile({a: 42}); // $ExpectType LoDashImplicitWrapper _.chain(list).dropRightWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).dropRightWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropRightWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).dropRightWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).dropRightWhile({a: 42}); // $ExpectType LoDashExplicitWrapper - fp.dropRightWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.dropRightWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.dropRightWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.dropRightWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.dropRightWhile("", list); // $ExpectType AbcObject[] fp.dropRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.fill { - const array: number[] | null | undefined = anything; - const list: _.List | null | undefined = anything; + _.fill(array, abcObject); // $ExpectType AbcObject[] + _.fill(array, abcObject, 0); // $ExpectType AbcObject[] + _.fill(array, abcObject, 0, 10); // $ExpectType AbcObject[] - _.fill(array, 42); // $ExpectType number[] - _.fill(array, 42, 0); // $ExpectType number[] - _.fill(array, 42, 0, 10); // $ExpectType number[] + _.fill(list, abcObject); // $ExpectType ArrayLike + _.fill(list, abcObject, 0); // $ExpectType ArrayLike + _.fill(list, abcObject, 0, 10); // $ExpectType ArrayLike - _.fill(list, 42); // $ExpectType ArrayLike - _.fill(list, 42, 0); // $ExpectType ArrayLike - _.fill(list, 42, 0, 10); // $ExpectType ArrayLike + _(list).fill(abcObject); // $ExpectType LoDashImplicitWrapper> + _(list).fill(abcObject, 0); // $ExpectType LoDashImplicitWrapper> + _(list).fill(abcObject, 0, 10); // $ExpectType LoDashImplicitWrapper> - _(list).fill(42); // $ExpectType LoDashImplicitWrapper> - _(list).fill(42, 0); // $ExpectType LoDashImplicitWrapper> - _(list).fill(42, 0, 10); // $ExpectType LoDashImplicitWrapper> + _.chain(list).fill(abcObject); // $ExpectType LoDashExplicitWrapper> + _.chain(list).fill(abcObject, 0); // $ExpectType LoDashExplicitWrapper> + _.chain(list).fill(abcObject, 0, 10); // $ExpectType LoDashExplicitWrapper> - _.chain(list).fill(42); // $ExpectType LoDashExplicitWrapper> - _.chain(list).fill(42, 0); // $ExpectType LoDashExplicitWrapper> - _.chain(list).fill(42, 0, 10); // $ExpectType LoDashExplicitWrapper> - - fp.fill(0, 10, 42, array); // $ExpectType number[] - fp.fill(0)(10)(42)(array); // $ExpectType number[] - fp.fill(0, 10, 42, list); // $ExpectType ArrayLike + fp.fill(0, 10, abcObject, array); // $ExpectType AbcObject[] + fp.fill(0)(10)(abcObject)(array); // $ExpectType AbcObject[] + fp.fill(0, 10, abcObject, list); // $ExpectType ArrayLike } // _.findIndex // _.findLastIndex { - const list: _.List | null | undefined = anything; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - const predicateFn2 = (value: AbcObject) => true; - _.findIndex(list); // $ExpectType number - _.findIndex(list, predicateFn); // $ExpectType number + _.findIndex(list, listIterator); // $ExpectType number _.findIndex(list, ""); // $ExpectType number _.findIndex(list, {a: 42}); // $ExpectType number - _.findIndex(list, predicateFn, 1); // $ExpectType number + _.findIndex(list, listIterator, 1); // $ExpectType number _(list).findIndex(); // $ExpectType number - _(list).findIndex(predicateFn); // $ExpectType number + _(list).findIndex(listIterator); // $ExpectType number _(list).findIndex(""); // $ExpectType number _(list).findIndex<{a: number}>({a: 42}); // $ExpectType number - _(list).findIndex(predicateFn, 1); // $ExpectType number + _(list).findIndex(listIterator, 1); // $ExpectType number _.chain(list).findIndex(); // $ExpectType LoDashExplicitWrapper - _.chain(list).findIndex(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).findIndex(""); // $ExpectType LoDashExplicitWrapper _.chain(list).findIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper - _.chain(list).findIndex(predicateFn, 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(listIterator, 1); // $ExpectType LoDashExplicitWrapper - fp.findIndex(predicateFn2, list); // $ExpectType number - fp.findIndex(predicateFn2)(list); // $ExpectType number + fp.findIndex(valueIterator, list); // $ExpectType number + fp.findIndex(valueIterator)(list); // $ExpectType number fp.findIndex("", list); // $ExpectType number fp.findIndex({ a: 42 }, list); // $ExpectType number - fp.findIndexFrom(predicateFn2, 1, list); // $ExpectType number - fp.findIndexFrom(predicateFn2)(1)(list); // $ExpectType number + fp.findIndexFrom(valueIterator, 1, list); // $ExpectType number + fp.findIndexFrom(valueIterator)(1)(list); // $ExpectType number fp.findIndexFrom("", 1, list); // $ExpectType number fp.findIndexFrom({ a: 42 }, 1, list); // $ExpectType number _.findLastIndex(list); // $ExpectType number - _.findLastIndex(list, predicateFn); // $ExpectType number + _.findLastIndex(list, listIterator); // $ExpectType number _.findLastIndex(list, ""); // $ExpectType number _.findLastIndex(list, {a: 42}); // $ExpectType number - _.findLastIndex(list, predicateFn, 1); // $ExpectType number + _.findLastIndex(list, listIterator, 1); // $ExpectType number _(list).findLastIndex(); // $ExpectType number - _(list).findLastIndex(predicateFn); // $ExpectType number + _(list).findLastIndex(listIterator); // $ExpectType number _(list).findLastIndex(""); // $ExpectType number _(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType number - _(list).findLastIndex(predicateFn, 1); // $ExpectType number + _(list).findLastIndex(listIterator, 1); // $ExpectType number _.chain(list).findLastIndex(); // $ExpectType LoDashExplicitWrapper - _.chain(list).findLastIndex(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).findLastIndex(""); // $ExpectType LoDashExplicitWrapper _.chain(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper - _.chain(list).findLastIndex(predicateFn, 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(listIterator, 1); // $ExpectType LoDashExplicitWrapper - fp.findLastIndex(predicateFn2, list); // $ExpectType number - fp.findLastIndex(predicateFn2)(list); // $ExpectType number + fp.findLastIndex(valueIterator, list); // $ExpectType number + fp.findLastIndex(valueIterator)(list); // $ExpectType number fp.findLastIndex("", list); // $ExpectType number fp.findLastIndex({ a: 42 }, list); // $ExpectType number - fp.findLastIndexFrom(predicateFn2, 1, list); // $ExpectType number - fp.findLastIndexFrom(predicateFn2)(1)(list); // $ExpectType number + fp.findLastIndexFrom(valueIterator, 1, list); // $ExpectType number + fp.findLastIndexFrom(valueIterator)(1)(list); // $ExpectType number fp.findLastIndexFrom("", 1, list); // $ExpectType number fp.findLastIndexFrom({ a: 42 }, 1, list); // $ExpectType number } // _.first { - const list: _.List | null | undefined = anything; - _.first("abc"); // $ExpectType string | undefined _.first(list); // $ExpectType AbcObject | undefined @@ -590,8 +522,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.head("abc"); // $ExpectType string | undefined _.head(list); // $ExpectType AbcObject | undefined @@ -610,46 +540,41 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const value: AbcObject = { a: 1, b: "", c: true }; + _.indexOf(list, abcObject); // $ExpectType number + _.indexOf(list, abcObject, 42); // $ExpectType number + _(list).indexOf(abcObject); // $ExpectType number + _(list).indexOf(abcObject, 42); // $ExpectType number + _.chain(list).indexOf(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(list).indexOf(abcObject, 42); // $ExpectType LoDashExplicitWrapper + fp.indexOf(abcObject, list); // $ExpectType number + fp.indexOf(abcObject)(list); // $ExpectType number + fp.indexOfFrom(abcObject)(42)(list); // $ExpectType number - _.indexOf(list, value); // $ExpectType number - _.indexOf(list, value, 42); // $ExpectType number - _(list).indexOf(value); // $ExpectType number - _(list).indexOf(value, 42); // $ExpectType number - _.chain(list).indexOf(value); // $ExpectType LoDashExplicitWrapper - _.chain(list).indexOf(value, 42); // $ExpectType LoDashExplicitWrapper - fp.indexOf(value, list); // $ExpectType number - fp.indexOf(value)(list); // $ExpectType number - fp.indexOfFrom(value)(42)(list); // $ExpectType number + _.lastIndexOf(list, abcObject); // $ExpectType number + _.lastIndexOf(list, abcObject, 42); // $ExpectType number + _(list).lastIndexOf(abcObject); // $ExpectType number + _(list).lastIndexOf(abcObject, 42); // $ExpectType number + _.chain(list).lastIndexOf(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(list).lastIndexOf(abcObject, 42); // $ExpectType LoDashExplicitWrapper + fp.lastIndexOf(abcObject, list); // $ExpectType number + fp.lastIndexOf(abcObject)(list); // $ExpectType number + fp.lastIndexOfFrom(abcObject)(42)(list); // $ExpectType number - _.lastIndexOf(list, value); // $ExpectType number - _.lastIndexOf(list, value, 42); // $ExpectType number - _(list).lastIndexOf(value); // $ExpectType number - _(list).lastIndexOf(value, 42); // $ExpectType number - _.chain(list).lastIndexOf(value); // $ExpectType LoDashExplicitWrapper - _.chain(list).lastIndexOf(value, 42); // $ExpectType LoDashExplicitWrapper - fp.lastIndexOf(value, list); // $ExpectType number - fp.lastIndexOf(value)(list); // $ExpectType number - fp.lastIndexOfFrom(value)(42)(list); // $ExpectType number + _.sortedIndexOf(list, abcObject); // $ExpectType number + _(list).sortedIndexOf(abcObject); // $ExpectType number + _.chain(list).indexOf(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedIndexOf(abcObject, list); // $ExpectType number + fp.sortedIndexOf(abcObject)(list); // $ExpectType number - _.sortedIndexOf(list, value); // $ExpectType number - _(list).sortedIndexOf(value); // $ExpectType number - _.chain(list).indexOf(value); // $ExpectType LoDashExplicitWrapper - fp.sortedIndexOf(value, list); // $ExpectType number - fp.sortedIndexOf(value)(list); // $ExpectType number - - _.sortedLastIndexOf(list, value); // $ExpectType number - _(list).sortedLastIndexOf(value); // $ExpectType number - _.chain(list).sortedLastIndexOf(value); // $ExpectType LoDashExplicitWrapper - fp.sortedLastIndexOf(value, list); // $ExpectType number - fp.sortedLastIndexOf(value)(list); // $ExpectType number + _.sortedLastIndexOf(list, abcObject); // $ExpectType number + _(list).sortedLastIndexOf(abcObject); // $ExpectType number + _.chain(list).sortedLastIndexOf(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndexOf(abcObject, list); // $ExpectType number + fp.sortedLastIndexOf(abcObject)(list); // $ExpectType number } // _.initial { - const list: _.List | null | undefined = anything; - _.initial(list); // $ExpectType AbcObject[] _(list).initial(); // $ExpectType LoDashImplicitWrapper _.chain(list).initial(); // $ExpectType LoDashExplicitWrapper @@ -840,8 +765,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.last("abc"); // $ExpectType string | undefined _.last(list); // $ExpectType AbcObject | undefined @@ -857,8 +780,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.nth(list, 42); // $ExpectType AbcObject | undefined _(list).nth(42); // $ExpectType AbcObject | undefined _.chain(list).nth(42); // $ExpectType LoDashExplicitWrapper @@ -871,32 +792,30 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper = []; - const value: AbcObject = { a: 1, b: "", c: true }; _.pull(array); // $ExpectType AbcObject[] - _.pull(array, value); // $ExpectType AbcObject[] - _.pull(array, value, value, value); // $ExpectType AbcObject[] + _.pull(array, abcObject); // $ExpectType AbcObject[] + _.pull(array, abcObject, abcObject, abcObject); // $ExpectType AbcObject[] _.pull(list); // $ExpectType ArrayLike - _.pull(list, value); // $ExpectType ArrayLike - _.pull(list, value, value, value); // $ExpectType ArrayLike + _.pull(list, abcObject); // $ExpectType ArrayLike + _.pull(list, abcObject, abcObject, abcObject); // $ExpectType ArrayLike _(array).pull(); // $ExpectType LoDashImplicitWrapper - _(array).pull(value); // $ExpectType LoDashImplicitWrapper - _(array).pull(value, value, value); // $ExpectType LoDashImplicitWrapper + _(array).pull(abcObject); // $ExpectType LoDashImplicitWrapper + _(array).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashImplicitWrapper _(list).pull(); // $ExpectType LoDashImplicitWrapper> - _(list).pull(value); // $ExpectType LoDashImplicitWrapper> - _(list).pull(value, value, value); // $ExpectType LoDashImplicitWrapper> + _(list).pull(abcObject); // $ExpectType LoDashImplicitWrapper> + _(list).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashImplicitWrapper> _.chain(array).pull(); // $ExpectType LoDashExplicitWrapper - _.chain(array).pull(value); // $ExpectType LoDashExplicitWrapper - _.chain(array).pull(value, value, value); // $ExpectType LoDashExplicitWrapper + _.chain(array).pull(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(array).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashExplicitWrapper _.chain(list).pull(); // $ExpectType LoDashExplicitWrapper> - _.chain(list).pull(value); // $ExpectType LoDashExplicitWrapper> - _.chain(list).pull(value, value, value); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pull(abcObject); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashExplicitWrapper> - fp.pull(value, array); // $ExpectType AbcObject[] - fp.pull(value, list); // $ExpectType ArrayLike - fp.pull(value)(list); // $ExpectType ArrayLike + fp.pull(abcObject, array); // $ExpectType AbcObject[] + fp.pull(abcObject)(list); // $ExpectType ArrayLike } // _.pullAt @@ -1137,34 +1056,30 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper = []; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; _.remove(list); // $ExpectType AbcObject[] - _.remove(list, predicateFn); // $ExpectType AbcObject[] + _.remove(list, listIterator); // $ExpectType AbcObject[] _.remove(list, ""); // $ExpectType AbcObject[] _.remove(list, { a: 42 }); // $ExpectType AbcObject[] _(list).remove(); // $ExpectType LoDashImplicitWrapper - _(list).remove(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).remove(listIterator); // $ExpectType LoDashImplicitWrapper _(list).remove(""); // $ExpectType LoDashImplicitWrapper _(list).remove({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).remove(); // $ExpectType LoDashExplicitWrapper - _.chain(list).remove(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).remove(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).remove(""); // $ExpectType LoDashExplicitWrapper _.chain(list).remove({ a: 42 }); // $ExpectType LoDashExplicitWrapper - const predicateFn2 = (value: AbcObject) => true; - fp.remove(predicateFn2, list); // $ExpectType AbcObject[] - fp.remove(predicateFn2)(list); // $ExpectType AbcObject[] + fp.remove(valueIterator, list); // $ExpectType AbcObject[] + fp.remove(valueIterator)(list); // $ExpectType AbcObject[] fp.remove("", list); // $ExpectType AbcObject[] fp.remove({ a: 42 }, list); // $ExpectType AbcObject[] } // _.tail { - const list: _.List | null | undefined = anything; - _.tail(list); // $ExpectType AbcObject[] _(list).tail(); // $ExpectType LoDashImplicitWrapper _.chain(list).tail(); // $ExpectType LoDashExplicitWrapper @@ -1173,8 +1088,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const value: AbcObject = { a: 1, b: "", c: true }; - const listIterator = (value: AbcObject) => 0; + _.sortedIndexBy(list, abcObject, valueIterator); // $ExpectType number + _.sortedIndexBy(list, abcObject, ""); // $ExpectType number + _.sortedIndexBy(list, abcObject, { a: 42 }); // $ExpectType number + _(list).sortedIndexBy(abcObject, valueIterator); // $ExpectType number + _(list).sortedIndexBy(abcObject, ""); // $ExpectType number + _(list).sortedIndexBy(abcObject, { a: 42 }); // $ExpectType number + _.chain(list).sortedIndexBy(abcObject, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedIndexBy(abcObject, ""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedIndexBy(abcObject, { a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.sortedIndexBy(valueIterator, abcObject, list); // $ExpectType number + fp.sortedIndexBy(valueIterator)(abcObject)(list); // $ExpectType number + fp.sortedIndexBy("a", abcObject, list); // $ExpectType number + fp.sortedIndexBy({ a: 42 }, abcObject, list); // $ExpectType number - _.sortedIndexBy(list, value, listIterator); // $ExpectType number - _.sortedIndexBy(list, value, ""); // $ExpectType number - _.sortedIndexBy(list, value, { a: 42 }); // $ExpectType number - _(list).sortedIndexBy(value, listIterator); // $ExpectType number - _(list).sortedIndexBy(value, ""); // $ExpectType number - _(list).sortedIndexBy(value, { a: 42 }); // $ExpectType number - _.chain(list).sortedIndexBy(value, listIterator); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedIndexBy(value, ""); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedIndexBy(value, { a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.sortedIndexBy(listIterator, value, list); // $ExpectType number - fp.sortedIndexBy(listIterator)(value)(list); // $ExpectType number - fp.sortedIndexBy("a", value, list); // $ExpectType number - fp.sortedIndexBy({ a: 42 }, value, list); // $ExpectType number - - _.sortedLastIndexBy(list, value, listIterator); // $ExpectType number - _.sortedLastIndexBy(list, value, ""); // $ExpectType number - _.sortedLastIndexBy(list, value, { a: 42 }); // $ExpectType number - _(list).sortedLastIndexBy(value, listIterator); // $ExpectType number - _(list).sortedLastIndexBy(value, ""); // $ExpectType number - _(list).sortedLastIndexBy(value, { a: 42 }); // $ExpectType number - _.chain(list).sortedLastIndexBy(value, listIterator); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedLastIndexBy(value, ""); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedLastIndexBy(value, { a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.sortedLastIndexBy(listIterator, value, list); // $ExpectType number - fp.sortedLastIndexBy(listIterator)(value)(list); // $ExpectType number - fp.sortedLastIndexBy("a", value, list); // $ExpectType number - fp.sortedLastIndexBy({ a: 42 }, value, list); // $ExpectType number + _.sortedLastIndexBy(list, abcObject, valueIterator); // $ExpectType number + _.sortedLastIndexBy(list, abcObject, ""); // $ExpectType number + _.sortedLastIndexBy(list, abcObject, { a: 42 }); // $ExpectType number + _(list).sortedLastIndexBy(abcObject, valueIterator); // $ExpectType number + _(list).sortedLastIndexBy(abcObject, ""); // $ExpectType number + _(list).sortedLastIndexBy(abcObject, { a: 42 }); // $ExpectType number + _.chain(list).sortedLastIndexBy(abcObject, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedLastIndexBy(abcObject, ""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedLastIndexBy(abcObject, { a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndexBy(valueIterator, abcObject, list); // $ExpectType number + fp.sortedLastIndexBy(valueIterator)(abcObject)(list); // $ExpectType number + fp.sortedLastIndexBy("a", abcObject, list); // $ExpectType number + fp.sortedLastIndexBy({ a: 42 }, abcObject, list); // $ExpectType number } // _.sortedIndex // _.sortedLastIndex { - const list: _.List | null | undefined = anything; - const value: AbcObject = { a: 1, b: "", c: true }; + _.sortedIndex(list, abcObject); // $ExpectType number + _(list).sortedIndex(abcObject); // $ExpectType number + _.chain(list).sortedIndex(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedIndex(abcObject, list); // $ExpectType number + fp.sortedIndex(abcObject)(list); // $ExpectType number - _.sortedIndex(list, value); // $ExpectType number - _(list).sortedIndex(value); // $ExpectType number - _.chain(list).sortedIndex(value); // $ExpectType LoDashExplicitWrapper - fp.sortedIndex(value, list); // $ExpectType number - fp.sortedIndex(value)(list); // $ExpectType number - - _.sortedLastIndex(list, value); // $ExpectType number - _(list).sortedLastIndex(value); // $ExpectType number - _.chain(list).sortedLastIndex(value); // $ExpectType LoDashExplicitWrapper - fp.sortedLastIndex(value, list); // $ExpectType number - fp.sortedLastIndex(value)(list); // $ExpectType number + _.sortedLastIndex(list, abcObject); // $ExpectType number + _(list).sortedLastIndex(abcObject); // $ExpectType number + _.chain(list).sortedLastIndex(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndex(abcObject, list); // $ExpectType number + fp.sortedLastIndex(abcObject)(list); // $ExpectType number } // _.take // _.takeRight { - const list: _.List | null | undefined = anything; - _.take(list); // $ExpectType AbcObject[] _.take(list, 42); // $ExpectType AbcObject[] _(list).take(); // $ExpectType LoDashImplicitWrapper @@ -1269,55 +1173,49 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - const predicateFn2 = (value: AbcObject) => true; - _.takeWhile(list); // $ExpectType AbcObject[] - _.takeWhile(list, predicateFn); // $ExpectType AbcObject[] + _.takeWhile(list, listIterator); // $ExpectType AbcObject[] _.takeWhile(list, ""); // $ExpectType AbcObject[] _.takeWhile(list, { a: 42 }); // $ExpectType AbcObject[] _(list).takeWhile(); // $ExpectType LoDashImplicitWrapper - _(list).takeWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).takeWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).takeWhile(""); // $ExpectType LoDashImplicitWrapper _(list).takeWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).takeWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).takeWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).takeWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).takeWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.takeWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.takeWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.takeWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.takeWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.takeWhile("a", list); // $ExpectType AbcObject[] fp.takeWhile({ a: 42 }, list); // $ExpectType AbcObject[] _.takeRightWhile(list); // $ExpectType AbcObject[] - _.takeRightWhile(list, predicateFn); // $ExpectType AbcObject[] + _.takeRightWhile(list, listIterator); // $ExpectType AbcObject[] _.takeRightWhile(list, ""); // $ExpectType AbcObject[] _.takeRightWhile(list, { a: 42 }); // $ExpectType AbcObject[] _(list).takeRightWhile(); // $ExpectType LoDashImplicitWrapper - _(list).takeRightWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).takeRightWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).takeRightWhile(""); // $ExpectType LoDashImplicitWrapper _(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).takeRightWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).takeRightWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeRightWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).takeRightWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.takeRightWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.takeRightWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.takeRightWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.takeRightWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.takeRightWhile("a", list); // $ExpectType AbcObject[] fp.takeRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.union { - const list: _.List | null | undefined = anything; - _.union(list); // $ExpectType AbcObject[] _.union(list, list); // $ExpectType AbcObject[] _.union(list, list, list); // $ExpectType AbcObject[] @@ -1336,13 +1234,9 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const iteratee = (value: AbcObject) => 1; - _.unionBy(list, list); // $ExpectType AbcObject[] - _.unionBy(list, list, list, list, list, list); // $ExpectType AbcObject[] - _.unionBy(list, list, iteratee); // $ExpectType AbcObject[] - _.unionBy(list, list, list, list, list, list, iteratee); // $ExpectType AbcObject[] + _.unionBy(list, list, valueIterator); // $ExpectType AbcObject[] + _.unionBy(list, list, list, list, list, list, valueIterator); // $ExpectType AbcObject[] _.unionBy(list, list, "a"); // $ExpectType AbcObject[] // param needed for TS 2.3 _.unionBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] @@ -1350,9 +1244,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _(list).unionBy(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper - _(list).unionBy(list, iteratee); // $ExpectType LoDashImplicitWrapper - _(list).unionBy(list, list, list, list, list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, valueIterator); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashImplicitWrapper _(list).unionBy(list, "a"); // $ExpectType LoDashImplicitWrapper // param needed for TS 2.3 _(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper @@ -1360,17 +1253,16 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list); // $ExpectType LoDashExplicitWrapper - _.chain(list).unionBy(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper - _.chain(list).unionBy(list, iteratee); // $ExpectType LoDashExplicitWrapper - _.chain(list).unionBy(list, list, list, list, list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, "a"); // $ExpectType LoDashExplicitWrapper // param needed for TS 2.3 _.chain(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper - fp.unionBy(iteratee, list, list); // $ExpectType AbcObject[] - fp.unionBy(iteratee)(list)(list); // $ExpectType AbcObject[] + fp.unionBy(valueIterator, list, list); // $ExpectType AbcObject[] + fp.unionBy(valueIterator)(list)(list); // $ExpectType AbcObject[] fp.unionBy("a", list, list); // $ExpectType AbcObject[] fp.unionBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } @@ -1378,8 +1270,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.uniq("abc"); // $ExpectType string[] _.uniq(list); // $ExpectType AbcObject[] _(list).uniq(); // $ExpectType LoDashImplicitWrapper @@ -1398,10 +1288,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const stringIterator = (value: string) => ""; - const valueIterator = (value: AbcObject) => 0; - _.uniqBy("abc", stringIterator); // $ExpectType string[] _.uniqBy(list, valueIterator); // $ExpectType AbcObject[] _.uniqBy(list, "a"); // $ExpectType AbcObject[] @@ -1495,8 +1381,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.xor(list); // $ExpectType AbcObject[] _.xor(list, list); // $ExpectType AbcObject[] _.xor(list, list, list); // $ExpectType AbcObject[] @@ -1515,13 +1399,9 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const iteratee = (value: AbcObject) => 1; - _.xorBy(list, list); // $ExpectType AbcObject[] - _.xorBy(list, list, list, list, list, list); // $ExpectType AbcObject[] - _.xorBy(list, list, iteratee); // $ExpectType AbcObject[] - _.xorBy(list, list, list, list, list, list, iteratee); // $ExpectType AbcObject[] + _.xorBy(list, list, valueIterator); // $ExpectType AbcObject[] + _.xorBy(list, list, list, list, list, list, valueIterator); // $ExpectType AbcObject[] _.xorBy(list, list, "a"); // $ExpectType AbcObject[] // param needed for TS 2.3 _.xorBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] @@ -1529,9 +1409,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _(list).xorBy(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper - _(list).xorBy(list, iteratee); // $ExpectType LoDashImplicitWrapper - _(list).xorBy(list, list, list, list, list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, valueIterator); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashImplicitWrapper _(list).xorBy(list, "a"); // $ExpectType LoDashImplicitWrapper // param needed for TS 2.3 _(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper @@ -1539,25 +1418,22 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list); // $ExpectType LoDashExplicitWrapper - _.chain(list).xorBy(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper - _.chain(list).xorBy(list, iteratee); // $ExpectType LoDashExplicitWrapper - _.chain(list).xorBy(list, list, list, list, list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, "a"); // $ExpectType LoDashExplicitWrapper // param needed for TS 2.3 _.chain(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper - fp.xorBy(iteratee, list, list); // $ExpectType AbcObject[] - fp.xorBy(iteratee)(list)(list); // $ExpectType AbcObject[] + fp.xorBy(valueIterator, list, list); // $ExpectType AbcObject[] + fp.xorBy(valueIterator)(list)(list); // $ExpectType AbcObject[] fp.xorBy("a", list, list); // $ExpectType AbcObject[] fp.xorBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } // _.zip { - const list: _.List | null | undefined = anything; - _.zip(list); // $ExpectType (AbcObject | undefined)[][] _.zip(list, list); // $ExpectType (AbcObject | undefined)[][] _.zip(list, list, list, list, list, list); // $ExpectType (AbcObject | undefined)[][] @@ -1691,9 +1567,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; const abcObject: AbcObject | null | undefined = anything; _.at(list, 0, "1", [2], ["3"], [4, "5"]); // $ExpectType AbcObject[] @@ -1719,13 +1592,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const stringIterator = (value: string) => 1; - const valueIterator = (value: AbcObject) => 1; - _.countBy(""); // $ExpectType Dictionary _.countBy("", stringIterator); // $ExpectType Dictionary @@ -1793,15 +1659,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; - const valueIterator = (value: AbcObject) => true; - _.every(list); // $ExpectType boolean _.every(list, listIterator); // $ExpectType boolean _.every(list, "a"); // $ExpectType boolean @@ -1874,13 +1731,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const stringIterator = (char: string, index: number, string: string) => true; - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const valueIterator = (value: AbcObject) => true; _.filter("", stringIterator); // $ExpectType string[] _.filter(list, listIterator); // $ExpectType AbcObject[] @@ -1942,13 +1793,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const valueIterator = (value: AbcObject) => true; - _.find(list); // $ExpectType AbcObject | undefined _.find(list, listIterator); // $ExpectType AbcObject | undefined _.find(list, listIterator, 1); // $ExpectType AbcObject | undefined @@ -2138,7 +1982,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; @@ -2206,22 +2050,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; - const numDictionary: _.Dictionary | null | undefined = anything; - const objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - const numNumericDictionary: _.NumericDictionary | null | undefined = anything; - const objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - - const stringIterator = (value: string, index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | string => ""; - const listIterator = (value: number | number[], index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | number => 1; - const dictionaryIterator = (value: number | number[], key: string, collection: _.Dictionary): _.ListOfRecursiveArraysOrValues | number => 1; - const numericDictionaryIterator = (value: number | number[], key: string, collection: _.NumericDictionary): _.ListOfRecursiveArraysOrValues | number => 1; - const valueIterator = (value: number | number[]): _.ListOfRecursiveArraysOrValues | number => 1; _.flatMapDepth("abc"); // $ExpectType string[] _.flatMapDepth("abc", stringIterator); // $ExpectType string[] @@ -2289,7 +2117,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; const nilDictionary: _.Dictionary | null | undefined = anything; const nilNumericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; const nilAbcObject: AbcObject | null | undefined = anything; // $ExpectType string @@ -2516,16 +2343,14 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - const stringIterator2 = (char: string) => 1; - const listIterator2 = (value: AbcObject) => 1; - fp.forEach(stringIterator2, ""); // $ExpectType string - fp.forEach(listIterator2, array); // $ExpectType AbcObject[] - fp.forEach(listIterator2)(array); // $ExpectType AbcObject[] - fp.forEach(listIterator2, list); // $ExpectType ArrayLike - fp.forEach(listIterator2, dictionary); // $ExpectType Dictionary - fp.forEach(listIterator2, nilArray); // $ExpectType AbcObject[] | null | undefined - fp.forEach(listIterator2, nilList); // $ExpectType ArrayLike | null | undefined - fp.forEach(listIterator2, nilDictionary); // $ExpectType Dictionary | null | undefined + fp.forEach(stringIterator, ""); // $ExpectType string + fp.forEach(valueIterator, array); // $ExpectType AbcObject[] + fp.forEach(valueIterator)(array); // $ExpectType AbcObject[] + fp.forEach(valueIterator, list); // $ExpectType ArrayLike + fp.forEach(valueIterator, dictionary); // $ExpectType Dictionary + fp.forEach(valueIterator, nilArray); // $ExpectType AbcObject[] | null | undefined + fp.forEach(valueIterator, nilList); // $ExpectType ArrayLike | null | undefined + fp.forEach(valueIterator, nilDictionary); // $ExpectType Dictionary | null | undefined // $ExpectType AbcObject[] _.forEachRight(array, (value, index, collection) => { @@ -2563,8 +2388,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - fp.forEachRight(listIterator2, array); // $ExpectType AbcObject[] - fp.forEachRight(listIterator2)(array); // $ExpectType AbcObject[] + fp.forEachRight(valueIterator, array); // $ExpectType AbcObject[] + fp.forEachRight(valueIterator)(array); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.each(array, (value, index, collection) => { @@ -2602,8 +2427,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - fp.each(listIterator2, array); // $ExpectType AbcObject[] - fp.each(listIterator2)(array); // $ExpectType AbcObject[] + fp.each(valueIterator, array); // $ExpectType AbcObject[] + fp.each(valueIterator)(array); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.eachRight(array, (value, index, collection) => { @@ -2641,18 +2466,12 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - fp.eachRight(listIterator2, array); // $ExpectType AbcObject[] - fp.eachRight(listIterator2)(array); // $ExpectType AbcObject[] + fp.eachRight(valueIterator, array); // $ExpectType AbcObject[] + fp.eachRight(valueIterator)(array); // $ExpectType AbcObject[] } // _.groupBy { - const list: _.List | null | undefined = [] as any; - const dictionary: _.Dictionary | null | undefined = anything; - - const stringIterator = (char: string) => 0; - const valueIterator = (value: AbcObject) => 0; - _.groupBy(""); // $ExpectType Dictionary _.groupBy("", stringIterator); // $ExpectType Dictionary _.groupBy(list); // $ExpectType Dictionary @@ -2699,42 +2518,33 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const target: AbcObject = { a: 42, b: "", c: true }; + _.includes(list, abcObject); // $ExpectType boolean + _.includes(list, abcObject, 42); // $ExpectType boolean + _.includes(dictionary, abcObject); // $ExpectType boolean + _.includes(dictionary, abcObject, 42); // $ExpectType boolean - _.includes(list, target); // $ExpectType boolean - _.includes(list, target, 42); // $ExpectType boolean - _.includes(dictionary, target); // $ExpectType boolean - _.includes(dictionary, target, 42); // $ExpectType boolean + _(list).includes(abcObject); // $ExpectType boolean + _(list).includes(abcObject, 42); // $ExpectType boolean + _(dictionary).includes(abcObject); // $ExpectType boolean + _(dictionary).includes(abcObject, 42); // $ExpectType boolean - _(list).includes(target); // $ExpectType boolean - _(list).includes(target, 42); // $ExpectType boolean - _(dictionary).includes(target); // $ExpectType boolean - _(dictionary).includes(target, 42); // $ExpectType boolean + _.chain(list).includes(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(list).includes(abcObject, 42); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).includes(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).includes(abcObject, 42); // $ExpectType LoDashExplicitWrapper - _.chain(list).includes(target); // $ExpectType LoDashExplicitWrapper - _.chain(list).includes(target, 42); // $ExpectType LoDashExplicitWrapper - _.chain(dictionary).includes(target); // $ExpectType LoDashExplicitWrapper - _.chain(dictionary).includes(target, 42); // $ExpectType LoDashExplicitWrapper + fp.includes(abcObject, list); // $ExpectType boolean + fp.includes(abcObject)(list); // $ExpectType boolean + fp.includes(abcObject, dictionary); // $ExpectType boolean - fp.includes(target, list); // $ExpectType boolean - fp.includes(target)(list); // $ExpectType boolean - fp.includes(target, dictionary); // $ExpectType boolean - - fp.includesFrom(target, 42, list); // $ExpectType boolean - fp.includesFrom(target)(42)(list); // $ExpectType boolean - fp.includesFrom(target, 42, dictionary); // $ExpectType boolean + fp.includesFrom(abcObject, 42, list); // $ExpectType boolean + fp.includesFrom(abcObject)(42)(list); // $ExpectType boolean + fp.includesFrom(abcObject, 42, dictionary); // $ExpectType boolean } // _.keyBy { - const list: _.List | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const stringIterator = (value: string) => "a"; - const valueIterator = (value: AbcObject) => 1; + const valueIterator = (value: AbcObject) => ""; _.keyBy("abcd"); // $ExpectType Dictionary _.keyBy("abcd", stringIterator); // $ExpectType Dictionary @@ -2878,11 +2688,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; - _.map(list); // $ExpectType AbcObject[] // $ExpectType number[] _.map(list, (value, index, collection) => { @@ -2995,8 +2800,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - // $ExpectType [any[], any[]] _.partition(anything, (value) => { value; // $ExpectType any @@ -3110,13 +2913,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const stringIterator = (char: string, index: number, string: string) => true; - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const valueIterator = (value: AbcObject) => true; _.reject("", stringIterator); // $ExpectType string[] _.reject(list, listIterator); // $ExpectType AbcObject[] @@ -3207,9 +3004,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - _.shuffle("abc"); // $ExpectType string[] _.shuffle(list); // $ExpectType AbcObject[] _.shuffle(dictionary); // $ExpectType AbcObject[] @@ -3226,9 +3020,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - _.size(list); // $ExpectType number _.size(dictionary); // $ExpectType number _.size(""); // $ExpectType number @@ -3245,15 +3036,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; - const valueIterator = (value: AbcObject) => true; - _.some(list); // $ExpectType boolean _.some(list, listIterator); // $ExpectType boolean _.some(list, "a"); // $ExpectType boolean @@ -3326,13 +3108,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => 0; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => 0; - const valueIterator = (value: AbcObject) => 0; - _.sortBy(list); // $ExpectType AbcObject[] _.sortBy(list, listIterator); // $ExpectType AbcObject[] _.sortBy(list, listIterator, listIterator); // $ExpectType AbcObject[] @@ -3380,10 +3155,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - _.orderBy("acbd", (value) => 1); // $ExpectType string[] _.orderBy("acbd", (value) => 1, true); // $ExpectType string[] _.orderBy("acbd", [(value) => 1, (value) => 2], [true, false]); // $ExpectType string[] @@ -4882,8 +4653,6 @@ fp.now(); // $ExpectType number { const list: ArrayLike = anything; - const valueIterator = (value: AbcObject) => 0; - _.maxBy(list, valueIterator); // $ExpectType AbcObject | undefined _.maxBy(list, "a"); // $ExpectType AbcObject | undefined _.maxBy(list, { a: 42 }); // $ExpectType AbcObject | undefined @@ -4976,7 +4745,6 @@ fp.now(); // $ExpectType number // _.sumBy { - const list: ArrayLike | null | undefined = anything; const listIterator = (value: AbcObject) => 0; _.sumBy(list, listIterator); // $ExpectType number @@ -5235,7 +5003,6 @@ fp.now(); // $ExpectType number { const dictionary: _.Dictionary = anything; const numericDictionary: _.NumericDictionary = anything; - const abcObject: AbcObject = anything; _.entries(dictionary); // $ExpectType [string, number][] _.entries(numericDictionary); // $ExpectType [string, number][] @@ -5362,17 +5129,15 @@ fp.now(); // $ExpectType number // _.functions // _.functionsIn { - const object: AbcObject = anything; + _.functions(abcObject); // $ExpectType string[] + _(abcObject).functions(); // $ExpectType LoDashImplicitWrapper + _.chain(abcObject).functions(); // $ExpectType LoDashExplicitWrapper + fp.functions(abcObject); // $ExpectType string[] - _.functions(object); // $ExpectType string[] - _(object).functions(); // $ExpectType LoDashImplicitWrapper - _.chain(object).functions(); // $ExpectType LoDashExplicitWrapper - fp.functions(object); // $ExpectType string[] - - _.functionsIn(object); // $ExpectType string[] - _(object).functionsIn(); // $ExpectType LoDashImplicitWrapper - _.chain(object).functionsIn(); // $ExpectType LoDashExplicitWrapper - fp.functionsIn(object); // $ExpectType string[] + _.functionsIn(abcObject); // $ExpectType string[] + _(abcObject).functionsIn(); // $ExpectType LoDashImplicitWrapper + _.chain(abcObject).functionsIn(); // $ExpectType LoDashExplicitWrapper + fp.functionsIn(abcObject); // $ExpectType string[] } // _.get @@ -5396,7 +5161,7 @@ fp.now(); // $ExpectType number _.chain("abc").get(1); // $ExpectType LoDashExplicitWrapper _.chain("abc").get(["0"], "_"); - _.chain([42]).get(0, -1); // $ExpectType LoDashExplicitWrapper + _.chain([42]).get(0, -1); // ExpectType LoDashExplicitWrapper _.chain({ a: { b: true } }).get("a"); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a"]); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a", "b"]); // $ExpectType LoDashExplicitWrapper @@ -5419,33 +5184,31 @@ fp.now(); // $ExpectType number // _.has // _.hasIn { - const object: AbcObject = anything; + _.has(abcObject, ""); // $ExpectType boolean + _.has(abcObject, 42); // $ExpectType boolean + _.has(abcObject, ["", 42]); // $ExpectType boolean + _(abcObject).has(""); // $ExpectType boolean + _(abcObject).has(42); // $ExpectType boolean + _(abcObject).has(["", 42]); // $ExpectType boolean + _.chain(abcObject).has(""); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).has(42); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).has(["", 42]); // $ExpectType LoDashExplicitWrapper + fp.has("a", abcObject); // $ExpectType boolean + fp.has("a")(abcObject); // $ExpectType boolean + fp.has(["a", 42])(abcObject); // $ExpectType boolean - _.has(object, ""); // $ExpectType boolean - _.has(object, 42); // $ExpectType boolean - _.has(object, ["", 42]); // $ExpectType boolean - _(object).has(""); // $ExpectType boolean - _(object).has(42); // $ExpectType boolean - _(object).has(["", 42]); // $ExpectType boolean - _.chain(object).has(""); // $ExpectType LoDashExplicitWrapper - _.chain(object).has(42); // $ExpectType LoDashExplicitWrapper - _.chain(object).has(["", 42]); // $ExpectType LoDashExplicitWrapper - fp.has("a", object); // $ExpectType boolean - fp.has("a")(object); // $ExpectType boolean - fp.has(["a", 42])(object); // $ExpectType boolean - - _.hasIn(object, ""); // $ExpectType boolean - _.hasIn(object, 42); // $ExpectType boolean - _.hasIn(object, ["", 42]); // $ExpectType boolean - _(object).hasIn(""); // $ExpectType boolean - _(object).hasIn(42); // $ExpectType boolean - _(object).hasIn(["", 42]); // $ExpectType boolean - _.chain(object).hasIn(""); // $ExpectType LoDashExplicitWrapper - _.chain(object).hasIn(42); // $ExpectType LoDashExplicitWrapper - _.chain(object).hasIn(["", 42]); // $ExpectType LoDashExplicitWrapper - fp.hasIn("a", object); // $ExpectType boolean - fp.hasIn("a")(object); // $ExpectType boolean - fp.hasIn(["a", 42])(object); // $ExpectType boolean + _.hasIn(abcObject, ""); // $ExpectType boolean + _.hasIn(abcObject, 42); // $ExpectType boolean + _.hasIn(abcObject, ["", 42]); // $ExpectType boolean + _(abcObject).hasIn(""); // $ExpectType boolean + _(abcObject).hasIn(42); // $ExpectType boolean + _(abcObject).hasIn(["", 42]); // $ExpectType boolean + _.chain(abcObject).hasIn(""); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).hasIn(42); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).hasIn(["", 42]); // $ExpectType LoDashExplicitWrapper + fp.hasIn("a", abcObject); // $ExpectType boolean + fp.hasIn("a")(abcObject); // $ExpectType boolean + fp.hasIn(["a", 42])(abcObject); // $ExpectType boolean } // _.invert @@ -5462,7 +5225,6 @@ fp.now(); // $ExpectType number const dictionary: _.Dictionary<{ a: number }> = {}; const numericDictionary: _.NumericDictionary<{ a: number }> = {}; - const stringIterator = (value: string) => 1; const valueIterator = (value: {a: number }) => 1; _.invertBy("foo"); // $ExpectType Dictionary @@ -5523,14 +5285,6 @@ fp.now(); // $ExpectType number // _.mapKeys { - const list: _.List| null | undefined = [] as any; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => ""; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => ""; - const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => ""; const abcObjectIterator = (value: AbcObject[keyof AbcObject], key: string, collection: AbcObject) => ""; _.mapKeys(list); // $ExpectType Dictionary @@ -5605,9 +5359,6 @@ fp.now(); // $ExpectType number // _.mapValues { - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; const abcObjectOrNull: AbcObject | null = anything; const key: string = anything; @@ -5774,10 +5525,9 @@ fp.now(); // $ExpectType number _.chain(abcObject).mapValues(); // $ExpectType LoDashExplicitWrapper _.chain(abcObjectOrNull).mapValues(); // $ExpectType LoDashExplicitWrapper> - const valueIterator = (value: AbcObject) => ""; - fp.mapValues(valueIterator)(dictionary); // $ExpectType Dictionary + fp.mapValues(valueIterator)(dictionary); // $ExpectType Dictionary fp.mapValues("a", dictionary); // $ExpectType Dictionary - fp.mapValues(valueIterator)(numericDictionary); // $ExpectType Dictionary + fp.mapValues(valueIterator)(numericDictionary); // $ExpectType Dictionary fp.mapValues({ a: 42 })(numericDictionary); // $ExpectType Dictionary fp.mapValues(value => "", abcObjectOrNull); // $ExpectType { a: string; b: string; c: string; } } @@ -5788,24 +5538,24 @@ fp.now(); // $ExpectType number const dictionary: _.Dictionary = anything; const numericDictionary: _.NumericDictionary = anything; - _.omit(obj, "a"); // $ExpectType Partial + _.omit(obj, "a"); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.4 _.omit(obj, ["b", 1], 0, "a"); // $ExpectType Partial _.omit(dictionary, "a"); // $ExpectType Dictionary _.omit(numericDictionary, "a"); // $ExpectType NumericDictionary - _(obj).omit("a"); // $ExpectType LoDashImplicitWrapper> + _(obj).omit("a"); // ExpectType LoDashImplicitWrapper> // NOTE: ExpectType disabled because it fails in TS2.4 _(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashImplicitWrapper> _(dictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> - _.chain(obj).omit("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(obj).omit("a"); // ExpectType LoDashExplicitWrapper> // NOTE: ExpectType disabled because it fails in TS2.4 _.chain(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> - fp.omit("a", obj); // $ExpectType Partial - fp.omit("a")(obj); // $ExpectType Partial - fp.omit(["a", "b"])(obj); // $ExpectType Partial + fp.omit("a", obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.4 + fp.omit("a")(obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.3 + fp.omit(["a", "b"])(obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.3 } // _.omitBy @@ -5825,7 +5575,7 @@ fp.now(); // $ExpectType number const obj1: AbcObject | null | undefined = anything; const obj2: AbcObject = anything; const readonlyArray: string[] = ["a", "b"]; // TODO: Should be ReadonlyArray, but see comment on type Many - const literalsArray = ["a" as "a", "b" as "b"]; + const literalsArray: Array<"a" | "b"> = ["a", "b"]; const roLiteralsArray: Array<"a" | "b"> = literalsArray; // TODO: Should be ReadonlyArray, but see comment on type Many _.pick(obj1, "a"); // $ExpectType PartialDeep @@ -5857,7 +5607,7 @@ fp.now(); // $ExpectType number fp.pick("a", obj2); // $ExpectType Pick fp.pick("a")(obj2); // $ExpectType Pick - fp.pick(["a" as "a", "b" as "b"])(obj2); // $ExpectType Pick + fp.pick(literalsArray)(obj2); // $ExpectType Pick } // _.pickBy @@ -5953,7 +5703,6 @@ fp.now(); // $ExpectType number { const dictionary: _.Dictionary = {}; const numericDictionary: _.NumericDictionary = {}; - const abcObject: AbcObject = anything; _.toPairs(dictionary); // $ExpectType [string, number][] _.toPairs(numericDictionary); // $ExpectType [string, number][] @@ -6060,9 +5809,10 @@ fp.now(); // $ExpectType number _(object).unset(["a", "b"]); // $ExpectType LoDashImplicitWrapper _.chain(object).unset("a.b"); // $ExpectType LoDashExplicitWrapper _.chain(object).unset(["a", "b"]); // $ExpectType LoDashExplicitWrapper - fp.unset("a.b", object); // $ExpectType boolean - fp.unset("a.b")(object); // $ExpectType boolean - fp.unset(["a", "b"])(object); // $ExpectType boolean + + fp.unset("a.b", object); // $ExpectType { a: { b: string; c: boolean; }; } + fp.unset("a.b")(object); // $ExpectType { a: { b: string; c: boolean; }; } + fp.unset(["a", "b"])(object); // $ExpectType { a: { b: string; c: boolean; }; } } // _.update @@ -6107,8 +5857,6 @@ fp.now(); // $ExpectType number { const dict: _.Dictionary = {}; const numDict: _.NumericDictionary = {}; - const list: _.List | null | undefined = anything; - const object: AbcObject = anything; _.values(123); // $ExpectType any[] _.values(true); // $ExpectType any[] @@ -6118,7 +5866,7 @@ fp.now(); // $ExpectType number _.values(dict); // $ExpectType AbcObject[] _.values(numDict); // $ExpectType AbcObject[] _.values(list); // $ExpectType AbcObject[] - _.values(object); // $ExpectType (string | number | boolean)[] + _.values(abcObject); // $ExpectType (string | number | boolean)[] _(true).values(); // $ExpectType LoDashImplicitWrapper _("hi").values(); // $ExpectType LoDashImplicitWrapper @@ -6134,13 +5882,13 @@ fp.now(); // $ExpectType number fp.values(dict); // $ExpectType AbcObject[] fp.values(numDict); // $ExpectType AbcObject[] fp.values(list); // $ExpectType AbcObject[] - fp.values(object); // $ExpectType (string | number | boolean)[] + fp.values(abcObject); // $ExpectType (string | number | boolean)[] _.valuesIn([true, false]); // $ExpectType boolean[] _.valuesIn(dict); // $ExpectType AbcObject[] _.valuesIn(numDict); // $ExpectType AbcObject[] _.valuesIn(list); // $ExpectType AbcObject[] - _.valuesIn(object); // $ExpectType (string | number | boolean)[] + _.valuesIn(abcObject); // $ExpectType (string | number | boolean)[] _(dict).valuesIn(); // $ExpectType LoDashImplicitWrapper _.chain(dict).valuesIn(); // $ExpectType LoDashExplicitWrapper @@ -6148,7 +5896,7 @@ fp.now(); // $ExpectType number fp.valuesIn(dict); // $ExpectType AbcObject[] fp.valuesIn(numDict); // $ExpectType AbcObject[] fp.valuesIn(list); // $ExpectType AbcObject[] - fp.valuesIn(object); // $ExpectType (string | number | boolean)[] + fp.valuesIn(abcObject); // $ExpectType (string | number | boolean)[] } /******* @@ -6162,16 +5910,7 @@ fp.now(); // $ExpectType number _(true); // $ExpectType LoDashImplicitWrapper _([""]); // $ExpectType LoDashImplicitWrapper _({ a: "" }); // $ExpectType LoDashImplicitWrapper<{ a: string; }> - - { - const a: AbcObject[] = []; - _(a); // $ExpectType LoDashImplicitWrapper - } - - { - const a: AbcObject[] | null | undefined = anything; - _(a); // $ExpectType LoDashImplicitWrapper - } + _(array); // $ExpectType LoDashImplicitWrapper } // _.chain @@ -6318,7 +6057,6 @@ fp.now(); // $ExpectType number _.chain(numberROA).concat(numberROA); // $ExpectType LoDashExplicitWrapper _.chain(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashExplicitWrapper - const abcObject: AbcObject = { a: 1, b: 'foo', c: true }; const objectROA: AbcObject[] = [{ a: 1, b: 'foo', c: true }]; // TODO: Should be ReadonlyArray, but see comment on type Many _.concat(abcObject, abcObject); // $ExpectType AbcObject[] @@ -6888,28 +6626,25 @@ fp.now(); // $ExpectType number // _.matches { - const source: AbcObject = { a: 1, b: "", c: true }; + _.matches(abcObject); // $ExpectType (value: any) => boolean + _.matches(abcObject); // $ExpectType (value: AbcObject) => boolean + _(abcObject).matches(); // $ExpectType LoDashImplicitWrapper<(value: AbcObject) => boolean> + _.chain(abcObject).matches(); // $ExpectType LoDashExplicitWrapper<(value: AbcObject) => boolean> - _.matches(source); // $ExpectType (value: any) => boolean - _.matches(source); // $ExpectType (value: AbcObject) => boolean - _(source).matches(); // $ExpectType LoDashImplicitWrapper<(value: AbcObject) => boolean> - _.chain(source).matches(); // $ExpectType LoDashExplicitWrapper<(value: AbcObject) => boolean> - - fp.matches(source, {}); // $ExpectType boolean - fp.matches(source)({}); // $ExpectType boolean + fp.matches(abcObject, {}); // $ExpectType boolean + fp.matches(abcObject)({}); // $ExpectType boolean } // _.matchesProperty { const path: string | string[] = anything; - const source: AbcObject = { a: 1, b: "", c: true }; - _.matchesProperty(path, source); // $ExpectType (value: any) => boolean - _.matchesProperty(path, source); // $ExpectType (value: AbcObject) => boolean - _(path).matchesProperty(source); // $ExpectType LoDashImplicitWrapper<(value: any) => boolean> - _(path).matchesProperty(source); - _.chain(path).matchesProperty(source); // $ExpectType LoDashExplicitWrapper<(value: any) => boolean> - fp.matchesProperty(path, source); // $ExpectType (value: any) => boolean + _.matchesProperty(path, abcObject); // $ExpectType (value: any) => boolean + _.matchesProperty(path, abcObject); // $ExpectType (value: AbcObject) => boolean + _(path).matchesProperty(abcObject); // $ExpectType LoDashImplicitWrapper<(value: any) => boolean> + _(path).matchesProperty(abcObject); + _.chain(path).matchesProperty(abcObject); // $ExpectType LoDashExplicitWrapper<(value: any) => boolean> + fp.matchesProperty(path, abcObject); // $ExpectType (value: any) => boolean } // _.method @@ -6936,15 +6671,13 @@ fp.now(); // $ExpectType number // _.methodOf { - const object: AbcObject = anything; - - _.methodOf(object); // $ExpectType (path: Many) => any - _.methodOf(object, anything, anything, anything); // $ExpectType (path: Many) => any - _(object).methodOf(); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> - _(object).methodOf(anything, anything, anything); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> - _.chain(object).methodOf(); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> - _.chain(object).methodOf(anything, anything, anything); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> - fp.methodOf(object); // $ExpectType (path: Many) => any + _.methodOf(abcObject) as (path: _.Many<_.PropertyName>) => any; + _.methodOf(abcObject, anything, anything, anything) as (path: _.Many<_.PropertyName>) => any; + _(abcObject).methodOf() as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _(abcObject).methodOf(anything, anything, anything) as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _.chain(abcObject).methodOf() as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _.chain(abcObject).methodOf(anything, anything, anything) as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + fp.methodOf(abcObject) as (path: _.Many<_.PropertyName>) => any; } // _.mixin @@ -7076,9 +6809,9 @@ fp.now(); // $ExpectType number // _.propertyOf { - _.propertyOf({}); // $ExpectType (path: Many) => any - _({}).propertyOf(); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> - _.chain({}).propertyOf(); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> + _.propertyOf({}) as (path: _.Many<_.PropertyName>) => any; + _({}).propertyOf() as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _.chain({}).propertyOf() as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; fp.propertyOf(Symbol.iterator)([]); // $ExpectType any fp.propertyOf([Symbol.iterator], []); // $ExpectType any @@ -7251,11 +6984,10 @@ _.templateSettings; // $ExpectType TemplateSettings // with arity 3 function _.partialRight(func3, 42, _, true); - fp.partial([], func0); // $ExpectType (...args: any[]) => any - fp.partial([])(func0); // $ExpectType (...args: any[]) => any - fp.partial([42])(func1); // $ExpectType (...args: any[]) => any - fp.partial([fp.partial.placeholder, "foo"])(func2); - fp.partialRight([])(func0); // $ExpectType (...args: any[]) => any - fp.partialRight([42])(func1); // $ExpectType (...args: any[]) => any - fp.partialRight([fp.partialRight.placeholder, "foo"])(func2); + fp.partial(func1, [42]); // $ExpectType Function0 + fp.partial(func1)([42]); // $ExpectType Function0 + fp.partial(func2)([fp.partial.placeholder, "foo"]); // $ExpectType Function1 + fp.partialRight(func1, [42]); // $ExpectType Function0 + fp.partialRight(func1)([42]); // $ExpectType Function0 + fp.partialRight(func2)([42, fp.partialRight.placeholder]); // $ExpectType Function1 } diff --git a/types/lodash/scripts/generate-fp.ts b/types/lodash/scripts/generate-fp.ts index 77f11b46ac..9a03fef544 100644 --- a/types/lodash/scripts/generate-fp.ts +++ b/types/lodash/scripts/generate-fp.ts @@ -174,15 +174,14 @@ async function processDefinitions(filePaths: string[], commonTypes: string[]): P } else if (args.length > 4 || definition.name === "flow" || definition.name === "flowRight") { // Arity wasn't fixed by convert() isFixed = false; - } else { - // For some reason, convert() doesn't seems to tell us which functions have unchanged argument order. - // So we have to hard-code it. - const unchangedOrders = ["add", "assign", "assignIn", "bind", "bindKey", "concat", "difference", "divide", "eq", - "gt", "gte", "isEqual", "lt", "lte", "matchesProperty", "merge", "multiply", "overArgs", "partial", "partialRight", - "propertyOf", "random", "range", "rangeRight", "subtract", "zip", "zipObject", "zipObjectDeep"]; - if (unchangedOrders.includes(definition.name)) - args = _.sortBy(args as number[][], (a: number[]) => a[0]); } + // For some reason, convert() doesn't seems to tell us which functions have unchanged argument order. + // So we have to hard-code it. + const unchangedOrders = ["add", "assign", "assignIn", "bind", "bindKey", "concat", "difference", "divide", "eq", + "gt", "gte", "isEqual", "lt", "lte", "matchesProperty", "merge", "multiply", "overArgs", "partial", "partialRight", + "propertyOf", "random", "range", "rangeRight", "subtract", "zip", "zipObject", "zipObjectDeep"]; + if (unchangedOrders.includes(definition.name)) + args = _.sortBy(args, a => typeof a === "number" ? a : a[0]); return () => curryDefinition(definition, _.flatten(args), spreadIndex, isFixed); }; @@ -324,6 +323,12 @@ function parseDefinitions(definitionString: string, startIndex: number, endIndex .map(o => _.trim(o, ",")) .filter(o => !!o); overload.returnType = overloadString.substring(paramEndIndex + 2).trim(); + // Special case for unset: the return type should be the input type, not bolean. See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/25361 + if (name === "unset") { + overload.typeParams = [{ name: "T" }]; + overload.params[0] = overload.params[0].replace(/\bany\b/, "T"); + overload.returnType = "T"; + } currentDefinition.overloads.push(overload); } else { // This overload actually points to an interface. Try to find said interface and get the overloads from there. @@ -433,25 +438,33 @@ function curryDefinition(definition: Definition, paramOrder: number[], spreadInd // Spread/rest parameters could be in any of the following formats: // 1. The rest parameter is at spreadIndex, and it is the last parameter. // 2. The rest parameter is immediately after spreadIndex, e.g. assign(object, ...sources[]). In this case, convert it to assignAll(...object[]) - // 3. The rest parameter is not the last parameter, e.g. assignWith(object, ...sources[], customizer) + // 3. The overload defines no rest parameters, e.g. mergeAll(T1, T2, T3) + // 4. The rest parameter is not the last parameter, e.g. assignWith(object, ...sources[], customizer) if (spreadIndex === arity - 1) { - // cases 1-2 for (let i = 0; i < overloads.length; ++i) { const overload = overloads[i]; if (overload.params.length === arity && overload.params[spreadIndex] && overload.params[spreadIndex].startsWith("...")) { + // case 1 overload.params[spreadIndex] = overload.params[spreadIndex].replace("...", ""); } else if (overload.params.length === arity + 1 && overload.params[spreadIndex + 1] && overload.params[spreadIndex + 1].startsWith("...")) { + // case 2 overload.params.splice(spreadIndex + 1, 1); const parts = overload.params[spreadIndex].split(":").map(_.trim); parts[1] = `ReadonlyArray<${parts[1]}>`; overload.params[spreadIndex] = `${parts[0]}: ${parts[1]}`; + } else if (overload.params.length >= arity && overload.params[spreadIndex] && !overload.params.some(p => p.startsWith("..."))) { + // case 3 + const paramName = getParamName(overload.params[spreadIndex]); + const spreadParamTypes = overload.params.slice(spreadIndex).map(getParamType); + overload.params = overload.params.slice(0, spreadIndex); + overload.params.push(`${paramName}: [${spreadParamTypes.join(", ")}]`); } else { _.pull(overloads, overload); --i; } } } else { - // case 3 + // case 4 const overload = overloads[0]; overloads = [{ jsdoc: overload.jsdoc, diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index 087ce2aadd..c743db10ce 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -4,6 +4,7 @@ // Tim Schumacher // Sequoia McDowell // Mike Crowe +// Karim Alibhai // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -18,6 +19,13 @@ import { NextFunction, RequestHandler } from "express"; declare function l(): l.LoopBackApplication; declare namespace l { + /** + * General type for a callback to an async function. + */ + type CallbackWithoutResult = (err: Error | null) => any; + type CallbackWithResult = (err: Error | null, result: T) => any; + type CallbackWithMultipleResults = (err: Error | null, arg0: T, arg1: G) => any; + /** * The `App` object represents a Loopback application * The App object extends [Express](expressjs.com/api.html#express) and @@ -1183,7 +1191,16 @@ declare namespace l { * @param {any} options An optional options object to pass to underlying data-access calls. * @param {() => void} callback Callback function */ - static bulkUpdate(updates: any[], options: any, callback?: () => void): Promise | void; + static bulkUpdate(updates: any[], options: any, callback: CallbackWithoutResult): void; + + /** + * Apply an update list + * **Note: this is not atomic* + * @param {Array} updates An updates list, usually from [createUpdates()](#persistedmodel-createupdates). + * @param {any} options An optional options object to pass to underlying data-access calls. + * @param {() => void} callback Callback function + */ + static bulkUpdate(updates: any[], options: any): Promise; /** * Get the changes to a model since the specified checkpoint. Provide a filter object @@ -1194,13 +1211,29 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {Array} changes An Array of [Change](#change) objects */ - static changes(since: number, filter: any, callback?: (err: Error, changes: any[]) => void): Promise | void; + static changes(since: number, filter: any, callback: CallbackWithResult): void; + + /** + * Get the changes to a model since the specified checkpoint. Provide a filter object + * to reduce the number of results returned. + * @param {number} since Return only changes since this checkpoint. + * @param {any} filter Include only changes that match this filter, the same as for [#persistedmodel-find](find()). + * @callback {() => void} callback Callback function called with `(err, changes)` arguments. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {Array} changes An Array of [Change](#change) objects + */ + static changes(since: number, filter: any): Promise; /** * Create a checkpoint * @param {() => void} callback */ - static checkpoint(callback?: () => void): Promise | void; + static checkpoint(callback?: () => void): void; + + /** + * Create a checkpoint + */ + static checkpoint(): Promise; /** * Return the number of records that match the optional "where" filter. @@ -1214,7 +1247,21 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {number} count number of instances updated */ - static count(where?: any, callback?: (err: Error, count: number) => void): Promise | void; + static count(where: any, callback: CallbackWithResult): void; + + /** + * Return the number of records that match the optional "where" filter. + * @param {any} [where] Optional where filter, like + * ``` + * { key: val, key2: {gt: 'val2'}, ...} + * ``` + *
See + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods). + * @callback {() => void} callback Callback function called with `(err, count)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {number} count number of instances updated + */ + static count(where?: any): Promise; /** * Create new instance of Model, and save to database @@ -1223,14 +1270,37 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} models Model instances or null */ - static create(data?: any|any[], callback?: (err: Error, models: T|T[]) => void): Promise | void; + static create(data: any | any[], callback: CallbackWithResult): void; + + /** + * Create new instance of Model, and save to database + * @param {any}|[{any}] data Optional data argument. Can be either a single model instance or an Array of instances + * @returns {T | T[]} Model instances or null + */ + static create(data?: any|any[]): Promise; /** * Create a change stream. See here for more info http://loopback.io/doc/en/lb2/Realtime-server-sent-events.html * @param {any} options Only changes to models matching this where filter will be included in the ChangeStream. * @param {() => void} callback */ - static createChangeStream(options: {where: any}, callback?: (err: Error, changes: any) => void): Promise | void; + static createChangeStream( + options: { + where: any; + }, + callback: CallbackWithResult + ): void; + + /** + * Create a change stream. See here for more info http://loopback.io/doc/en/lb2/Realtime-server-sent-events.html + * @param {any} options Only changes to models matching this where filter will be included in the ChangeStream. + * @returns {any} changes + */ + static createChangeStream( + options: { + where: any; + } + ): Promise; /** * Create an update list (for `Model.bulkUpdate()`) from a delta list @@ -1238,7 +1308,14 @@ declare namespace l { * @param {Array} deltas * @param {() => void} callback */ - static createUpdates(deltas: any[], callback?: () => void): Promise | void; + static createUpdates(deltas: any[], callback: CallbackWithoutResult): void; + + /** + * Create an update list (for `Model.bulkUpdate()`) from a delta list + * (result of `Change.diff()`) + * @param {Array} deltas + */ + static createUpdates(deltas: any[]): Promise; /** * Get the current checkpoint ID @@ -1246,7 +1323,13 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {number} currentCheckpointId Current checkpoint ID */ - static currentCheckpoint(callback?: (err: Error, currentCheckpointId: number) => void): Promise | void; + static currentCheckpoint(callback: CallbackWithResult): void; + + /** + * Get the current checkpoint ID + * @returns {Promise} resolves to currentCheckpointId + */ + static currentCheckpoint(): Promise; /** * Destroy all model instances that match the optional `where` specification @@ -1262,7 +1345,20 @@ declare namespace l { * @param {any} info Additional information about the command outcome. * @param {number} info.count number of instances (rows, documents) destroyed */ - static destroyAll(where?: any, callback?: (err: Error, info: any, infoCount: number) => void): Promise<{ info: any, infoCount: number}> | void; + static destroyAll(where: any, callback: CallbackWithMultipleResults): void; + + /** + * Destroy all model instances that match the optional `where` specification + * @param {any} [where] Optional where filter, like: + * ``` + * {key: val, key2: {gt: 'val2'}, ...} + * ``` + *
See + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods) + * + * @returns {Promise<{ count: number }>} number of instances (rows, documents) destroyed + */ + static destroyAll(where?: any): Promise<{ info: any, infoCount: number}>; /** * Destroy model instance with the specified ID. @@ -1270,7 +1366,13 @@ declare namespace l { * @callback {() => void} callback Callback function called with `(err)` arguments. Required. * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object) */ - static destroyById(id: any, callback?: (err: Error) => void): Promise | void; + static destroyById(id: any, callback: CallbackWithoutResult): void; + + /** + * Destroy model instance with the specified ID. + * @param {*} id The ID value of model instance to delete. + */ + static destroyById(id: any): Promise; /** * Get a set of deltas and conflicts since the given checkpoint @@ -1281,7 +1383,15 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} result any with `deltas` and `conflicts` properties; see [Change.diff()](#change-diff) for details */ - static diff(since: number, remoteChanges: any[], callback?: (err: Error, result: any) => void): Promise | void; + static diff(since: number, remoteChanges: any[], callback: CallbackWithResult): void; + + /** + * Get a set of deltas and conflicts since the given checkpoint + * See [Change.diff()](#change-diff) for details + * @param {number} since Find deltas since this checkpoint. + * @param {Array} remoteChanges An Array of change objects. + */ + static diff(since: number, remoteChanges: any[]): Promise; /** * Enable the tracking of changes made to the model. Usually for replication. @@ -1295,7 +1405,24 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {boolean} exists True if the instance with the specified ID exists; false otherwise */ - static exists(id: any, callback?: (err: Error, exists: boolean) => void): Promise | void; + static exists(id: any, callback: CallbackWithResult): void; + + /** + * Check whether a model instance exists in database + * @param {id} id Identifier of object (primary key value) + */ + static exists(id: any): Promise; + + /** + * Find all model instances that match `filter` specification. + * See [Querying models](docs.strongloop.com/display/LB/Querying+models) + * @callback {() => void} callback Callback function called with `(err, returned-instances)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {Array} models Model instances matching the filter, or null if none found + */ + static find( + callback: CallbackWithResult + ): void; /** * Find all model instances that match `filter` specification. @@ -1322,8 +1449,60 @@ declare namespace l { * @param {Array} models Model instances matching the filter, or null if none found */ static find( - filter?: {fields?: string|any|any[]; include?: string|any|any[]; limit?: number; order?: string; skip?: number; where?: any; }, - callback?: (err: Error, models: any[]) => void): Promise | void; + filter: { + fields?: string|any|any[]; + include?: string|any|any[]; + limit?: number; + order?: string; + skip?: number; + where?: any; + }, + callback: CallbackWithResult + ): void; + + /** + * Find all model instances that match `filter` specification. + * See [Querying models](docs.strongloop.com/display/LB/Querying+models) + * @options {any} [filter] Optional Filter JSON object; see below. + * @property {string|any|Array} fields Identify fields to include in return result. + *
See [Fields filter](docs.strongloop.com/display/LB/Fields+filter). + * @property {string|any|Array} include See PersistedModel.include documentation. + *
See [Include filter](docs.strongloop.com/display/LB/Include+filter). + * @property {number} limit Maximum number of instances to return. + *
See [Limit filter](docs.strongloop.com/display/LB/Limit+filter). + * @property {string} order Sort order: either "ASC" for ascending or "DESC" for descending. + *
See [Order filter](docs.strongloop.com/display/LB/Order+filter). + * @property {number} skip number of results to skip. + *
See [Skip filter](docs.strongloop.com/display/LB/Skip+filter). + * @property {any} where Where clause, like + * ``` + * { where: { key: val, key2: {gt: 'val2'}, ...} } + * ``` + *
See + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforqueries) + */ + static find( + filter?: { + fields?: string|any|any[]; + include?: string|any|any[]; + limit?: number; + order?: string; + skip?: number; + where?: any; + } + ): Promise; + + /** + * Find object by ID with an optional filter for include/fields + * @param {*} id Primary key value + * @callback {() => void} callback Callback function called with `(err, instance)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} instance Model instance matching the specified ID or null if no instance matches + */ + static findById( + id: any, + callback: CallbackWithResult + ): void; /** * Find object by ID with an optional filter for include/fields @@ -1337,7 +1516,43 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Model instance matching the specified ID or null if no instance matches */ - static findById(id: any, filter?: {fields?: string|any|any[]; include?: string|any|any[]; }, callback?: (err: Error, instance: T) => void): Promise | void; + static findById( + id: any, + filter: { + fields?: string|any|any[]; + include?: string|any|any[]; + }, + callback: CallbackWithResult + ): void; + + /** + * Find object by ID with an optional filter for include/fields + * @param {*} id Primary key value + * @options {any} [filter] Optional Filter JSON object; see below. + * @property {string|any|Array} fields Identify fields to include in return result. + *
See [Fields filter](docs.strongloop.com/display/LB/Fields+filter). + * @property {string|any|Array} include See PersistedModel.include documentation. + *
See [Include filter](docs.strongloop.com/display/LB/Include+filter). + */ + static findById( + id: any, + filter?: { + fields?: string|any|any[]; + include?: string|any|any[]; + }, + ): Promise; + + /** + * Find one model instance that matches `filter` specification. + * Same as `find`, but limited to one result; + * Returns object, not collection + * @callback {() => void} callback Callback function called with `(err, returned-instance)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {Array} model First model instance that matches the filter or null if none found + */ + static findOne( + callback: CallbackWithResult + ): void; /** * Find one model instance that matches `filter` specification. @@ -1363,14 +1578,63 @@ declare namespace l { * @param {Array} model First model instance that matches the filter or null if none found */ static findOne( - filter?: { + filter: { fields?: string|any|any[]; include?: string|any|any[]; order?: string; skip?: number; where?: any; }, - callback?: (err: Error, instance: T) => void): Promise | void; + callback: CallbackWithResult + ): void; + + /** + * Find one model instance that matches `filter` specification. + * Same as `find`, but limited to one result; + * Returns object, not collection + * @options {any} [filter] Optional Filter JSON object; see below. + * @property {string|any|Array} fields Identify fields to include in return result. + *
See [Fields filter](docs.strongloop.com/display/LB/Fields+filter). + * @property {string|any|Array} include See PersistedModel.include documentation. + *
See [Include filter](docs.strongloop.com/display/LB/Include+filter). + * @property {string} order Sort order: either "ASC" for ascending or "DESC" for descending. + *
See [Order filter](docs.strongloop.com/display/LB/Order+filter). + * @property {number} skip number of results to skip. + *
See [Skip filter](docs.strongloop.com/display/LB/Skip+filter). + * @property {any} where Where clause, like + * ``` + * {where: { key: val, key2: {gt: 'val2'}, ...} } + * ``` + *
See + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforqueries) + */ + static findOne( + filter?: { + fields?: string|any|any[]; + include?: string|any|any[]; + order?: string; + skip?: number; + where?: any; + } + ): Promise; + + /** + * Finds one record matching the optional filter object. If not found, creates + * the object using the data provided as second argument. In this sense it is + * the same as `find`, but limited to one object. Returns an object, not + * collection. If you don't provide the filter object argument, it tries to + * locate an existing object that matches the `data` argument + * + * @param {any} data Data to insert if object matching the `where` filter is not found. + * @callback {() => void} callback Callback function called with `cb(err, instance, created)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} instance Model instance matching the `where` filter, if found. + * @param {boolean} created True if the instance matching the `where` filter was created + */ + static findOrCreate( + data: any, + callback: CallbackWithMultipleResults + ): void; /** * Finds one record matching the optional filter object. If not found, creates @@ -1404,7 +1668,7 @@ declare namespace l { */ static findOrCreate( data: any, - filter?: { + filter: { fields?: string | any | any[]; include?: string | any | any[]; limit?: number; @@ -1412,7 +1676,46 @@ declare namespace l { skip?: number; where?: any; }, - callback?: (err: Error, instance: any, created: boolean) => void): Promise<{instance: T, created: boolean}> | void; + callback: CallbackWithMultipleResults + ): void; + + /** + * Finds one record matching the optional filter object. If not found, creates + * the object using the data provided as second argument. In this sense it is + * the same as `find`, but limited to one object. Returns an object, not + * collection. If you don't provide the filter object argument, it tries to + * locate an existing object that matches the `data` argument + * + * @options {any} [filter] Optional Filter object; see below. + * @property {string|any|Array} fields Identify fields to include in return result. + *
See [Fields filter](docs.strongloop.com/display/LB/Fields+filter). + * @property {string|any|Array} include See PersistedModel.include documentation. + *
See [Include filter](docs.strongloop.com/display/LB/Include+filter). + * @property {number} limit Maximum number of instances to return. + *
See [Limit filter](docs.strongloop.com/display/LB/Limit+filter). + * @property {string} order Sort order: either "ASC" for ascending or "DESC" for descending. + *
See [Order filter](docs.strongloop.com/display/LB/Order+filter). + * @property {number} skip number of results to skip. + *
See [Skip filter](docs.strongloop.com/display/LB/Skip+filter). + * @property {any} where Where clause, like + * ``` + * {where: {key: val, key2: {gt: val2}, ...}} + * ``` + *
See + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforqueries). + * @param {any} data Data to insert if object matching the `where` filter is not found. + */ + static findOrCreate( + data: any, + filter?: { + fields?: string | any | any[]; + include?: string | any | any[]; + limit?: number; + order?: string; + skip?: number; + where?: any; + } + ): Promise<{instance: T, created: boolean}>; /** * Get the `Change` model. @@ -1432,7 +1735,12 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {string} sourceId Source identifier for the model or dataSource */ - static getSourceId(callback?: (err: Error, sourceId: string) => void): Promise | void; + static getSourceId(callback: CallbackWithResult): void; + + /** + * Get the source identifier for this model or dataSource + */ + static getSourceId(): Promise; /** * Handle a change error. Override this method in a subclassing model to customize @@ -1447,7 +1755,29 @@ declare namespace l { * @callback {() => void} callback * @param {Error} er */ - static rectifyChange(id: any, callback?: (err: Error) => void): Promise | void; + static rectifyChange(id: any, callback: CallbackWithoutResult): void; + + /** + * Specify that a change to the model with the given ID has occurred + * @param {*} id The ID of the model that has changed. + */ + static rectifyChange(id: any): Promise; + + /** + * Replace attributes for a model instance whose id is the first input + * argument and persist it into the datasource. + * Performs validation before replacing + * @param {*} id The ID value of model instance to replace. + * @param {any} data Data to replace. + * @callback {() => void} callback Callback function called with `(err, instance)` arguments. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} instance Replaced instance + */ + static replaceById( + id: any, + data: any, + callback: CallbackWithResult + ): void; /** * Replace attributes for a model instance whose id is the first input @@ -1461,7 +1791,45 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Replaced instance */ - static replaceById(id: any, data: any, options?: {validate: boolean; }, callback?: (err: Error, instance: T) => void): Promise | void; + static replaceById( + id: any, + data: any, + options: { + validate: boolean; + }, + callback: CallbackWithResult + ): void; + + /** + * Replace attributes for a model instance whose id is the first input + * argument and persist it into the datasource. + * Performs validation before replacing + * @param {*} id The ID value of model instance to replace. + * @param {any} data Data to replace. + * @options {any} [options] Options for replace + * @property {boolean} validate Perform validation before saving. Default is true. + */ + static replaceById( + id: any, + data: any, + options?: { + validate: boolean; + } + ): Promise; + + /** + * Replace or insert a model instance; replace existing record if one is found, + * such that parameter `data.id` matches `id` of model instance; otherwise, + * insert a new record. + * @param {any} data The model instance data. + * @callback {() => void} callback Callback function called with `cb(err, obj)` signature. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} model Replaced model instance. + */ + static replaceOrCreate( + data: any, + callback: CallbackWithResult + ): void; /** * Replace or insert a model instance; replace existing record if one is found, @@ -1474,7 +1842,28 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} model Replaced model instance. */ - static replaceOrCreate(data: any, options?: {validate: boolean; }, callback?: (err: Error, instance: T) => void): Promise | void; + static replaceOrCreate( + data: any, + options: { + validate: boolean; + }, + callback: CallbackWithResult + ): void; + + /** + * Replace or insert a model instance; replace existing record if one is found, + * such that parameter `data.id` matches `id` of model instance; otherwise, + * insert a new record. + * @param {any} data The model instance data. + * @options {any} [options] Options for replaceOrCreate + * @property {boolean} validate Perform validation before saving. Default is true. + */ + static replaceOrCreate( + data: any, + options?: { + validate: boolean; + } + ): Promise; /** * Replicate changes since the given checkpoint to the given target model @@ -1485,7 +1874,7 @@ declare namespace l { * @callback {() => void} [callback] Callback function called with `(err, conflicts)` arguments. * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {Conflict[]} conflicts A list of changes that could not be replicated due to conflicts. - * @param {any] checkpoints The new checkpoints to use as the "since" + * @param {any} checkpoints The new checkpoints to use as the "since" * argument for the next replication */ static replicate( @@ -1496,6 +1885,18 @@ declare namespace l { callback?: (err: Error, conflicts: Conflict[], param: any) => void ): Promise<{conflicts: Conflict[], params: any}> | void; + /** + * Update multiple instances that match the where clause. + * @callback {() => void} callback Callback function called with `(err, info)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} info Additional information about the command outcome. + * @param {number} info.count number of instances (rows, documents) updated. + * + */ + static updateAll( + callback: CallbackWithMultipleResults + ): void; + /** * Update multiple instances that match the where clause. * @@ -1521,7 +1922,65 @@ declare namespace l { * @param {number} info.count number of instances (rows, documents) updated. * */ - static updateAll(where?: any, data?: any, callback?: (err: Error, info: any, infoCount: number) => void): Promise | void; + static updateAll( + whereOrData: any, + callback: CallbackWithMultipleResults + ): void; + + /** + * Update multiple instances that match the where clause. + * + * Example: + * + * ```js + * Employee.updateAll({managerId: 'x001'}, {managerId: 'x002'}, function(err, info) { + * ... + * }); + * ``` + * + * @param {any} [where] Optional `where` filter, like + * ``` + * { key: val, key2: {gt: 'val2'}, ...} + * ``` + *
see + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods). + * @param {any} data any containing data to replace matching instances, if any. + * + * @callback {() => void} callback Callback function called with `(err, info)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} info Additional information about the command outcome. + * @param {number} info.count number of instances (rows, documents) updated. + * + */ + static updateAll( + where: any, + data: any, + callback: CallbackWithMultipleResults + ): void; + + /** + * Update multiple instances that match the where clause. + * + * Example: + * + * ```js + * Employee.updateAll({managerId: 'x001'}, {managerId: 'x002'}, function(err, info) { + * ... + * }); + * ``` + * + * @param {any} [where] Optional `where` filter, like + * ``` + * { key: val, key2: {gt: 'val2'}, ...} + * ``` + *
see + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods). + * @param {any} data any containing data to replace matching instances, if any. + */ + static updateAll( + where?: any, + data?: any + ): Promise; /** * Update or insert a model instance @@ -1530,7 +1989,21 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} model Updated model instance */ - static upsert(data: any, callback?: (err: Error, instance: T) => void): Promise | void; + static upsert( + data: any, + callback: CallbackWithResult + ): void; + + /** + * Update or insert a model instance + * @param {any} data The model instance data to insert. + * @callback {() => void} callback Callback function called with `cb(err, obj)` signature. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} model Updated model instance + */ + static upsert( + data: any + ): Promise; /** * Update or insert a model instance based on the search criteria. @@ -1548,14 +2021,40 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} model Updated model instance */ - static upsertWithWhere(data: any, callback?: (err: Error, instance: T) => void): Promise | void; + static upsertWithWhere( + data: any, + callback: CallbackWithResult + ): void; + + /** + * Update or insert a model instance based on the search criteria. + * If there is a single instance retrieved, update the retrieved model. + * Creates a new model if no model instances were found. + * Returns an error if multiple instances are found. + * * @param {any} [where] `where` filter, like + * ``` + * { key: val, key2: {gt: 'val2'}, ...} + * ``` + *
see + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods). + * @param {any} data The model instance data to insert. + */ + static upsertWithWhere( + data: any + ): Promise; /** * Deletes the model from persistence. * Triggers `destroy` hook (async) before and after destroying object. * @param {() => void} callback Callback function */ - destroy(callback?: () => void): Promise | void; + destroy(callback: CallbackWithoutResult): void; + + /** + * Deletes the model from persistence. + * Triggers `destroy` hook (async) before and after destroying object. + */ + destroy(): Promise; /** * Get the `id` value for the `PersistedModel` @@ -1581,7 +2080,25 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Model instance */ - reload(callback: (err: Error, instance: T) => void): Promise | void; + reload(callback: CallbackWithResult): void; + + /** + * Reload object from persistence. Requires `id` member of `object` to be able to call `find`. + */ + reload(): Promise; + + /** + * Replace attributes for a model instance and persist it into the datasource. + * Performs validation before replacing + * @param {any} data Data to replace. + * @callback {() => void} callback Callback function called with `(err, instance)` arguments. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} instance Replaced instance + */ + replaceAttributes( + data: any, + callback: CallbackWithResult + ): void; /** * Replace attributes for a model instance and persist it into the datasource. @@ -1593,7 +2110,38 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Replaced instance */ - replaceAttributes(data: any, options?: {validate: boolean}, callback?: (err: Error, instance: T) => void): Promise | void; + replaceAttributes( + data: any, + options: { + validate: boolean + }, + callback: CallbackWithResult + ): void; + + /** + * Replace attributes for a model instance and persist it into the datasource. + * Performs validation before replacing + * @param {any} data Data to replace. + * @options {any} [options] Options for replace + * @property {boolean} validate Perform validation before saving. Default is true. + */ + replaceAttributes( + data: any, + options?: { + validate: boolean + } + ): Promise; + + /** + * Save model instance. If the instance doesn't have an ID, then calls [create](#persistedmodelcreatedata-cb) instead. + * Triggers: validate, save, update, or create. + * @callback {() => void} callback Optional callback function called with `(err, obj)` arguments. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} instance Model instance saved or created + */ + save( + callback: CallbackWithResult + ): void; /** * Save model instance. If the instance doesn't have an ID, then calls [create](#persistedmodelcreatedata-cb) instead. @@ -1606,7 +2154,28 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Model instance saved or created */ - save(options?: {validate: boolean; throws: boolean}, callback?: (err: Error, instance: T) => void): Promise | void; + save( + options: { + validate: boolean; + throws: boolean + }, + callback: CallbackWithResult + ): void; + + /** + * Save model instance. If the instance doesn't have an ID, then calls [create](#persistedmodelcreatedata-cb) instead. + * Triggers: validate, save, update, or create. + * @options {any} [options] See below. + * @property {boolean} validate Perform validation before saving. Default is true. + * @property {boolean} throws If true, throw a validation error; WARNING: This can crash Node. + * If false, report the error via callback. Default is false. + */ + save( + options?: { + validate: boolean; + throws: boolean + } + ): Promise; /** * Set the correct `id` property for the `PersistedModel`. Uses the `setId` method if the model is attached to @@ -1625,7 +2194,22 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Updated instance */ - updateAttribute(name: string, value: any, callback?: (err: Error, instance: T) => void): Promise | void; + updateAttribute( + name: string, + value: any, + callback: CallbackWithResult + ): void; + + /** + * Update a single attribute. + * Equivalent to `updateAttributes({name: 'value'}, cb) + * @param {string} name Name of property. + * @param {any} value Value of property. + */ + updateAttribute( + name: string, + value: any + ): Promise; /** * Update set of attributes. Performs validation before updating @@ -1635,7 +2219,19 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Updated instance */ - updateAttributes(data: any, callback?: (err: Error, instance: T) => void): Promise | void; + updateAttributes( + data: any, + callback: CallbackWithResult + ): void; + + /** + * Update set of attributes. Performs validation before updating + * Triggers: `validation`, `save` and `update` hooks + * @param {any} data Data to update. + */ + updateAttributes( + data: any + ): Promise; // **NOTE** Deprecate for v3.x // /** @@ -1688,6 +2284,7 @@ declare namespace l { // */ // createany(options: any, optionsWhere: any, callback: (err: Error, changes: any) => void): void; } + // END OF PERSISTED MODEL /** * Serve the LoopBack favicon. diff --git a/types/loopback/loopback-tests.ts b/types/loopback/loopback-tests.ts index 359e6977b6..cb015fc0bd 100644 --- a/types/loopback/loopback-tests.ts +++ b/types/loopback/loopback-tests.ts @@ -36,7 +36,7 @@ class Server { console.dir(data.name); } - model.findOne({}, (err: Error, instance: TestModel) => { + model.findOne({}, (err: Error | null, instance: TestModel) => { if (err) { console.dir(err); } diff --git a/types/lowdb/_lodash.d.ts b/types/lowdb/_lodash.d.ts index 78ff4901af..a7d2c424f0 100644 --- a/types/lowdb/_lodash.d.ts +++ b/types/lowdb/_lodash.d.ts @@ -1263,11 +1263,15 @@ declare module "./index" { ): LoDashExplicitSyncWrapper; omit( this: LoDashExplicitSyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitSyncWrapper; + omit( + this: LoDashExplicitSyncWrapper, + ...paths: Array<_.Many> + ): LoDashExplicitSyncWrapper<_.Omit>; omit( this: LoDashExplicitSyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitSyncWrapper<_.PartialObject>; omitBy( this: LoDashExplicitSyncWrapper, @@ -2827,11 +2831,15 @@ declare module "./index" { ): LoDashExplicitAsyncWrapper; omit( this: LoDashExplicitAsyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitAsyncWrapper; + omit( + this: LoDashExplicitAsyncWrapper, + ...paths: Array<_.Many> + ): LoDashExplicitAsyncWrapper<_.Omit>; omit( this: LoDashExplicitAsyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitAsyncWrapper<_.PartialObject>; omitBy( this: LoDashExplicitAsyncWrapper, diff --git a/types/material-components-web/index.d.ts b/types/material-components-web/index.d.ts index c5d1434942..f1f9874f4b 100644 --- a/types/material-components-web/index.d.ts +++ b/types/material-components-web/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -23,13 +23,17 @@ import autoInit from 'material__auto-init'; import * as base from 'material__base'; import * as checkbox from 'material__checkbox'; +import * as chips from 'material__chips'; import * as dialog from 'material__dialog'; import * as drawer from 'material__drawer'; +import * as floatingLabel from 'material__floating-label'; import * as formField from 'material__form-field'; import * as gridList from 'material__grid-list'; import * as iconToggle from 'material__icon-toggle'; import * as linearProgress from 'material__linear-progress'; +import * as lineRipple from 'material__line-ripple'; import * as menu from 'material__menu'; +import * as notchedOutline from 'material__notched-outline'; import * as radio from 'material__radio'; import * as ripple from 'material__ripple'; import * as select from 'material__select'; @@ -39,19 +43,23 @@ import * as snackbar from 'material__snackbar'; import * as tabs from 'material__tabs'; import * as textField from 'material__textfield'; import * as toolbar from 'material__toolbar'; - +import * as topAppBar from 'material__top-app-bar'; // Export all components. export { autoInit, base, checkbox, + chips, dialog, drawer, + floatingLabel, formField, gridList, iconToggle, + lineRipple, linearProgress, menu, + notchedOutline, radio, ripple, select, @@ -61,4 +69,5 @@ export { tabs, textField, toolbar, + topAppBar }; diff --git a/types/material__animation/index.d.ts b/types/material__animation/index.d.ts index 8baf562003..2527cf9e71 100644 --- a/types/material__animation/index.d.ts +++ b/types/material__animation/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/material__auto-init/index.d.ts b/types/material__auto-init/index.d.ts index 026b692b99..2993089fce 100644 --- a/types/material__auto-init/index.d.ts +++ b/types/material__auto-init/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -32,6 +32,8 @@ export interface MDCAutoInit { /** * Auto-initializes all mdc components on a page. */ +// tslint:disable-next-line:strict-export-declare-modifiers declare const mdcAutoInit: MDCAutoInit; +// tslint:disable-next-line:strict-export-declare-modifiers export default mdcAutoInit; diff --git a/types/material__base/component.d.ts b/types/material__base/component.d.ts index 0a645b26a4..43c085cdce 100644 --- a/types/material__base/component.d.ts +++ b/types/material__base/component.d.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -17,7 +17,7 @@ import MDCFoundation from './foundation'; -export class MDCComponent> { +export default class MDCComponent> { static attachTo(root: Element): MDCComponent>; constructor(root: Element, foundation?: F, ...args: any[]); @@ -45,13 +45,13 @@ export class MDCComponent> { * Wrapper method to add an event listener to the component's root element. This is most useful when * listening for custom events. */ - listen(evtType: string, handler: EventListenerOrEventListenerObject): void; + listen(evtType: string, handler: EventListener): void; /** * Wrapper method to remove an event listener to the component's root element. This is most useful when * unlistening for custom events. */ - unlisten(evtType: string, handler: EventListenerOrEventListenerObject): void; + unlisten(evtType: string, handler: EventListener): void; /** * Fires a cross-browser-compatible custom event from the component root of the given type, @@ -59,5 +59,3 @@ export class MDCComponent> { */ emit(evtType: string, evtData: any, shouldBubble?: boolean): void; } - -export default MDCComponent; diff --git a/types/material__base/foundation.d.ts b/types/material__base/foundation.d.ts index 7612d0daea..7bd61ec18e 100644 --- a/types/material__base/foundation.d.ts +++ b/types/material__base/foundation.d.ts @@ -23,7 +23,7 @@ export interface MDCNumbers { [key: string]: number; } -export class MDCFoundation { +export default class MDCFoundation { static readonly cssClasses: MDCStrings; static readonly strings: MDCStrings; @@ -40,5 +40,3 @@ export class MDCFoundation { // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) destroy(): void; } - -export default MDCFoundation; diff --git a/types/material__base/index.d.ts b/types/material__base/index.d.ts index 0172cb35f6..bc4d2ee1a3 100644 --- a/types/material__base/index.d.ts +++ b/types/material__base/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,7 +21,7 @@ * limitations under the License. */ -import { MDCNumbers, MDCStrings, MDCFoundation } from './foundation'; +import MDCFoundation, { MDCNumbers, MDCStrings } from './foundation'; import MDCComponent from './component'; export {MDCNumbers, MDCStrings, MDCFoundation, MDCComponent}; diff --git a/types/material__checkbox/adapter.d.ts b/types/material__checkbox/adapter.d.ts index aedeed30f5..a68eefb002 100644 --- a/types/material__checkbox/adapter.d.ts +++ b/types/material__checkbox/adapter.d.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -29,13 +29,17 @@ import { MDCSelectionControlState } from 'material__selection-control'; * Implement this adapter for your framework of choice to delegate updates to * the component in your framework of choice. See architecture documentation * for more details. - * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md + * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md */ -export class MDCCheckboxAdapter { +export default interface MDCCheckboxAdapter { addClass(className: string): void; removeClass(className: string): void; + setNativeControlAttr(attr: string, value: string): void; + + removeNativeControlAttr(attr: string): void; + registerAnimationEndHandler(handler: EventListener): void; deregisterAnimationEndHandler(handler: EventListener): void; @@ -50,5 +54,3 @@ export class MDCCheckboxAdapter { isAttachedToDOM(): boolean; } - -export default MDCCheckboxAdapter; diff --git a/types/material__checkbox/constants.d.ts b/types/material__checkbox/constants.d.ts index ee665f4c05..b522139b55 100644 --- a/types/material__checkbox/constants.d.ts +++ b/types/material__checkbox/constants.d.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import { MDCStrings, MDCNumbers } from 'material__base'; +import { MDCStrings, MDCNumbers } from 'material__base'; export interface cssClasses extends MDCStrings { UPGRADED: 'mdc-checkbox--upgraded'; @@ -35,8 +35,10 @@ export interface strings extends MDCStrings { TRANSITION_STATE_CHECKED: 'checked'; TRANSITION_STATE_UNCHECKED: 'unchecked'; TRANSITION_STATE_INDETERMINATE: 'indeterminate'; + ARIA_CHECKED_ATTR: 'aria-checked'; + ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed'; } export interface numbers extends MDCNumbers { - ANIM_END_LATCH_MS: 100; + ANIM_END_LATCH_MS: 250; } diff --git a/types/material__checkbox/foundation.d.ts b/types/material__checkbox/foundation.d.ts index 73216efcd6..cf04fe98f7 100644 --- a/types/material__checkbox/foundation.d.ts +++ b/types/material__checkbox/foundation.d.ts @@ -19,7 +19,7 @@ import MDCFoundation from 'material__base/foundation'; import MDCCheckboxAdapter from './adapter'; import { cssClasses, strings, numbers } from './constants'; -export class MDCCheckboxFoundation extends MDCFoundation { +export default class MDCCheckboxFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; @@ -30,7 +30,7 @@ export class MDCCheckboxFoundation extends MDCFoundation { isChecked(): boolean; - setChecked(checked: boolean): boolean; + setChecked(checked: boolean): void; isIndeterminate(): boolean; @@ -43,6 +43,8 @@ export class MDCCheckboxFoundation extends MDCFoundation { getValue(): string; setValue(value: string): void; -} -export default MDCCheckboxFoundation; + handleAnimationEnd(): void; + + handleChange(): void; +} diff --git a/types/material__checkbox/index.d.ts b/types/material__checkbox/index.d.ts index 9190c3d5a9..308bc077bb 100644 --- a/types/material__checkbox/index.d.ts +++ b/types/material__checkbox/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -32,8 +32,6 @@ export {MDCCheckboxAdapter, MDCCheckboxFoundation}; export class MDCCheckbox extends MDCComponent implements MDCSelectionControl { static attachTo(root: Element): MDCCheckbox; - getDefaultFoundation(): MDCCheckboxFoundation; - readonly ripple: MDCRipple; checked: boolean; @@ -43,6 +41,4 @@ export class MDCCheckbox extends MDCComponent { + static readonly strings: strings; + + static readonly cssClasses: cssClasses; + + static readonly defaultAdapter: MDCChipSetAdapter; + + /** + * Returns a new chip element with the given text, leading icon, and trailing icon, + * added to the root chip set element. + */ + addChip(text: string, leadingIcon?: Element | null, trailingIcon?: Element | null): Element; + + /** + * Selects the given chip. Deselects all other chips if the chip set is of the choice variant. + */ + select(chipFoundation: MDCChipFoundation): void; + + /** + * Deselects the given chip. + */ + deselect(chipFoundation: MDCChipFoundation): void; +} diff --git a/types/material__chips/chip-set/index.d.ts b/types/material__chips/chip-set/index.d.ts new file mode 100644 index 0000000000..a516d3b374 --- /dev/null +++ b/types/material__chips/chip-set/index.d.ts @@ -0,0 +1,35 @@ +/** + * @license + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCComponent from 'material__base/component'; +import MDCChipSetFoundation from './foundation'; +import MDCChipSetAdapter from './adapter'; +import { MDCChip } from '../chip'; + +export { MDCChipSetFoundation, MDCChipSetAdapter }; + +export class MDCChipSet extends MDCComponent { + static attachTo(root: any): MDCChipSet; + + initialize(chipFactory?: (el: Element) => MDCChip): void; + + initialSyncWithDOM(): void; + + /** + * Creates a new chip in the chip set with the given text, leading icon, and trailing icon. + */ + addChip(text: string, leadingIcon?: Element | null, trailingIcon?: Element | null): void; +} diff --git a/types/material__chips/chip/adapter.d.ts b/types/material__chips/chip/adapter.d.ts new file mode 100644 index 0000000000..52ffcef68f --- /dev/null +++ b/types/material__chips/chip/adapter.d.ts @@ -0,0 +1,77 @@ +/** + * @license + * Copyright 2017 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Adapter for MDC Chip. + * + * Defines the shape of the adapter expected by the foundation. Implement this + * adapter to integrate the Chip into your framework. See + * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md + * for more information. + */ +export default interface MDCChipAdapter { + addClass(className: string): void; + + removeClass(className: string): void; + + hasClass(className: string): boolean; + + addClassToLeadingIcon(className: string): void; + + removeClassFromLeadingIcon(className: string): void; + /** + * Returns true if target has className, false otherwise. + */ + eventTargetHasClass(target: EventTarget, className: string): boolean; + /** + * Registers an event listener on the root element for a given event. + */ + registerEventHandler(evtType: string, handler: EventListener): void; + /** + * Deregisters an event listener on the root element for a given event. + */ + deregisterEventHandler(evtType: string, handler: EventListener): void; + /** + * Registers an event listener on the trailing icon element for a given event. + */ + registerTrailingIconInteractionHandler(evtType: string, handler: EventListener): void; + /** + * Deregisters an event listener on the trailing icon element for a given event. + */ + deregisterTrailingIconInteractionHandler(evtType: string, handler: EventListener): void; + /** + * Emits a custom "MDCChip:interaction" event denoting the chip has been + * interacted with (typically on click or keydown). + */ + notifyInteraction(): void; + /** + * Emits a custom "MDCChip:trailingIconInteraction" event denoting the trailing icon has been + * interacted with (typically on click or keydown). + */ + notifyTrailingIconInteraction(): void; + /** + * Emits a custom event "MDCChip:removal" denoting the chip will be removed. + */ + notifyRemoval(): void; + /** + * Returns the computed property value of the given style property on the root element. + */ + getComputedStyleValue(propertyName: string): string; + /** + * Sets the property value of the given style property on the root element. + */ + setStyleProperty(propertyName: string, value: string): void; +} diff --git a/types/material__chips/chip/constants.d.ts b/types/material__chips/chip/constants.d.ts new file mode 100644 index 0000000000..79f1891445 --- /dev/null +++ b/types/material__chips/chip/constants.d.ts @@ -0,0 +1,38 @@ +/** + * @license + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MDCStrings } from 'material__base'; + +export interface strings extends MDCStrings { + ENTRY_ANIMATION_NAME: 'mdc-chip-entry'; + INTERACTION_EVENT: 'MDCChip:interaction'; + TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction'; + REMOVAL_EVENT: 'MDCChip:removal'; + CHECKMARK_SELECTOR: '.mdc-chip__checkmark'; + LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading'; + TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing'; +} + +export interface cssClasses extends MDCStrings { + CHECKMARK: 'mdc-chip__checkmark'; + CHIP: 'mdc-chip'; + CHIP_EXIT: 'mdc-chip--exit'; + HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden'; + LEADING_ICON: 'mdc-chip__icon--leading'; + TRAILING_ICON: 'mdc-chip__icon--trailing'; + SELECTED: 'mdc-chip--selected'; + TEXT: 'mdc-chip__text'; +} diff --git a/types/material__chips/chip/foundation.d.ts b/types/material__chips/chip/foundation.d.ts new file mode 100644 index 0000000000..383cbb9089 --- /dev/null +++ b/types/material__chips/chip/foundation.d.ts @@ -0,0 +1,32 @@ +/** + * @license + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCFoundation from 'material__base/foundation'; +import MDCChipAdapter from './adapter'; +import { cssClasses, strings } from './constants'; + +export default class MDCChipFoundation extends MDCFoundation { + static readonly strings: strings; + + static readonly cssClasses: cssClasses; + + static readonly defaultAdapter: MDCChipAdapter; + + isSelected(): boolean; + + setSelected(selected: boolean): void; +} diff --git a/types/material__chips/chip/index.d.ts b/types/material__chips/chip/index.d.ts new file mode 100644 index 0000000000..a0320e69b3 --- /dev/null +++ b/types/material__chips/chip/index.d.ts @@ -0,0 +1,39 @@ +/** + * @license + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCComponent from 'material__base/component'; +import MDCChipFoundation from './foundation'; +import MDCChipAdapter from './adapter'; +import { MDCRipple } from 'material__ripple'; + +export { MDCChipFoundation, MDCChipAdapter }; + +export class MDCChip extends MDCComponent { + static attachTo(root: Element): MDCChip; + /** + * Returns true if the chip is selected. + */ + isSelected(): boolean; + + /** + * Destroys the chip and removes the root element from the DOM. + */ + remove(): void; + + readonly foundation: MDCChipFoundation; + + readonly ripple: MDCRipple; +} diff --git a/types/material__chips/index.d.ts b/types/material__chips/index.d.ts new file mode 100644 index 0000000000..935d897236 --- /dev/null +++ b/types/material__chips/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * Copyright 2017 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MDCChipFoundation, MDCChip, MDCChipAdapter } from './chip'; +import { MDCChipSetFoundation, MDCChipSet, MDCChipSetAdapter } from './chip-set'; +export { MDCChipFoundation, MDCChip, MDCChipAdapter, MDCChipSetFoundation, MDCChipSet, MDCChipSetAdapter }; diff --git a/types/material__chips/tsconfig.json b/types/material__chips/tsconfig.json new file mode 100644 index 0000000000..424cb5a424 --- /dev/null +++ b/types/material__chips/tsconfig.json @@ -0,0 +1,32 @@ +{ + "files": [ + "chip/adapter.d.ts", + "chip/constants.d.ts", + "chip/foundation.d.ts", + "chip/index.d.ts", + "chip-set/adapter.d.ts", + "chip-set/constants.d.ts", + "chip-set/foundation.d.ts", + "chip-set/index.d.ts", + "index.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__chips/tslint.json b/types/material__chips/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__chips/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/material__dialog/adapter.d.ts b/types/material__dialog/adapter.d.ts index fd6bc3cf9f..beaa1a2a3e 100644 --- a/types/material__dialog/adapter.d.ts +++ b/types/material__dialog/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MSDDialogAdapter { +export default interface MDCDialogAdapter { addClass(className: string): void; removeClass(className: string): void; @@ -50,6 +50,4 @@ export interface MSDDialogAdapter { untrapFocusOnSurface(): void; isDialog(el: Element): boolean; - - layoutFooterRipples(): void; } diff --git a/types/material__dialog/constants.d.ts b/types/material__dialog/constants.d.ts index a45628627c..297876ba7d 100644 --- a/types/material__dialog/constants.d.ts +++ b/types/material__dialog/constants.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ - import { MDCStrings } from 'material__base'; +import { MDCStrings } from 'material__base'; export interface cssClasses extends MDCStrings { ROOT: 'mdc-dialog'; diff --git a/types/material__dialog/foundation.d.ts b/types/material__dialog/foundation.d.ts index f28c541dd2..e17b8388e5 100644 --- a/types/material__dialog/foundation.d.ts +++ b/types/material__dialog/foundation.d.ts @@ -16,14 +16,14 @@ import { MDCFoundation } from 'material__base'; import { cssClasses, strings } from './constants'; -import { MSDDialogAdapter } from './adapter'; +import MDCDialogAdapter from './adapter'; -export class MDCDialogFoundation extends MDCFoundation { +export default class MDCDialogFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; - static readonly defaultAdapter: MSDDialogAdapter; + static readonly defaultAdapter: MDCDialogAdapter; open(): void; @@ -35,5 +35,3 @@ export class MDCDialogFoundation extends MDCFoundation { cancel(shouldNotify: boolean): void; } - -export default MDCDialogFoundation; diff --git a/types/material__dialog/index.d.ts b/types/material__dialog/index.d.ts index 7d8ab69e30..491d2ad9fd 100644 --- a/types/material__dialog/index.d.ts +++ b/types/material__dialog/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,26 +21,17 @@ */ import { MDCComponent } from 'material__base'; -import { MDCRipple } from 'material__ripple'; - import MDCDialogFoundation from './foundation'; -import { MSDDialogAdapter } from './adapter'; +import MDCDialogAdapter from './adapter'; import * as util from './util'; -export {MSDDialogAdapter, MDCDialogFoundation, util}; +export {MDCDialogAdapter, MDCDialogFoundation, util}; -export class MDCDialog extends MDCComponent { +export class MDCDialog extends MDCComponent { static attachTo(root: Element): MDCDialog; readonly open: boolean; - - initialize(): void; - - destroy(): void; - show(): void; close(): void; - - getDefaultFoundation(): MDCDialogFoundation; } diff --git a/types/material__drawer/index.d.ts b/types/material__drawer/index.d.ts index 379ed35599..63cd5d8fda 100644 --- a/types/material__drawer/index.d.ts +++ b/types/material__drawer/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,7 +21,7 @@ */ import * as util from './util'; -export {MDCSlidableDrawerAdapter} from './slidable'; -export {MDCTemporaryDrawer, MDCTemporaryDrawerFoundation} from './temporary'; -export {MDCPersistentDrawer, MDCPersistentDrawerFoundation} from './persistent'; -export {util}; +export { MDCSlidableDrawerAdapter } from './slidable'; +export { MDCTemporaryDrawer, MDCTemporaryDrawerFoundation } from './temporary'; +export { MDCPersistentDrawer, MDCPersistentDrawerFoundation } from './persistent'; +export { util }; diff --git a/types/material__drawer/persistent/constants.d.ts b/types/material__drawer/persistent/constants.d.ts index 3d5f7c56ba..84dcce7f3f 100644 --- a/types/material__drawer/persistent/constants.d.ts +++ b/types/material__drawer/persistent/constants.d.ts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -17,13 +17,13 @@ import { MDCStrings } from 'material__base'; export interface cssClasses extends MDCStrings { - ROOT: 'mdc-persistent-drawer'; - OPEN: 'mdc-persistent-drawer--open'; - ANIMATING: 'mdc-persistent-drawer--animating'; + ROOT: 'mdc-drawer--persistent'; + OPEN: 'mdc-drawer--open'; + ANIMATING: 'mdc-drawer--animating'; } export interface strings extends MDCStrings { - DRAWER_SELECTOR: '.mdc-persistent-drawer__drawer'; + DRAWER_SELECTOR: '.mdc-drawer--persistent .mdc-drawer__drawer'; FOCUSABLE_ELEMENTS: 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex], [contenteditable]'; OPEN_EVENT: 'MDCPersistentDrawer:open'; CLOSE_EVENT: 'MDCPersistentDrawer:close'; diff --git a/types/material__drawer/persistent/foundation.d.ts b/types/material__drawer/persistent/foundation.d.ts index 7d4d53f884..ce596f3c23 100644 --- a/types/material__drawer/persistent/foundation.d.ts +++ b/types/material__drawer/persistent/foundation.d.ts @@ -17,12 +17,10 @@ import { MDCSlidableDrawerAdapter, MDCSlidableDrawerFoundation } from '../slidable'; import { cssClasses, strings } from './constants'; -export class MDCPersistentDrawerFoundation extends MDCSlidableDrawerFoundation { +export default class MDCPersistentDrawerFoundation extends MDCSlidableDrawerFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; static readonly defaultAdapter: MDCSlidableDrawerAdapter; } - -export default MDCPersistentDrawerFoundation; diff --git a/types/material__drawer/persistent/index.d.ts b/types/material__drawer/persistent/index.d.ts index 1c2286fd01..920258b2aa 100644 --- a/types/material__drawer/persistent/index.d.ts +++ b/types/material__drawer/persistent/index.d.ts @@ -15,7 +15,7 @@ */ import { MDCComponent } from 'material__base'; -import { MDCPersistentDrawerFoundation } from './foundation'; +import MDCPersistentDrawerFoundation from './foundation'; import { MDCSlidableDrawerAdapter } from '../slidable'; import * as util from '../util'; @@ -28,6 +28,4 @@ export class MDCPersistentDrawer extends MDCComponent { + static readonly cssClasses: cssClasses; + + static readonly defaultAdapter: MDCFloatingLabelAdapter; + + /** + * Returns the width of the label element. + */ + getWidth(): number; + + /** + * Styles the label to produce the label shake for errors. + */ + shake(shouldShake: boolean): void; + + /** + * Styles the label to float or dock. + */ + float(shouldFloat: boolean): void; +} diff --git a/types/material__floating-label/index.d.ts b/types/material__floating-label/index.d.ts new file mode 100644 index 0000000000..6b426a75d3 --- /dev/null +++ b/types/material__floating-label/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * @license + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCComponent from 'material__base/component'; +import MDCFloatingLabelFoundation from './foundation'; +import MDCFloatingLabelAdapter from './adapter'; + +export { MDCFloatingLabelFoundation, MDCFloatingLabelAdapter }; + +export class MDCFloatingLabel extends MDCComponent { + static attachTo(root: Element): MDCFloatingLabel; + + /** + * Styles the label to produce the label shake for errors. + * @param shouldShake styles the label to shake by adding shake class + * if true, otherwise will stop shaking by removing shake class. + */ + shake(shouldShake: boolean): void; + + /** + * Styles label to float/dock. + * @param shouldFloat styles the label to float by adding float class + * if true, otherwise docks the label by removing the float class. + */ + float(shouldFloat: boolean): void; + + getWidth(): number; +} diff --git a/types/material__floating-label/tsconfig.json b/types/material__floating-label/tsconfig.json new file mode 100644 index 0000000000..2af99c6e5e --- /dev/null +++ b/types/material__floating-label/tsconfig.json @@ -0,0 +1,27 @@ +{ + "files": [ + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__floating-label/tslint.json b/types/material__floating-label/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__floating-label/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/material__form-field/adapter.d.ts b/types/material__form-field/adapter.d.ts index 7033f363eb..722014eced 100644 --- a/types/material__form-field/adapter.d.ts +++ b/types/material__form-field/adapter.d.ts @@ -26,11 +26,9 @@ * Implement this adapter for your framework of choice to delegate updates to * the component in your framework of choice. See architecture documentation * for more details. - * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md - * - * @record + * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md */ -export class MDCFormFieldAdapter { +export default interface MDCFormFieldAdapter { registerInteractionHandler(type: string, handler: EventListener): void; deregisterInteractionHandler(type: string, handler: EventListener): void; @@ -39,5 +37,3 @@ export class MDCFormFieldAdapter { deactivateInputRipple(): void; } - -export default MDCFormFieldAdapter; diff --git a/types/material__form-field/constants.d.ts b/types/material__form-field/constants.d.ts index ba55acabcd..a40f571acc 100644 --- a/types/material__form-field/constants.d.ts +++ b/types/material__form-field/constants.d.ts @@ -18,7 +18,7 @@ import { MDCStrings } from 'material__base'; export interface cssClasses extends MDCStrings { - ROOT: 'mdc-form-field'; + ROOT: 'mdc-form-field'; } export interface strings extends MDCStrings { diff --git a/types/material__form-field/foundation.d.ts b/types/material__form-field/foundation.d.ts index 026beedfc2..aec781d9ab 100644 --- a/types/material__form-field/foundation.d.ts +++ b/types/material__form-field/foundation.d.ts @@ -19,12 +19,10 @@ import MDCFoundation from 'material__base/foundation'; import MDCFormFieldAdapter from './adapter'; import { cssClasses, strings } from './constants'; -export class MDCFormFieldFoundation extends MDCFoundation { +export default class MDCFormFieldFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; static readonly defaultAdapter: MDCFormFieldAdapter; } - -export default MDCFormFieldFoundation; diff --git a/types/material__form-field/index.d.ts b/types/material__form-field/index.d.ts index 1fcc30b4c4..812df5c0c0 100644 --- a/types/material__form-field/index.d.ts +++ b/types/material__form-field/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -32,6 +32,4 @@ export class MDCFormField extends MDCComponent { +export default class MDCGridListFoundation extends MDCFoundation { static readonly strings: strings; static readonly defaultAdapter: MDCGridListAdapter; alignCenter(): void; } - -export default MDCGridListFoundation; diff --git a/types/material__grid-list/index.d.ts b/types/material__grid-list/index.d.ts index 2a1e98d912..87ee0a138e 100644 --- a/types/material__grid-list/index.d.ts +++ b/types/material__grid-list/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,13 +21,11 @@ */ import { MDCComponent } from 'material__base'; -import { MDCGridListAdapter } from './adapter'; +import MDCGridListAdapter from './adapter'; import MDCGridListFoundation from './foundation'; -export {MDCGridListAdapter, MDCGridListFoundation}; +export { MDCGridListAdapter, MDCGridListFoundation }; export class MDCGridList extends MDCComponent { - static attachTo(root: Element): MDCGridList; - - getDefaultFoundation(): MDCGridListFoundation; + static attachTo(root: Element): MDCGridList; } diff --git a/types/material__icon-toggle/adapter.d.ts b/types/material__icon-toggle/adapter.d.ts index 52481fe732..56ac8a32dc 100644 --- a/types/material__icon-toggle/adapter.d.ts +++ b/types/material__icon-toggle/adapter.d.ts @@ -29,33 +29,30 @@ * Implement this adapter for your framework of choice to delegate updates to * the component in your framework of choice. See architecture documentation * for more details. - * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md - * - * @record + * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md */ +export default interface MDCIconToggleAdapter { + addClass(className: string): void; -export class MDCIconToggleAdapter { - addClass(className: string): void; + removeClass(className: string): void; - removeClass(className: string): void; + registerInteractionHandler(type: string, handler: EventListener): void; - registerInteractionHandler(type: string, handler: EventListener): void; + deregisterInteractionHandler(type: string, handler: EventListener): void; - deregisterInteractionHandler(type: string, handler: EventListener): void; + setText(text: string): void; - setText(text: string): void; + getTabIndex(): number; - getTabIndex(): number; + setTabIndex(tabIndex: number): void; - setTabIndex(tabIndex: number): void; + getAttr(name: string): string; - getAttr(name: string): string; + setAttr(name: string, value: string): void; - setAttr(name: string, value: string): void; + rmAttr(name: string): void; - rmAttr(name: string): void; - - notifyChange(evtData: IconToggleEvent): void; + notifyChange(evtData: IconToggleEvent): void; } export interface IconToggleEvent { diff --git a/types/material__icon-toggle/foundation.d.ts b/types/material__icon-toggle/foundation.d.ts index 65d25c1307..cd8910713f 100644 --- a/types/material__icon-toggle/foundation.d.ts +++ b/types/material__icon-toggle/foundation.d.ts @@ -16,10 +16,10 @@ */ import MDCFoundation from 'material__base/foundation'; -import { MDCIconToggleAdapter, IconToggleEvent } from './adapter'; +import MDCIconToggleAdapter from './adapter'; import { cssClasses, strings } from './constants'; -export class MDCIconToggleFoundation extends MDCFoundation { +export default class MDCIconToggleFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; @@ -38,27 +38,3 @@ export class MDCIconToggleFoundation extends MDCFoundation isKeyboardActivated(): boolean; } - -export interface KeyboardKey { - key: string; - keyCode: number; -} - -export function isSpace(keyboardKey: KeyboardKey): boolean; - -export class IconToggleState { - /** - * The aria-label value of the icon toggle, or undefined if there is no aria-label. - */ - label: string|undefined; - /** - * The text for the icon toggle, or undefined if there is no text. - */ - content: string|undefined; - /** - * The CSS class to add to the icon toggle, or undefined if there is no CSS class. - */ - cssClass: string|undefined; -} - -export default MDCIconToggleFoundation; diff --git a/types/material__icon-toggle/index.d.ts b/types/material__icon-toggle/index.d.ts index bfced0b532..beae5b83db 100644 --- a/types/material__icon-toggle/index.d.ts +++ b/types/material__icon-toggle/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -23,18 +23,14 @@ import MDCComponent from 'material__base/component'; import MDCIconToggleFoundation from './foundation'; -import { MDCIconToggleAdapter } from './adapter'; -import { MDCRipple, MDCRippleFoundation } from 'material__ripple'; +import MDCIconToggleAdapter from './adapter'; +import { MDCRipple } from 'material__ripple'; export {MDCIconToggleAdapter, MDCIconToggleFoundation}; export class MDCIconToggle extends MDCComponent { static attachTo(root: Element): MDCIconToggle; - destroy(): void; - - getDefaultFoundation(): MDCIconToggleFoundation; - initialSyncWithDOM(): void; readonly ripple: MDCRipple; diff --git a/types/material__line-ripple/adapter.d.ts b/types/material__line-ripple/adapter.d.ts new file mode 100644 index 0000000000..93865a952a --- /dev/null +++ b/types/material__line-ripple/adapter.d.ts @@ -0,0 +1,53 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Adapter for MDC TextField Line Ripple. + * + * Defines the shape of the adapter expected by the foundation. Implement this + * adapter to integrate the line ripple into your framework. See + * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md + * for more information. + */ + +export default interface MDCLineRippleAdapter { + /** + * Adds a class to the line ripple element. + */ + addClass(className: string): void; + + /** + * Removes a class from the line ripple element. + */ + removeClass(className: string): void; + + hasClass(className: string): boolean; + + /** + * Sets the style property with propertyName to value on the root element. + */ + setStyle(propertyName: string, value: string): void; + + /** + * Registers an event listener on the line ripple element for a given event. + */ + registerEventHandler(evtType: string, handler: EventListener): void; + + /** + * Deregisters an event listener on the line ripple element for a given event. + */ + deregisterEventHandler(evtType: string, handler: EventListener): void; +} diff --git a/types/material__line-ripple/constants.d.ts b/types/material__line-ripple/constants.d.ts new file mode 100644 index 0000000000..722570a2f5 --- /dev/null +++ b/types/material__line-ripple/constants.d.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { MDCStrings } from 'material__base'; + +export interface cssClasses extends MDCStrings { + LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active'; + LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating'; +} diff --git a/types/material__line-ripple/foundation.d.ts b/types/material__line-ripple/foundation.d.ts new file mode 100644 index 0000000000..2d525b7083 --- /dev/null +++ b/types/material__line-ripple/foundation.d.ts @@ -0,0 +1,45 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCFoundation from 'material__base/foundation'; +import { cssClasses } from './constants'; +import MDCLineRippleAdapter from './adapter'; + +export default class MDCLineRippleFoundation extends MDCFoundation { + static readonly cssClasses: cssClasses; + + static readonly defaultAdapter: MDCLineRippleAdapter; + + /** + * Activates the line ripple + */ + activate(): void; + + /** + * Sets the center of the ripple animation to the given X coordinate. + */ + setRippleCenter(xCoordinate: number): void; + + /** + * Deactivates the line ripple + */ + deactivate(): void; + + /** + * Handles a transition end event + */ + handleTransitionEnd(evt: Event): void; +} diff --git a/types/material__line-ripple/index.d.ts b/types/material__line-ripple/index.d.ts new file mode 100644 index 0000000000..f76ed98d10 --- /dev/null +++ b/types/material__line-ripple/index.d.ts @@ -0,0 +1,47 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCComponent from 'material__base/component'; +import MDCLineRippleFoundation from './foundation'; +import MDCLineRippleAdapter from './adapter'; + +export { MDCLineRippleFoundation, MDCLineRippleAdapter }; + +export class MDCLineRipple extends MDCComponent { + static attachTo(root: Element): MDCLineRipple; + + /** + * Activates the line ripple + */ + activate(): void; + + /** + * Deactivates the line ripple + */ + deactivate(): void; + + /** + * Sets the transform origin given a user's click location. The `rippleCenter` is the + * x-coordinate of the middle of the ripple. + */ + setRippleCenter(xCoordinate: number): void; +} diff --git a/types/material__line-ripple/tsconfig.json b/types/material__line-ripple/tsconfig.json new file mode 100644 index 0000000000..2af99c6e5e --- /dev/null +++ b/types/material__line-ripple/tsconfig.json @@ -0,0 +1,27 @@ +{ + "files": [ + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__line-ripple/tslint.json b/types/material__line-ripple/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__line-ripple/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/material__linear-progress/adapter.d.ts b/types/material__linear-progress/adapter.d.ts index 92afccc19d..a8dd2dc163 100644 --- a/types/material__linear-progress/adapter.d.ts +++ b/types/material__linear-progress/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MDCLinearProgressAdapter { +export default interface MDCLinearProgressAdapter { addClass(className: string): void; getPrimaryBar(): Element; diff --git a/types/material__linear-progress/foundation.d.ts b/types/material__linear-progress/foundation.d.ts index 4abd553a09..5d67b121c7 100644 --- a/types/material__linear-progress/foundation.d.ts +++ b/types/material__linear-progress/foundation.d.ts @@ -14,12 +14,11 @@ * limitations under the License. */ -import { MDCFoundation } from 'material__base'; -import { transformStyleProperties } from 'material__animation'; -import { MDCLinearProgressAdapter } from './adapter'; +import MDCFoundation from 'material__base/foundation'; +import MDCLinearProgressAdapter from './adapter'; import { cssClasses, strings } from './constants'; -export class MDCLinearProgressFoundation extends MDCFoundation { +export default class MDCLinearProgressFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; diff --git a/types/material__linear-progress/index.d.ts b/types/material__linear-progress/index.d.ts index 765d8cb368..4161a165f8 100644 --- a/types/material__linear-progress/index.d.ts +++ b/types/material__linear-progress/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,10 +21,10 @@ */ import { MDCComponent } from 'material__base'; -import { MDCLinearProgressAdapter } from './adapter'; -import { MDCLinearProgressFoundation } from './foundation'; +import MDCLinearProgressAdapter from './adapter'; +import MDCLinearProgressFoundation from './foundation'; -export {MDCLinearProgressAdapter, MDCLinearProgressFoundation}; +export { MDCLinearProgressAdapter, MDCLinearProgressFoundation }; export class MDCLinearProgress extends MDCComponent { static attachTo(root: Element): MDCLinearProgress; @@ -40,6 +40,4 @@ export class MDCLinearProgress extends MDCComponent { + static readonly cssClasses: cssClasses; + + static readonly strings: strings; + + static readonly numbers: numbers; + + static readonly Corner: Corner; + + static readonly defaultAdapter: MDCMenuAdapter; + + /** + * @param corner Default anchor corner alignment of top-left menu corner. + */ + setAnchorCorner(corner: Corner): void; + + /** + * @param margin 4-plet of margins from anchor. + */ + setAnchorMargin(margin: AnchorMargin): void; + + setRememberSelection(rememberSelection: boolean): void; + + setQuickOpen(quickOpen: boolean): void; + + open({focusIndex}?: { + focusIndex?: null; + }): void; + + close(evt?: Event): void; + + isOpen(): boolean; + + getSelectedIndex(): number; + + /** + * @param index Index of the item to set as selected. + */ + setSelectedIndex(index: number): void; +} diff --git a/types/material__menu/index.d.ts b/types/material__menu/index.d.ts index af9360d1a8..3c50c13690 100644 --- a/types/material__menu/index.d.ts +++ b/types/material__menu/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -20,7 +20,44 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import MDCComponent from 'material__base/component'; +import MDCMenuFoundation, { AnchorMargin } from './foundation'; +import MDCMenuAdapter from './adapter'; +import { Corner, CornerBit } from './constants'; -import * as util from './util'; -import { MDCSimpleMenu, MDCSimpleMenuAdapter, MDCSimpleMenuFoundation } from './simple/index'; -export { MDCSimpleMenu, MDCSimpleMenuAdapter, MDCSimpleMenuFoundation, util }; +export { MDCMenuFoundation, MDCMenuAdapter, AnchorMargin, Corner, CornerBit }; + +export class MDCMenu extends MDCComponent { + static attachTo(root: Element): MDCMenu; + + open: boolean; + + show(options?: { focusIndex?: number | null; }): void; + + hide(): void; + + /** + * @param corner Default anchor corner alignment of top-left menu corner. + */ + setAnchorCorner(corner: Corner): void; + + setAnchorMargin(margin: AnchorMargin): void; + + /** + * Return the items within the menu. Note that this only contains the set of elements within + * the items container that are proper list items, and not supplemental / presentational DOM + * elements. + */ + readonly items: Element[]; + + /** + * Return the item within the menu that is selected. + */ + getOptionByIndex(index: number): Element | null; + + selectedItemIndex: number; + + rememberSelection: boolean; + + quickOpen: boolean; +} diff --git a/types/material__menu/simple/constants.d.ts b/types/material__menu/simple/constants.d.ts deleted file mode 100644 index 58e2f16614..0000000000 --- a/types/material__menu/simple/constants.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @license - * Copyright 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { MDCStrings, MDCNumbers } from 'material__base'; - -export interface cssClasses extends MDCStrings { - ROOT: 'mdc-simple-menu'; - OPEN: 'mdc-simple-menu--open'; - ANIMATING: 'mdc-simple-menu--animating'; - TOP_RIGHT: 'mdc-simple-menu--open-from-top-right'; - BOTTOM_LEFT: 'mdc-simple-menu--open-from-bottom-left'; - BOTTOM_RIGHT: 'mdc-simple-menu--open-from-bottom-right'; -} - -export interface strings extends MDCStrings { - ITEMS_SELECTOR: '.mdc-simple-menu__items'; - SELECTED_EVENT: 'MDCSimpleMenu:selected'; - CANCEL_EVENT: 'MDCSimpleMenu:cancel'; - ARIA_DISABLED_ATTR: 'aria-disabled'; -} - -export interface numbers extends MDCNumbers { - // Amount of time to wait before triggering a selected event on the menu. Note that this time - // will most likely be bumped up once interactive lists are supported to allow for the ripple to - // animate before closing the menu - SELECTED_TRIGGER_DELAY: 50; - // Total duration of the menu animation. - TRANSITION_DURATION_MS: 300; - // The menu starts its open animation with the X axis at this time value (0 - 1). - TRANSITION_SCALE_ADJUSTMENT_X: 0.5; - // The time value the menu waits until the animation starts on the Y axis (0 - 1). - TRANSITION_SCALE_ADJUSTMENT_Y: 0.2; - // The cubic bezier control points for the animation (cubic-bezier(0, 0, 0.2, 1)). - TRANSITION_X1: 0; - TRANSITION_Y1: 0; - TRANSITION_X2: 0.2; - TRANSITION_Y2: 1; -} diff --git a/types/material__menu/simple/index.d.ts b/types/material__menu/simple/index.d.ts deleted file mode 100644 index c2315810ba..0000000000 --- a/types/material__menu/simple/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @license - * Copyright 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import MDCComponent from 'material__base/component'; -import MDCSimpleMenuFoundation from './foundation'; -import MDCSimpleMenuAdapter from './adapter'; -import { getTransformPropertyName } from '../util'; - -export {MDCSimpleMenuAdapter, MDCSimpleMenuFoundation}; - -export class MDCSimpleMenu extends MDCComponent { - static attachTo(root: Element): MDCSimpleMenu; - - open: boolean; - - show(options?: {focusIndex?: number}): void; - - hide(): void; - - /** - * Return the items within the menu. Note that this only contains the set of elements within - * the items container that are proper list items, and not supplemental / presentational DOM - * elements. - */ - readonly items: Element[]; - - getDefaultFoundation(): MDCSimpleMenuFoundation; -} diff --git a/types/material__menu/tsconfig.json b/types/material__menu/tsconfig.json index 74016e9380..b257a72f11 100644 --- a/types/material__menu/tsconfig.json +++ b/types/material__menu/tsconfig.json @@ -1,11 +1,10 @@ { "files": [ - "simple/constants.d.ts", - "simple/adapter.d.ts", - "simple/index.d.ts", - "simple/foundation.d.ts", - "util.d.ts", - "index.d.ts" + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts", + "util.d.ts" ], "compilerOptions": { "module": "commonjs", diff --git a/types/material__notched-outline/adapter.d.ts b/types/material__notched-outline/adapter.d.ts new file mode 100644 index 0000000000..8e44143e25 --- /dev/null +++ b/types/material__notched-outline/adapter.d.ts @@ -0,0 +1,57 @@ +/** + * @license + * Copyright 2017 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Adapter for MDC Notched Outline. + * + * Defines the shape of the adapter expected by the foundation. Implement this + * adapter to integrate the Notched Outline into your framework. See + * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md + * for more information. + */ + +export default interface MDCNotchedOutlineAdapter { + /** + * Returns the width of the root element. + */ + getWidth(): number; + + /** + * Returns the height of the root element. + */ + getHeight(): number; + + /** + * Adds a class to the root element. + */ + addClass(className: string): void; + + /** + * Removes a class from the root element. + */ + removeClass(className: string): void; + + /** + * Sets the "d" attribute of the outline element's SVG path. + */ + setOutlinePathAttr(value: string): void; + + /** + * Returns the idle outline element's computed style value of the given css property `propertyName`. + * We achieve this via `getComputedStyle(...).getPropertyValue(propertyName)`. + */ + getIdleOutlineStyleValue(propertyName: string): string; +} diff --git a/types/material__notched-outline/constants.d.ts b/types/material__notched-outline/constants.d.ts new file mode 100644 index 0000000000..2a18a77b8b --- /dev/null +++ b/types/material__notched-outline/constants.d.ts @@ -0,0 +1,27 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { MDCStrings } from 'material__base'; + +export interface strings extends MDCStrings { + PATH_SELECTOR: '.mdc-notched-outline__path'; + IDLE_OUTLINE_SELECTOR: '.mdc-notched-outline__idle'; +} + +export interface cssClasses extends MDCStrings { + OUTLINE_NOTCHED: 'mdc-notched-outline--notched'; +} diff --git a/types/material__notched-outline/foundation.d.ts b/types/material__notched-outline/foundation.d.ts new file mode 100644 index 0000000000..30234d65f9 --- /dev/null +++ b/types/material__notched-outline/foundation.d.ts @@ -0,0 +1,38 @@ +/** + * @license + * Copyright 2017 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCFoundation from 'material__base/foundation'; +import { cssClasses, strings } from './constants'; +import MDCNotchedOutlineAdapter from './adapter'; + +export default class MDCNotchedOutlineFoundation extends MDCFoundation { + static readonly strings: strings; + + static readonly cssClasses: cssClasses; + + static readonly defaultAdapter: MDCNotchedOutlineAdapter; + + /** + * Adds the outline notched selector and updates the notch width + * calculated based off of notchWidth and isRtl. + */ + notch(notchWidth: number, isRtl?: boolean): void; + + /** + * Removes notched outline selector to close the notch in the outline. + */ + closeNotch(): void; +} diff --git a/types/material__notched-outline/index.d.ts b/types/material__notched-outline/index.d.ts new file mode 100644 index 0000000000..d22a9a6918 --- /dev/null +++ b/types/material__notched-outline/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * @license + * Copyright 2017 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCComponent from 'material__base/component'; +import MDCNotchedOutlineFoundation from './foundation'; +import MDCNotchedOutlineAdapter from './adapter'; + +export { MDCNotchedOutlineFoundation, MDCNotchedOutlineAdapter }; + +export class MDCNotchedOutline extends MDCComponent { + static attachTo(root: Element): MDCNotchedOutline; + + /** + * Updates outline selectors and SVG path to open notch. + */ + notch(notchWidth: number, isRtl?: boolean): void; + + /** + * Updates the outline selectors to close notch and return it to idle state. + */ + closeNotch(): void; +} diff --git a/types/material__notched-outline/tsconfig.json b/types/material__notched-outline/tsconfig.json new file mode 100644 index 0000000000..2af99c6e5e --- /dev/null +++ b/types/material__notched-outline/tsconfig.json @@ -0,0 +1,27 @@ +{ + "files": [ + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__notched-outline/tslint.json b/types/material__notched-outline/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__notched-outline/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/material__radio/adapter.d.ts b/types/material__radio/adapter.d.ts index 91035ea177..1238d2bae4 100644 --- a/types/material__radio/adapter.d.ts +++ b/types/material__radio/adapter.d.ts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -27,14 +27,12 @@ import { MDCSelectionControlState } from 'material__selection-control'; * Implement this adapter for your framework of choice to delegate updates to * the component in your framework of choice. See architecture documentation * for more details. - * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md + * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md */ -export class MDCRadioAdapter { +export default interface MDCRadioAdapter { addClass(className: string): void; removeClass(className: string): void; getNativeControl(): MDCSelectionControlState; } - -export default MDCRadioAdapter; diff --git a/types/material__radio/foundation.d.ts b/types/material__radio/foundation.d.ts index f27bd30f1b..bb0720e831 100644 --- a/types/material__radio/foundation.d.ts +++ b/types/material__radio/foundation.d.ts @@ -15,28 +15,25 @@ */ import MDCFoundation from 'material__base/foundation'; -import { MDCSelectionControlState } from 'material__selection-control'; import MDCRadioAdapter from './adapter'; import { cssClasses, strings } from './constants'; -export class MDCRadioFoundation extends MDCFoundation { - static readonly cssClasses: cssClasses; +export default class MDCRadioFoundation extends MDCFoundation { + static readonly cssClasses: cssClasses; - static readonly strings: strings; + static readonly strings: strings; - static readonly defaultAdapter: MDCRadioAdapter; + static readonly defaultAdapter: MDCRadioAdapter; - isChecked(): boolean; + isChecked(): boolean; - setChecked(checked: boolean): void; + setChecked(checked: boolean): void; - isDisabled(): boolean; + isDisabled(): boolean; - setDisabled(disabled: boolean): void; + setDisabled(disabled: boolean): void; - getValue(): string; + getValue(): string; - setValue(value?: string): void; + setValue(value?: string): void; } - -export default MDCRadioFoundation; diff --git a/types/material__radio/index.d.ts b/types/material__radio/index.d.ts index e9001d9d84..d73206b791 100644 --- a/types/material__radio/index.d.ts +++ b/types/material__radio/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -25,7 +25,7 @@ import MDCComponent from 'material__base/component'; import { MDCSelectionControl } from 'material__selection-control'; import MDCRadioAdapter from './adapter'; import MDCRadioFoundation from './foundation'; -import { MDCRipple, MDCRippleFoundation } from 'material__ripple'; +import { MDCRipple } from 'material__ripple'; export {MDCRadioAdapter, MDCRadioFoundation}; @@ -39,8 +39,4 @@ export class MDCRadio extends MDCComponent value: string; readonly ripple: MDCRipple; - - destroy(): void; - - getDefaultFoundation(): MDCRadioFoundation; } diff --git a/types/material__ripple/adapter.d.ts b/types/material__ripple/adapter.d.ts index 0d2d319aab..ff5ab11231 100644 --- a/types/material__ripple/adapter.d.ts +++ b/types/material__ripple/adapter.d.ts @@ -32,11 +32,9 @@ * Implement this adapter for your framework of choice to delegate updates to * the component in your framework of choice. See architecture documentation * for more details. - * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md - * - * @record + * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md */ -export default class MDCRippleAdapter { +export default interface MDCRippleAdapter { browserSupportsCssVars(): boolean; isUnbounded(): boolean; @@ -49,17 +47,23 @@ export default class MDCRippleAdapter { removeClass(className: string): void; + containsEventTarget(target: EventTarget): void; + registerInteractionHandler(evtType: string, handler: EventListener): void; deregisterInteractionHandler(evtType: string, handler: EventListener): void; + registerDocumentInteractionHandler(evtType: string, handler: EventListener): void; + + deregisterDocumentInteractionHandler(evtType: string, handler: EventListener): void; + registerResizeHandler(handler: EventListener): void; deregisterResizeHandler(handler: EventListener): void; - updateCssVariable(varName: string, value: number|string): void; + updateCssVariable(varName: string, value: number | string | null): void; computeBoundingRect(): ClientRect; - getWindowPageOffset(): {x: number, y: number}; + getWindowPageOffset(): { x: number; y: number; }; } diff --git a/types/material__ripple/constants.d.ts b/types/material__ripple/constants.d.ts index 285d5f3f2c..b1dd4c12b4 100644 --- a/types/material__ripple/constants.d.ts +++ b/types/material__ripple/constants.d.ts @@ -24,15 +24,14 @@ export interface cssClasses extends MDCStrings { ROOT: 'mdc-ripple-upgraded'; UNBOUNDED: 'mdc-ripple-upgraded--unbounded'; BG_FOCUSED: 'mdc-ripple-upgraded--background-focused'; - BG_ACTIVE_FILL: 'mdc-ripple-upgraded--background-active-fill'; FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation'; FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation'; } export interface strings extends MDCStrings { - VAR_FG_SIZE: '--mdc-ripple-fg-size'; VAR_LEFT: '--mdc-ripple-left'; VAR_TOP: '--mdc-ripple-top'; + VAR_FG_SIZE: '--mdc-ripple-fg-size'; VAR_FG_SCALE: '--mdc-ripple-fg-scale'; VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start'; VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end'; @@ -41,6 +40,7 @@ export interface strings extends MDCStrings { export interface numbers extends MDCNumbers { PADDING: 10; INITIAL_ORIGIN_SCALE: 0.6; - DEACTIVATION_TIMEOUT_MS: 300; - FG_DEACTIVATION_MS: 83; + DEACTIVATION_TIMEOUT_MS: 225; // Corresponds to $mdc-ripple-translate-duration (i.e. activation animation duration) + FG_DEACTIVATION_MS: 150; // Corresponds to $mdc-ripple-fade-out-duration (i.e. deactivation animation duration) + TAP_DELAY_MS: 300; // Delay between touch and simulated mouse events on touch devices } diff --git a/types/material__ripple/foundation.d.ts b/types/material__ripple/foundation.d.ts index b67632e441..fe6d33403a 100644 --- a/types/material__ripple/foundation.d.ts +++ b/types/material__ripple/foundation.d.ts @@ -18,39 +18,6 @@ import MDCFoundation from 'material__base/foundation'; import MDCRippleAdapter from './adapter'; import { cssClasses, strings, numbers } from './constants'; -import { getNormalizedEventCoords } from './util'; - -export interface ActivationStateType { - isActivated: boolean|undefined; - hasDeactivationUXRun: boolean|undefined; - wasActivatedByPointer: boolean|undefined; - wasElementMadeActive: boolean|undefined; - activationStartTime: number|undefined; - activationEvent: Event; - isProgrammatic: boolean|undefined; -} - -export interface ListenerInfoType { - activate: string|undefined; - deactivate: string|undefined; - focus: string|undefined; - blur: string|undefined; -} - -export interface ListenersType { - activate(e: Event): void; - - deactivate(e: Event): void; - - focus(): void; - - blur(): void; -} - -export interface PointType { - x: number; - y: number; -} export default class MDCRippleFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; @@ -66,4 +33,6 @@ export default class MDCRippleFoundation extends MDCFoundation deactivate(event?: Event): void; layout(): void; + + setUnbounded(unbounded: boolean): void; } diff --git a/types/material__ripple/index.d.ts b/types/material__ripple/index.d.ts index 2f8379ac84..aaef1a6aff 100644 --- a/types/material__ripple/index.d.ts +++ b/types/material__ripple/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -29,21 +29,19 @@ import * as util from './util'; export {MDCRippleAdapter, MDCRippleFoundation, util}; export class MDCRipple extends MDCComponent { - static attachTo(root: Element, bound?: {isUnbounded: boolean|undefined}): MDCRipple; + static attachTo(root: Element, options?: { isUnbounded?: boolean; }): MDCRipple; - static createAdapter(instance: RippleCapableSurface): MDCRippleAdapter; + static createAdapter(instance: RippleCapableSurface): MDCRippleAdapter; - unbounded: boolean; + unbounded: boolean; - activate(): void; + activate(): void; - deactivate(): void; + deactivate(): void; - layout(): void; + layout(): void; - getDefaultFoundation(): MDCRippleFoundation; - - initialSyncWithDOM(): void; + initialSyncWithDOM(): void; } /** @@ -57,10 +55,10 @@ export class RippleCapableSurface { /** * Whether or not the ripple bleeds out of the bounds of the element. */ - unbounded: boolean|undefined; + unbounded: boolean | undefined; /** * Whether or not the ripple is attached to a disabled component. */ - disabled: boolean|undefined; + disabled: boolean | undefined; } diff --git a/types/material__select/adapter.d.ts b/types/material__select/adapter.d.ts index 2828b77361..b3b425e7a3 100644 --- a/types/material__select/adapter.d.ts +++ b/types/material__select/adapter.d.ts @@ -14,68 +14,28 @@ * limitations under the License. */ -export interface MDCSelectAdapter { +export default interface MDCSelectAdapter { addClass(className: string): void; removeClass(className: string): void; - addBodyClass(className: string): void; + floatLabel(value: boolean): void; - removeBodyClass(className: string): void; + activateBottomLine(): void; - setAttr(attr: string, value: string): void; - - rmAttr(attr: string): void; - - computeBoundingRect(): {left: number, top: number}; + deactivateBottomLine(): void; registerInteractionHandler(type: string, handler: EventListener): void; deregisterInteractionHandler(type: string, handler: EventListener): void; - focus(): void; + getSelectedIndex(): number; - makeTabbable(): void; + setSelectedIndex(index: number): void; - makeUntabbable(): void; + setDisabled(disabled: boolean): void; - getComputedStyleValue(propertyName: string): string; + getValue(): string; - setStyle(propertyName: string, value: string): void; - - create2dRenderingContext(): {font: string, measureText: (val: string) => {width: number}}; - - setMenuElStyle(propertyName: string, value: string): void; - - setMenuElAttr(attr: string, value: string): void; - - rmMenuElAttr(attr: string): void; - - getMenuElOffsetHeight(): number; - - openMenu(focusIndex: number): void; - - isMenuOpen(): boolean; - - setSelectedTextContent(textContent: string): void; - - getNumberOfOptions(): number; - - getTextForOptionAtIndex(index: number): string; - - getValueForOptionAtIndex(index: number): string; - - setAttrForOptionAtIndex(index: number, attr: string, value: string): void; - - rmAttrForOptionAtIndex(index: number, attr: string): void; - - getOffsetTopForOptionAtIndex(index: number): number; - - registerMenuInteractionHandler(type: string, handler: EventListener): void; - - deregisterMenuInteractionHandler(type: string, handler: EventListener): void; - - notifyChange(): void; - - getWindowInnerHeight(): number; + setValue(value: string): void; } diff --git a/types/material__select/constants.d.ts b/types/material__select/constants.d.ts index 1566d71322..f9a93da7b1 100644 --- a/types/material__select/constants.d.ts +++ b/types/material__select/constants.d.ts @@ -17,12 +17,14 @@ import { MDCStrings } from 'material__base'; export interface cssClasses extends MDCStrings { - ROOT: 'mdc-select'; - OPEN: 'mdc-select--open'; + BOX: 'mdc-select--box'; DISABLED: 'mdc-select--disabled'; - SCROLL_LOCK: 'mdc-select-scroll-lock'; + ROOT: 'mdc-select'; } export interface strings extends MDCStrings { CHANGE_EVENT: 'MDCSelect:change'; + LINE_RIPPLE_SELECTOR: '.mdc-line-ripple'; + LABEL_SELECTOR: '.mdc-floating-label'; + NATIVE_CONTROL_SELECTOR: '.mdc-select__native-control'; } diff --git a/types/material__select/foundation.d.ts b/types/material__select/foundation.d.ts index 6f66f79b5f..641c2a301a 100644 --- a/types/material__select/foundation.d.ts +++ b/types/material__select/foundation.d.ts @@ -16,25 +16,18 @@ import { MDCFoundation } from 'material__base'; import { cssClasses, strings } from './constants'; -import { MDCSimpleMenuFoundation } from 'material__menu'; -import { MDCSelectAdapter } from './adapter'; +import MDCSelectAdapter from './adapter'; export default class MDCSelectFoundation extends MDCFoundation { - static readonly cssClasses: cssClasses; + static readonly cssClasses: cssClasses; - static readonly strings: strings; + static readonly strings: strings; - static readonly defaultAdapter: MDCSelectAdapter; + static readonly defaultAdapter: MDCSelectAdapter; - getValue(): string; + setSelectedIndex(index: number): void; - getSelectedIndex(): number; + setValue(value: string): void; - setSelectedIndex(index: number): void; - - isDisabled(): boolean; - - setDisabled(disabled: boolean): void; - - resize(): void; + setDisabled(disabled: boolean): void; } diff --git a/types/material__select/index.d.ts b/types/material__select/index.d.ts index 78746a97d1..a487461ae7 100644 --- a/types/material__select/index.d.ts +++ b/types/material__select/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,33 +21,23 @@ */ import { MDCComponent } from 'material__base'; -import { MDCSimpleMenu } from 'material__menu'; - -import { MDCSelectAdapter } from './adapter'; import MDCSelectFoundation from './foundation'; +import MDCSelectAdapter from './adapter'; +import { MDCFloatingLabel } from 'material__floating-label'; +import { MDCLineRipple } from 'material__line-ripple'; export {MDCSelectAdapter, MDCSelectFoundation}; export class MDCSelect extends MDCComponent { static attachTo(root: Element): MDCSelect; - readonly value: string; - - readonly options: Element[]; - - readonly selectedOptions: NodeListOf; + value: string; selectedIndex: number; disabled: boolean; - item(index: number): Element|null; - - nameditem(key: string): Element|null; - - initialize(menuFactory?: (el: Element) => MDCSimpleMenu): void; - - getDefaultFoundation(): MDCSelectFoundation; + initialize(labelFactory?: (el: Element) => MDCFloatingLabel, lineRippleFactory?: (el: Element) => MDCLineRipple): void; initialSyncWithDOM(): void; } diff --git a/types/material__selection-control/index.d.ts b/types/material__selection-control/index.d.ts index 9c7f90c3fd..b5ce84d6ce 100644 --- a/types/material__selection-control/index.d.ts +++ b/types/material__selection-control/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/material__slider/adapter.d.ts b/types/material__slider/adapter.d.ts index 940ae04d76..b558c20799 100644 --- a/types/material__slider/adapter.d.ts +++ b/types/material__slider/adapter.d.ts @@ -14,14 +14,14 @@ * limitations under the License. */ -export interface MDCSliderAdapter { +export default interface MDCSliderAdapter { hasClass(className: string): boolean; addClass(className: string): void; removeClass(className: string): void; - getAttribute(name: string): string|null; + getAttribute(name: string): string | null; setAttribute(name: string, value: string): void; diff --git a/types/material__slider/foundation.d.ts b/types/material__slider/foundation.d.ts index 5da6942f49..97abb60e28 100644 --- a/types/material__slider/foundation.d.ts +++ b/types/material__slider/foundation.d.ts @@ -16,9 +16,8 @@ import { cssClasses, strings, numbers } from './constants'; -import { getCorrectEventName, getCorrectPropertyName } from 'material__animation'; import MDCFoundation from 'material__base/foundation'; -import { MDCSliderAdapter } from './adapter'; +import MDCSliderAdapter from './adapter'; export default class MDCSliderFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; diff --git a/types/material__slider/index.d.ts b/types/material__slider/index.d.ts index 0d0e472775..1a1c02d86a 100644 --- a/types/material__slider/index.d.ts +++ b/types/material__slider/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -23,32 +23,30 @@ import MDCComponent from 'material__base/component'; import MDCSliderFoundation from './foundation'; -import { MDCSliderAdapter } from './adapter'; +import MDCSliderAdapter from './adapter'; export {MDCSliderAdapter, MDCSliderFoundation}; export class MDCSlider extends MDCComponent { - static attachTo(root: Element): MDCSlider; + static attachTo(root: Element): MDCSlider; - value: number; + value: number; - min: number; + min: number; - max: number; + max: number; - step: number; + step: number; - disabled: boolean; + disabled: boolean; - initialize(): void; + initialize(): void; - getDefaultFoundation(): MDCSliderFoundation; + initialSyncWithDOM(): void; - initialSyncWithDOM(): void; + layout(): void; - layout(): void; + stepUp(amount?: number): void; - stepUp(amount?: number): void; - - stepDown(amount?: number): void; + stepDown(amount?: number): void; } diff --git a/types/material__snackbar/adapter.d.ts b/types/material__snackbar/adapter.d.ts index 412329bd97..12ac56c6f7 100644 --- a/types/material__snackbar/adapter.d.ts +++ b/types/material__snackbar/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MDCSnackbarAdapter { +export default interface MDCSnackbarAdapter { addClass(className: string): void; removeClass(className: string): void; setAriaHidden(): void; @@ -35,4 +35,6 @@ export interface MDCSnackbarAdapter { deregisterActionClickHandler(handler: EventListener): void; registerTransitionEndHandler(handler: EventListener): void; deregisterTransitionEndHandler(handler: EventListener): void; + notifyShow(): void; + notifyHide(): void; } diff --git a/types/material__snackbar/constants.d.ts b/types/material__snackbar/constants.d.ts index 7bf6758a0a..7c5cf27999 100644 --- a/types/material__snackbar/constants.d.ts +++ b/types/material__snackbar/constants.d.ts @@ -30,6 +30,8 @@ export interface strings extends MDCStrings { TEXT_SELECTOR: '.mdc-snackbar__text'; ACTION_WRAPPER_SELECTOR: '.mdc-snackbar__action-wrapper'; ACTION_BUTTON_SELECTOR: '.mdc-snackbar__action-button'; + SHOW_EVENT: 'MDCSnackbar:show'; + HIDE_EVENT: 'MDCSnackbar:hide'; } export interface numbers extends MDCNumbers { diff --git a/types/material__snackbar/foundation.d.ts b/types/material__snackbar/foundation.d.ts index 5c85ab5f85..a695a1a33e 100644 --- a/types/material__snackbar/foundation.d.ts +++ b/types/material__snackbar/foundation.d.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import { MDCFoundation } from 'material__base'; +import MDCFoundation from 'material__base/foundation'; import { cssClasses, strings, numbers } from './constants'; -import { MDCSnackbarAdapter } from './adapter'; +import MDCSnackbarAdapter from './adapter'; export interface MDCSnackbarData { message: string; @@ -27,18 +27,18 @@ export interface MDCSnackbarData { timeout?: number; } -export class MDCSnackbarFoundation extends MDCFoundation { - static readonly cssClasses: cssClasses; +export default class MDCSnackbarFoundation extends MDCFoundation { + static readonly cssClasses: cssClasses; - static readonly strings: strings; + static readonly strings: strings; - static readonly defaultAdapter: MDCSnackbarAdapter; + static readonly defaultAdapter: MDCSnackbarAdapter; - readonly active: boolean; + readonly active: boolean; - dismissesOnAction(): boolean; + dismissesOnAction(): boolean; - setDismissOnAction(dismissOnAction: boolean): void; + setDismissOnAction(dismissOnAction: boolean): void; - show(data: MDCSnackbarData): void; + show(data: MDCSnackbarData): void; } diff --git a/types/material__snackbar/index.d.ts b/types/material__snackbar/index.d.ts index 11ac69f573..da6ecd4ca2 100644 --- a/types/material__snackbar/index.d.ts +++ b/types/material__snackbar/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,18 +21,15 @@ */ import { MDCComponent } from 'material__base'; -import { MDCSnackbarAdapter } from './adapter'; -import { MDCSnackbarFoundation, MDCSnackbarData } from './foundation'; -import { getCorrectEventName } from 'material__animation'; +import MDCSnackbarAdapter from './adapter'; +import MDCSnackbarFoundation, { MDCSnackbarData } from './foundation'; export {MDCSnackbarAdapter, MDCSnackbarFoundation}; export class MDCSnackbar extends MDCComponent { - static attachTo(root: Element): MDCSnackbar; + static attachTo(root: Element): MDCSnackbar; - show(data: MDCSnackbarData): void; + show(data: MDCSnackbarData): void; - getDefaultFoundation(): MDCSnackbarFoundation; - - dismissesOnAction: boolean; + dismissesOnAction: boolean; } diff --git a/types/material__textfield/bottom-line/adapter.d.ts b/types/material__tab/adapter.d.ts similarity index 58% rename from types/material__textfield/bottom-line/adapter.d.ts rename to types/material__tab/adapter.d.ts index 25b8de0477..90b89dca00 100644 --- a/types/material__textfield/bottom-line/adapter.d.ts +++ b/types/material__tab/adapter.d.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. All Rights Reserved. + * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,47 +14,41 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - /** - * Adapter for MDC TextField Bottom Line. + * Adapter for MDC Tab. * * Defines the shape of the adapter expected by the foundation. Implement this - * adapter to integrate the TextField bottom line into your framework. See + * adapter to integrate the Tab into your framework. See * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md - * for more information. - * - * @record */ -export default class MDCTextFieldBottomLineAdapter { +export default interface MDCTabAdapter { /** - * Adds a class to the bottom line element. - */ - addClass(className: string): void; - - /** - * Removes a class from the bottom line element. - */ - removeClass(className: string): void; - - /** - * Sets an attribute with a given value on the bottom line element. - */ - setAttr(attr: string, value: string): void; - - /** - * Registers an event listener on the bottom line element for a given event. + * Registers an event listener on the root element for a given event. */ registerEventHandler(evtType: string, handler: EventListener): void; /** - * Deregisters an event listener on the bottom line element for a given event. + * Deregisters an event listener on the root element for a given event. */ deregisterEventHandler(evtType: string, handler: EventListener): void; /** - * Emits a custom event "MDCTextFieldBottomLine:animation-end" denoting the - * bottom line has finished its animation; either the activate or - * deactivate animation + * Adds the given className to the root element. */ - notifyAnimationEnd(): void; + addClass(className: string): void; + + /** + * Removes the given className from the root element. + */ + removeClass(className: string): void; + + /** + * Returns whether the root element has the given className. + */ + hasClass(className: string): boolean; + + /** + * Sets the given attrName of the root element to the given value. + */ + setAttr(attr: string, value: string): void; } diff --git a/types/material__tab/constants.d.ts b/types/material__tab/constants.d.ts new file mode 100644 index 0000000000..7d4a710a64 --- /dev/null +++ b/types/material__tab/constants.d.ts @@ -0,0 +1,27 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MDCStrings } from 'material__base'; + +export interface cssClasses extends MDCStrings { + ACTIVE: 'mdc-tab--active'; + ANIMATING_ACTIVATE: 'mdc-tab--animating-activate'; + ANIMATING_DEACTIVATE: 'mdc-tab--animating-deactivate'; +} + +export interface strings extends MDCStrings { + ARIA_SELECTED: 'aria-selected'; +} diff --git a/types/material__textfield/bottom-line/foundation.d.ts b/types/material__tab/foundation.d.ts similarity index 64% rename from types/material__textfield/bottom-line/foundation.d.ts rename to types/material__tab/foundation.d.ts index 6945695348..bd438ef48e 100644 --- a/types/material__textfield/bottom-line/foundation.d.ts +++ b/types/material__tab/foundation.d.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. All Rights Reserved. + * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,35 +14,31 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import MDCFoundation from 'material__base/foundation'; -import MDCTextFieldBottomLineAdapter from './adapter'; import { cssClasses, strings } from './constants'; +import MDCTabAdapter from './adapter'; -export default class MDCTextFieldBottomLineFoundation extends MDCFoundation { +export default class MDCTabFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; - static readonly defaultAdapter: MDCTextFieldBottomLineAdapter; + static readonly defaultAdapter: MDCTabAdapter; + + handleTransitionEnd(evt: Event): void; /** - * Activates the bottom line + * Returns the Tab's active state + */ + isActive(): boolean; + + /** + * Activates the Tab */ activate(): void; /** - * Sets the transform origin given a user's click location. - */ - setTransformOrigin(evt: Event): void; - - /** - * Deactivates the bottom line + * Deactivates the Tab */ deactivate(): void; - - /** - * Handles a transition end event - */ - handleTransitionEnd(evt: Event): void; } diff --git a/types/material__tab/index.d.ts b/types/material__tab/index.d.ts new file mode 100644 index 0000000000..b2cc71129e --- /dev/null +++ b/types/material__tab/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCComponent from 'material__base/component'; +import MDCTabFoundation from './foundation'; +import MDCTabAdapter from './adapter'; + +export { MDCTabFoundation, MDCTabAdapter }; + +export class MDCTab extends MDCComponent { + static attachTo(root: Element): MDCTab; + + active: boolean; +} diff --git a/types/material__tab/tsconfig.json b/types/material__tab/tsconfig.json new file mode 100644 index 0000000000..2af99c6e5e --- /dev/null +++ b/types/material__tab/tsconfig.json @@ -0,0 +1,27 @@ +{ + "files": [ + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__tab/tslint.json b/types/material__tab/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__tab/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/material__tabs/index.d.ts b/types/material__tabs/index.d.ts index b268e55a8d..b5a9d4143e 100644 --- a/types/material__tabs/index.d.ts +++ b/types/material__tabs/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -20,6 +20,6 @@ * limitations under the License. */ -export {MDCTabFoundation, MDCTab} from './tab/index'; -export {MDCTabBarAdapter, MDCTabBarFoundation, MDCTabBar} from './tab-bar/index'; -export {MDCTabBarScrollerAdapter, MDCTabBarScrollerFoundation, MDCTabBarScroller} from './tab-bar-scroller/index'; +export { MDCTabFoundation, MDCTab, MDCTabAdapter } from './tab'; +export { MDCTabBarFoundation, MDCTabBar, MDCTabBarAdapter } from './tab-bar'; +export { MDCTabBarScrollerFoundation, MDCTabBarScroller, MDCTabBarScrollerAdapter } from './tab-bar-scroller'; diff --git a/types/material__tabs/tab-bar-scroller/adapter.d.ts b/types/material__tabs/tab-bar-scroller/adapter.d.ts index 8c1286fc74..b46d2d3e5f 100644 --- a/types/material__tabs/tab-bar-scroller/adapter.d.ts +++ b/types/material__tabs/tab-bar-scroller/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MDCTabBarScrollerAdapter { +export default interface MDCTabBarScrollerAdapter { addClass(className: string): void; removeClass(className: string): void; diff --git a/types/material__tabs/tab-bar-scroller/foundation.d.ts b/types/material__tabs/tab-bar-scroller/foundation.d.ts index ed470c20d2..273a6f048a 100644 --- a/types/material__tabs/tab-bar-scroller/foundation.d.ts +++ b/types/material__tabs/tab-bar-scroller/foundation.d.ts @@ -17,7 +17,7 @@ import MDCFoundation from 'material__base/foundation'; import { cssClasses, strings } from './constants'; -import { MDCTabBarScrollerAdapter } from './adapter'; +import MDCTabBarScrollerAdapter from './adapter'; export default class MDCTabBarScrollerFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; diff --git a/types/material__tabs/tab-bar-scroller/index.d.ts b/types/material__tabs/tab-bar-scroller/index.d.ts index a9d71b305c..984a1fc838 100644 --- a/types/material__tabs/tab-bar-scroller/index.d.ts +++ b/types/material__tabs/tab-bar-scroller/index.d.ts @@ -14,23 +14,20 @@ * limitations under the License. */ -import { getCorrectPropertyName } from 'material__animation'; import MDCComponent from 'material__base/component'; -import { MDCTabBar } from '../tab-bar/index'; +import { MDCTabBar } from '../tab-bar'; import MDCTabBarScrollerFoundation from './foundation'; -import { MDCTabBarScrollerAdapter } from './adapter'; +import MDCTabBarScrollerAdapter from './adapter'; -export {MDCTabBarScrollerAdapter, MDCTabBarScrollerFoundation}; +export { MDCTabBarScrollerAdapter, MDCTabBarScrollerFoundation }; export class MDCTabBarScroller extends MDCComponent { - static attachTo(root: Element): MDCTabBarScroller; + static attachTo(root: Element): MDCTabBarScroller; - readonly tabBar: MDCTabBar; + readonly tabBar: MDCTabBar; - initialize(tabBarFactory?: (el: Element) => MDCTabBar): void; + initialize(tabBarFactory?: (root: Element) => MDCTabBar): void; - getDefaultFoundation(): MDCTabBarScrollerFoundation; - - layout(): void; + layout(): void; } diff --git a/types/material__tabs/tab-bar/adapter.d.ts b/types/material__tabs/tab-bar/adapter.d.ts index 1efa73f52c..0e43efc074 100644 --- a/types/material__tabs/tab-bar/adapter.d.ts +++ b/types/material__tabs/tab-bar/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MDCTabBarAdapter { +export default interface MDCTabBarAdapter { addClass(className: string): void; removeClass(className: string): void; diff --git a/types/material__tabs/tab-bar/foundation.d.ts b/types/material__tabs/tab-bar/foundation.d.ts index 2e5ccb1de2..84693dc2cd 100644 --- a/types/material__tabs/tab-bar/foundation.d.ts +++ b/types/material__tabs/tab-bar/foundation.d.ts @@ -15,10 +15,8 @@ */ import MDCFoundation from 'material__base/foundation'; -import { getCorrectPropertyName } from 'material__animation'; - import { cssClasses, strings } from './constants'; -import { MDCTabBarAdapter } from './adapter'; +import MDCTabBarAdapter from './adapter'; export default class MDCTabBarFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; diff --git a/types/material__tabs/tab-bar/index.d.ts b/types/material__tabs/tab-bar/index.d.ts index 127a62217f..d50d841105 100644 --- a/types/material__tabs/tab-bar/index.d.ts +++ b/types/material__tabs/tab-bar/index.d.ts @@ -16,9 +16,9 @@ import MDCComponent from 'material__base/component'; -import { MDCTab, MDCTabFoundation } from '../tab/index'; +import { MDCTab } from '../tab'; import MDCTabBarFoundation from './foundation'; -import { MDCTabBarAdapter } from './adapter'; +import MDCTabBarAdapter from './adapter'; export {MDCTabBarAdapter, MDCTabBarFoundation}; @@ -33,7 +33,5 @@ export class MDCTabBar extends MDCComponent MDCTab): void; - getDefaultFoundation(): MDCTabBarFoundation; - layout(): void; } diff --git a/types/material__tabs/tab/adapter.d.ts b/types/material__tabs/tab/adapter.d.ts index bc07aa5aa7..2058c690e4 100644 --- a/types/material__tabs/tab/adapter.d.ts +++ b/types/material__tabs/tab/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MDCTabAdapter { +export default interface MDCTabAdapter { addClass(className: string): void; removeClass(className: string): void; diff --git a/types/material__tabs/tab/foundation.d.ts b/types/material__tabs/tab/foundation.d.ts index 46e14065c8..04f727fcb2 100644 --- a/types/material__tabs/tab/foundation.d.ts +++ b/types/material__tabs/tab/foundation.d.ts @@ -16,9 +16,9 @@ import MDCFoundation from 'material__base/foundation'; import { cssClasses, strings } from './constants'; -import { MDCTabAdapter } from './adapter'; +import MDCTabAdapter from './adapter'; -export class MDCTabFoundation extends MDCFoundation { +export default class MDCTabFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; diff --git a/types/material__tabs/tab/index.d.ts b/types/material__tabs/tab/index.d.ts index bf41b77e65..43fc8b4ec6 100644 --- a/types/material__tabs/tab/index.d.ts +++ b/types/material__tabs/tab/index.d.ts @@ -15,11 +15,8 @@ */ import MDCComponent from 'material__base/component'; -import { MDCRipple } from 'material__ripple'; - -import { MDCTabAdapter } from './adapter'; -import { cssClasses } from './constants'; -import { MDCTabFoundation } from './foundation'; +import MDCTabFoundation from './foundation'; +import MDCTabAdapter from './adapter'; export {MDCTabAdapter, MDCTabFoundation}; @@ -34,10 +31,6 @@ export class MDCTab extends MDCComponent { preventDefaultOnClick: boolean; - destroy(): void; - - getDefaultFoundation(): MDCTabFoundation; - initialSyncWithDOM(): void; measureSelf(): void; diff --git a/types/material__textfield/adapter.d.ts b/types/material__textfield/adapter.d.ts index ca13544c26..8a583b20e5 100644 --- a/types/material__textfield/adapter.d.ts +++ b/types/material__textfield/adapter.d.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. All Rights Reserved. + * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,14 +15,22 @@ * limitations under the License. */ -import MDCTextFieldBottomLineFoundation from './bottom-line/foundation'; -import MDCTextFieldHelperTextFoundation from './helper-text/foundation'; +import { MDCTextFieldHelperTextFoundation } from './helper-text'; +import { MDCTextFieldIconFoundation } from './icon'; export interface NativeInputType { value: string; disabled: boolean; badInput: boolean; - checkValidity(): boolean; + validity: { + badInput: boolean; + valid: boolean; + }; +} + +export interface FoundationMapType { + helperText?: MDCTextFieldHelperTextFoundation; + icon?: MDCTextFieldIconFoundation; } /** @@ -32,10 +40,8 @@ export interface NativeInputType { * adapter to integrate the Text Field into your framework. See * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md * for more information. - * - * @record */ -export class MDCTextFieldAdapter { +export default interface MDCTextFieldAdapter { /** * Adds a class to the root Element. */ @@ -47,27 +53,9 @@ export class MDCTextFieldAdapter { removeClass(className: string): void; /** - * Adds a class to the label Element. We recommend you add a conditional - * check here, and in removeClassFromLabel for whether or not the label is - * present so that the JS component could be used with text fields that don't - * require a label, such as the full-width text field. + * Returns true if the root element contains the given class name. */ - addClassToLabel(className: string): void; - - /** - * Removes a class from the label Element. - */ - removeClassFromLabel(className: string): void; - - /** - * Sets an attribute on the icon Element. - */ - setIconAttr(name: string, value: string): void; - - /** - * Returns true if classname exists for a given target element. - */ - eventTargetHasClass(target: EventTarget, className: string): boolean; + hasClass(className: string): boolean; /** * Registers an event handler on the root element for a given event. @@ -79,28 +67,6 @@ export class MDCTextFieldAdapter { */ deregisterTextFieldInteractionHandler(type: string, handler: EventListener): void; - /** - * Emits a custom event "MDCTextField:icon" denoting a user has clicked the icon. - */ - notifyIconAction(): void; - - /** - * Adds a class to the helper text element. Note that in our code we check for - * whether or not we have a helper text element and if we don't, we simply - * return. - */ - addClassToHelperText(className: string): void; - - /** - * Removes a class from the helper text element. - */ - removeClassFromHelperText(className: string): void; - - /** - * Returns whether or not the helper text element contains the given class. - */ - helperTextHasClass(className: string): boolean; - /** * Registers an event listener on the native input element for a given event. */ @@ -112,29 +78,14 @@ export class MDCTextFieldAdapter { deregisterInputInteractionHandler(evtType: string, handler: EventListener): void; /** - * Registers an event listener on the bottom line element for a given event. + * Registers a validation attribute change listener on the input element. */ - registerBottomLineEventHandler(evtType: string, handler: EventListener): void; + registerValidationAttributeChangeHandler(handler: EventListener): void; /** - * Deregisters an event listener on the bottom line element for a given event. + * Disconnects a validation attribute observer on the input element. */ - deregisterBottomLineEventHandler(evtType: string, handler: EventListener): void; - - /** - * Sets an attribute with a given value on the helper text element. - */ - setHelperTextAttr(name: string, value: string): void; - - /** - * Removes an attribute from the helper text element. - */ - removeHelperTextAttr(name: string): void; - - /** - * Sets the text content for the help text element - */ - setHelperTextContent(content: string): void; + deregisterValidationAttributeChangeHandler(observer: MutationObserver): void; /** * Returns an object representing the native text input element, with a @@ -145,17 +96,72 @@ export class MDCTextFieldAdapter { * in your implementation it's important to keep this in mind. Also note that * this method can return null, which the foundation will handle gracefully. */ - getNativeInput(): Element|NativeInputType; + getNativeInput(): (Element | (NativeInputType | null)) | null; /** - * Returns the foundation for the bottom line element. Returns undefined if - * there is no bottom line element. + * Returns true if the textfield is focused. + * We achieve this via `document.activeElement === this.root_`. */ - getBottomLineFoundation(): MDCTextFieldBottomLineFoundation; + isFocused(): boolean; /** - * Returns the foundation for the helper text element. Returns undefined if - * there is no helper text element. + * Returns true if the direction of the root element is set to RTL. */ - getHelperTextFoundation(): MDCTextFieldHelperTextFoundation; + isRtl(): boolean; + + /** + * Activates the line ripple. + */ + activateLineRipple(): void; + + /** + * Deactivates the line ripple. + */ + deactivateLineRipple(): void; + + /** + * Sets the transform origin of the line ripple. + */ + setLineRippleTransformOrigin(normalizedX: number): void; + + /** + * Only implement if label exists. + * Shakes label if shouldShake is true. + */ + shakeLabel(shouldShake: boolean): void; + + /** + * Only implement if label exists. + * Floats the label above the input element if shouldFloat is true. + */ + floatLabel(shouldFloat: boolean): void; + + /** + * Returns true if label element exists, false if it doesn't. + */ + hasLabel(): boolean; + + /** + * Only implement if label exists. + * Returns width of label in pixels. + */ + getLabelWidth(): number; + + /** + * Returns true if outline element exists, false if it doesn't. + */ + hasOutline(): boolean; + + /** + * Only implement if outline element exists. + * Updates SVG Path and outline element based on the + * label element width and RTL context. + */ + notchOutline(labelWidth: number, isRtl: boolean | undefined): void; + + /** + * Only implement if outline element exists. + * Closes notch in outline element. + */ + closeOutline(): void; } diff --git a/types/material__textfield/constants.d.ts b/types/material__textfield/constants.d.ts index 7150bb4b14..8877368c48 100644 --- a/types/material__textfield/constants.d.ts +++ b/types/material__textfield/constants.d.ts @@ -15,26 +15,29 @@ * limitations under the License. */ -import { MDCStrings } from 'material__base'; +import { MDCStrings, MDCNumbers } from 'material__base'; export interface strings extends MDCStrings { ARIA_CONTROLS: 'aria-controls'; INPUT_SELECTOR: '.mdc-text-field__input'; - LABEL_SELECTOR: '.mdc-text-field__label'; + LABEL_SELECTOR: '.mdc-floating-label'; ICON_SELECTOR: '.mdc-text-field__icon'; - ICON_EVENT: 'MDCTextField:icon'; - BOTTOM_LINE_SELECTOR: '.mdc-text-field__bottom-line'; + OUTLINE_SELECTOR: '.mdc-notched-outline'; + LINE_RIPPLE_SELECTOR: '.mdc-line-ripple'; } export interface cssClasses extends MDCStrings { ROOT: 'mdc-text-field'; UPGRADED: 'mdc-text-field--upgraded'; DISABLED: 'mdc-text-field--disabled'; + DENSE: 'mdc-text-field--dense'; FOCUSED: 'mdc-text-field--focused'; INVALID: 'mdc-text-field--invalid'; - LABEL_FLOAT_ABOVE: 'mdc-text-field__label--float-above'; - LABEL_SHAKE: 'mdc-text-field__label--shake'; BOX: 'mdc-text-field--box'; - TEXT_FIELD_ICON: 'mdc-text-field__icon'; - TEXTAREA: 'mdc-text-field--textarea'; + OUTLINED: 'mdc-text-field--outlined'; +} + +export interface numbers extends MDCNumbers { + LABEL_SCALE: 0.75; + DENSE_LABEL_SCALE: 0.923; } diff --git a/types/material__textfield/foundation.d.ts b/types/material__textfield/foundation.d.ts index d36d83867e..ffc0436f45 100644 --- a/types/material__textfield/foundation.d.ts +++ b/types/material__textfield/foundation.d.ts @@ -16,29 +16,44 @@ */ import MDCFoundation from 'material__base/foundation'; -import { MDCTextFieldAdapter, NativeInputType } from './adapter'; -import MDCTextFieldBottomLineFoundation from './bottom-line/foundation'; -import { cssClasses, strings } from './constants'; +import { cssClasses, strings, numbers } from './constants'; +import MDCTextFieldAdapter, { FoundationMapType } from './adapter'; export default class MDCTextFieldFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; + static readonly numbers: numbers; + + readonly shouldShake: boolean; + + readonly shouldFloat: boolean; + static readonly defaultAdapter: MDCTextFieldAdapter; - handleTextFieldInteraction(evt: Event): void; + constructor(adapter: MDCTextFieldAdapter, foundationMap?: FoundationMapType); + /** + * Handles user interactions with the Text Field. + */ + handleTextFieldInteraction(): void; + + /** + * Opens/closes the notched outline. + */ + + notchOutline(openNotch: boolean): void; /** * Activates the text field focus state. */ - activateFocus(): void; + activateFocus(): void; /** - * Sets the bottom line's transform origin, so that the bottom line activate + * Sets the line ripple's transform origin, so that the line ripple activate * animation will animate out from the user's click location. */ - setBottomLineTransformOrigin(evt: Event): void; + setTransformOrigin(evt: Event): void; /** * Activates the Text Field's focus state in cases when the input value @@ -46,34 +61,19 @@ export default class MDCTextFieldFoundation extends MDCFoundation { + static readonly strings: strings; + + static readonly defaultAdapter: MDCTextFieldIconAdapter; + + /** + * Sets the content of the helper text field. + */ + setDisabled(disabled: boolean): void; + + /** + * Handles an interaction event + */ + handleInteraction(evt: Event): void; +} diff --git a/types/material__textfield/bottom-line/index.d.ts b/types/material__textfield/icon/index.d.ts similarity index 58% rename from types/material__textfield/bottom-line/index.d.ts rename to types/material__textfield/icon/index.d.ts index a0ed4ff36d..3e6cfc542b 100644 --- a/types/material__textfield/bottom-line/index.d.ts +++ b/types/material__textfield/icon/index.d.ts @@ -14,18 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import MDCComponent from 'material__base/component'; +import MDCTextFieldIconFoundation from './foundation'; +import MDCTextFieldIconAdapter from './adapter'; -import MDCTextFieldBottomLineAdapter from './adapter'; -import MDCTextFieldBottomLineFoundation from './foundation'; +export { MDCTextFieldIconFoundation, MDCTextFieldIconAdapter }; -export {MDCTextFieldBottomLineAdapter, MDCTextFieldBottomLineFoundation}; +export class MDCTextFieldIcon extends MDCComponent { + static attachTo(root: Element): MDCTextFieldIcon; -export class MDCTextFieldBottomLine extends MDCComponent { - static attachTo(root: Element): MDCTextFieldBottomLine; - - readonly foundation: MDCTextFieldBottomLineFoundation; - - getDefaultFoundation(): MDCTextFieldBottomLineFoundation; + readonly foundation: MDCTextFieldIconFoundation; } diff --git a/types/material__textfield/index.d.ts b/types/material__textfield/index.d.ts index 85d4c36420..b3e61550c9 100644 --- a/types/material__textfield/index.d.ts +++ b/types/material__textfield/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -22,25 +22,29 @@ */ import MDCComponent from 'material__base/component'; -import { MDCRipple } from 'material__ripple'; - -import { cssClasses, strings } from './constants'; -import { MDCTextFieldAdapter } from './adapter'; import MDCTextFieldFoundation from './foundation'; -import { MDCTextFieldBottomLine } from './bottom-line/index'; -import { MDCTextFieldHelperText } from './helper-text/index'; +import MDCTextFieldAdapter, { FoundationMapType } from './adapter'; +import { MDCTextFieldHelperText, MDCTextFieldHelperTextFoundation, MDCTextFieldHelperTextAdapter } from './helper-text'; +import { MDCTextFieldIcon, MDCTextFieldIconFoundation, MDCTextFieldIconAdapter } from './icon'; +import { MDCRipple, MDCRippleFoundation } from 'material__ripple'; +import { MDCLineRipple } from 'material__line-ripple'; +import { MDCFloatingLabel } from 'material__floating-label'; +import { MDCNotchedOutline } from 'material__notched-outline'; -export {MDCTextFieldAdapter, MDCTextFieldFoundation}; +export { MDCTextFieldFoundation, MDCTextFieldAdapter, MDCTextFieldHelperText }; +export { MDCTextFieldHelperTextFoundation, MDCTextFieldHelperTextAdapter, MDCTextFieldIcon }; +export { MDCTextFieldIconFoundation, MDCTextFieldIconAdapter }; export class MDCTextField extends MDCComponent { static attachTo(root: Element): MDCTextField; initialize( - rippleFactory?: (el: Element) => MDCRipple, - bottomLineFactory?: (el: Element) => MDCTextFieldBottomLine - ): void; - - destroy(): void; + rippleFactory?: (el: Element, foundation: MDCRippleFoundation) => MDCRipple, + lineRippleFactory?: (el: Element) => MDCLineRipple, + helperTextFactory?: (el: Element) => MDCTextFieldHelperText, + iconFactory?: (el: Element) => MDCTextFieldIcon, + labelFactory?: (el: Element) => MDCFloatingLabel, + outlineFactory?: (el: Element) => MDCNotchedOutline): void; /** * Initiliazes the Text Field's internal state based on the environment's @@ -48,14 +52,30 @@ export class MDCTextField extends MDCComponent { - static readonly cssClasses: cssClasses; + static readonly cssClasses: cssClasses; - static readonly strings: strings; + static readonly strings: strings; - static readonly numbers: numbers; + static readonly numbers: numbers; - static readonly defaultAdapter: MDCToolbarAdapter; + static readonly defaultAdapter: MDCToolbarAdapter; - updateAdjustElementStyles(): void; + updateAdjustElementStyles(): void; } diff --git a/types/material__toolbar/index.d.ts b/types/material__toolbar/index.d.ts index 1b048c64c9..75bcbcda5f 100644 --- a/types/material__toolbar/index.d.ts +++ b/types/material__toolbar/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -23,15 +23,12 @@ import { MDCComponent } from 'material__base'; import MDCToolbarFoundation from './foundation'; -import { MDCToolbarAdapter } from './adapter'; -import * as util from './util'; +import MDCToolbarAdapter from './adapter'; -export {MDCToolbarAdapter, MDCToolbarFoundation, util}; +export {MDCToolbarAdapter, MDCToolbarFoundation}; export class MDCToolbar extends MDCComponent { - static attachTo(root: HTMLElement): MDCToolbar; + static attachTo(root: Element): MDCToolbar; - fixedAdjustElement: HTMLElement; - - getDefaultFoundation(): MDCToolbarFoundation; + fixedAdjustElement: HTMLElement; } diff --git a/types/material__toolbar/tsconfig.json b/types/material__toolbar/tsconfig.json index 826161ca25..2af99c6e5e 100644 --- a/types/material__toolbar/tsconfig.json +++ b/types/material__toolbar/tsconfig.json @@ -2,7 +2,6 @@ "files": [ "constants.d.ts", "adapter.d.ts", - "util.d.ts", "index.d.ts", "foundation.d.ts" ], diff --git a/types/material__top-app-bar/adapter.d.ts b/types/material__top-app-bar/adapter.d.ts new file mode 100644 index 0000000000..72d0f3430f --- /dev/null +++ b/types/material__top-app-bar/adapter.d.ts @@ -0,0 +1,77 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Adapter for MDC Top App Bar + * + * Defines the shape of the adapter expected by the foundation. Implement this + * adapter to integrate the Top App Bar into your framework. See + * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md + * for more information. + */ +export default interface MDCTopAppBarAdapter { + /** + * Adds a class to the root Element. + */ + addClass(className: string): void; + + /** + * Removes a class from the root Element. + */ + removeClass(className: string): void; + + /** + * Returns true if the root Element contains the given class. + */ + hasClass(className: string): boolean; + + /** + * Sets the specified inline style property on the root Element to the given value. + */ + setStyle(property: string, value: string): void; + + /** + * Gets the height of the top app bar. + */ + getTopAppBarHeight(): number; + + /** + * Registers an event handler on the navigation icon element for a given event. + */ + registerNavigationIconInteractionHandler(type: string, handler: EventListener): void; + + /** + * Deregisters an event handler on the navigation icon element for a given event. + */ + deregisterNavigationIconInteractionHandler(type: string, handler: EventListener): void; + + /** + * Emits an event when the navigation icon is clicked. + */ + notifyNavigationIconClicked(): void; + + registerScrollHandler(handler: EventListener): void; + + deregisterScrollHandler(handler: EventListener): void; + + registerResizeHandler(handler: EventListener): void; + + deregisterResizeHandler(handler: EventListener): void; + + getViewportScrollY(): number; + + getTotalActionItems(): number; +} diff --git a/types/material__top-app-bar/constants.d.ts b/types/material__top-app-bar/constants.d.ts new file mode 100644 index 0000000000..9f16a92a3f --- /dev/null +++ b/types/material__top-app-bar/constants.d.ts @@ -0,0 +1,38 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MDCStrings, MDCNumbers } from 'material__base'; + +export interface cssClasses extends MDCStrings { + FIXED_CLASS: 'mdc-top-app-bar--fixed'; + FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed-scrolled'; + SHORT_CLASS: 'mdc-top-app-bar--short'; + SHORT_HAS_ACTION_ITEM_CLASS: 'mdc-top-app-bar--short-has-action-item'; + SHORT_COLLAPSED_CLASS: 'mdc-top-app-bar--short-collapsed'; +} + +export interface numbers extends MDCNumbers { + DEBOUNCE_THROTTLE_RESIZE_TIME_MS: 100; + MAX_TOP_APP_BAR_HEIGHT: 128; +} + +export interface strings extends MDCStrings { + ACTION_ITEM_SELECTOR: '.mdc-top-app-bar__action-item'; + NAVIGATION_EVENT: 'MDCTopAppBar:nav'; + NAVIGATION_ICON_SELECTOR: '.mdc-top-app-bar__navigation-icon'; + ROOT_SELECTOR: '.mdc-top-app-bar'; + TITLE_SELECTOR: '.mdc-top-app-bar__title'; +} diff --git a/types/material__top-app-bar/fixed/foundation.d.ts b/types/material__top-app-bar/fixed/foundation.d.ts new file mode 100644 index 0000000000..21b5e22092 --- /dev/null +++ b/types/material__top-app-bar/fixed/foundation.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCTopAppBarFoundation from '../foundation'; +import MDCTopAppBarAdapter from '../adapter'; + +export default class MDCFixedTopAppBarFoundation extends MDCTopAppBarFoundation { +} diff --git a/types/material__menu/simple/foundation.d.ts b/types/material__top-app-bar/foundation.d.ts similarity index 63% rename from types/material__menu/simple/foundation.d.ts rename to types/material__top-app-bar/foundation.d.ts index 78071374b3..d0f6d68484 100644 --- a/types/material__menu/simple/foundation.d.ts +++ b/types/material__top-app-bar/foundation.d.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2016 Google Inc. All Rights Reserved. + * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,28 +16,15 @@ */ import MDCFoundation from 'material__base/foundation'; -import MDCSimpleMenuAdapter from './adapter'; import { cssClasses, strings, numbers } from './constants'; -import { clamp, bezierProgress } from '../util'; - -export default class MDCSimpleMenuFoundation extends MDCFoundation { - static readonly cssClasses: cssClasses; +import MDCTopAppBarAdapter from './adapter'; +export default class MDCTopAppBarBaseFoundation extends MDCFoundation { static readonly strings: strings; + static readonly cssClasses: cssClasses; + static readonly numbers: numbers; - static readonly defaultAdapter: MDCSimpleMenuAdapter; - - /** - * Open the menu. - */ - open(options?: {focusIndex?: number}): void; - - /** - * Closes the menu. - */ - close(evt?: Event): void; - - isOpen(): boolean; + static readonly defaultAdapter: MDCTopAppBarAdapter; } diff --git a/types/material__top-app-bar/index.d.ts b/types/material__top-app-bar/index.d.ts new file mode 100644 index 0000000000..da37e36f23 --- /dev/null +++ b/types/material__top-app-bar/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCComponent from 'material__base/component'; +import MDCTopAppBarBaseFoundation from './foundation'; +import MDCTopAppBarAdapter from './adapter'; +import MDCFixedTopAppBarFoundation from './fixed/foundation'; +import MDCShortTopAppBarFoundation from './short/foundation'; +import MDCTopAppBarFoundation from './standard/foundation'; +import { MDCRipple } from 'material__ripple'; + +export { MDCTopAppBarBaseFoundation, MDCTopAppBarAdapter, MDCTopAppBarFoundation, MDCFixedTopAppBarFoundation, MDCShortTopAppBarFoundation }; + +export class MDCTopAppBar extends MDCComponent { + initialize(rippleFactory?: (el: Element) => MDCRipple): void; + + static attachTo(root: Element): MDCTopAppBar; +} diff --git a/types/material__top-app-bar/short/foundation.d.ts b/types/material__top-app-bar/short/foundation.d.ts new file mode 100644 index 0000000000..036b65216e --- /dev/null +++ b/types/material__top-app-bar/short/foundation.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCTopAppBarBaseFoundation from '../foundation'; +import MDCTopAppBarAdapter from '../adapter'; + +export default class MDCShortTopAppBarFoundation extends MDCTopAppBarBaseFoundation { +} diff --git a/types/material__top-app-bar/standard/foundation.d.ts b/types/material__top-app-bar/standard/foundation.d.ts new file mode 100644 index 0000000000..d9d39b4646 --- /dev/null +++ b/types/material__top-app-bar/standard/foundation.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCTopAppBarBaseFoundation from '../foundation'; +import MDCTopAppBarAdapter from '../adapter'; + +export default class MDCTopAppBarFoundation extends MDCTopAppBarBaseFoundation { +} diff --git a/types/material__top-app-bar/tsconfig.json b/types/material__top-app-bar/tsconfig.json new file mode 100644 index 0000000000..5652908420 --- /dev/null +++ b/types/material__top-app-bar/tsconfig.json @@ -0,0 +1,30 @@ +{ + "files": [ + "fixed/foundation.d.ts", + "short/foundation.d.ts", + "standard/foundation.d.ts", + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__top-app-bar/tslint.json b/types/material__top-app-bar/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__top-app-bar/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/mathjs/index.d.ts b/types/mathjs/index.d.ts index a02729b635..cdecc3e1b4 100644 --- a/types/mathjs/index.d.ts +++ b/types/mathjs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for mathjs 3.20 +// Type definitions for mathjs 3.21 // Project: http://mathjs.org/ // Definitions by: Ilya Shestakov , // Andy Patterson @@ -1307,9 +1307,26 @@ declare namespace math { // tslint:disable-line strict-export-declare-modifiers phi: number; } + interface MathJSON { + mathjs?: string; + value: number; + unit: string; + fixPrefix?: boolean; + } + interface Unit { to(unit: string): Unit; toNumber(unit: string): number; + clone(): Unit; + equalBase(unit: Unit): boolean; + equals(unit: Unit): boolean; + format(options: FormatOptions): string; + fromJSON(json: MathJSON): Unit; + toJSON(): MathJSON; + splitUnit(parts: ReadonlyArray): Unit[]; + toNumeric(unit: string): number | Fraction | BigNumber; + toSI(): Unit; + toString(): string; } interface CreateUnitOptions { diff --git a/types/memoize-one/index.d.ts b/types/memoize-one/index.d.ts new file mode 100644 index 0000000000..caac3a4429 --- /dev/null +++ b/types/memoize-one/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for memoize-one 3.1 +// Project: https://github.com/alexreardon/memoize-one#readme +// Definitions by: Karol Majewski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = memoizeOne; + +declare function memoizeOne any>(resultFn: T, isEqual?: memoizeOne.EqualityFn): T; + +declare namespace memoizeOne { + type EqualityFn = (a: any, b: any) => boolean; +} diff --git a/types/memoize-one/memoize-one-tests.ts b/types/memoize-one/memoize-one-tests.ts new file mode 100644 index 0000000000..7ab20ac891 --- /dev/null +++ b/types/memoize-one/memoize-one-tests.ts @@ -0,0 +1,33 @@ +import memoizeOne = require('memoize-one'); + +declare function add(a: number, b: number): number ; +declare function lousyEqualityFn(a: any, b: any): boolean; +declare function strictEqualityFn(a: T, b: T): boolean; + +/** + * Accepts a second argument. + */ +memoizeOne(add); // $ExpectType (a: number, b: number) => number +memoizeOne(add, lousyEqualityFn); // $ExpectType (a: number, b: number) => number +memoizeOne(add, strictEqualityFn); // $ExpectType (a: number, b: number) => number + +/** + * The second argument can be, but doesn't have to be stritly typed. + */ +memoizeOne(add, (a, b) => a === b); // $ExpectType (a: number, b: number) => number +memoizeOne(add, (a: string, b: string) => a === b); // $ExpectType (a: number, b: number) => number + +/** + * Function passed as the second argument accepts exactly two arguments. + */ +memoizeOne(add, (a: number, b: number, c: number) => a === b || c); // $ExpectError + +/** + * Function passed as the second argument returns a boolean. + */ +memoizeOne(add, (a: string, b: string) => 0); // $ExpectError + +/** + * The `EqualityFn` type is publicly accessible. + */ +const simpleIsEqual: memoizeOne.EqualityFn = (x: number, y: number): boolean => (x === y); diff --git a/types/memoize-one/tsconfig.json b/types/memoize-one/tsconfig.json new file mode 100644 index 0000000000..af1c249358 --- /dev/null +++ b/types/memoize-one/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "memoize-one-tests.ts" + ] +} diff --git a/types/memoize-one/tslint.json b/types/memoize-one/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/memoize-one/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/memory-fs/index.d.ts b/types/memory-fs/index.d.ts index 9578bb3548..23b3f0aef9 100644 --- a/types/memory-fs/index.d.ts +++ b/types/memory-fs/index.d.ts @@ -43,13 +43,13 @@ declare class MemoryFileSystem { writeFileSync(_path: string, content: string | Buffer, encoding?: string): void; createReadStream( - path: string, options: { + path: string, options?: { start: number; end: number; } ): any; - createWriteStream(path: string, options: any): any; + createWriteStream(path: string, options?: any): any; exists(path: string, callback: (isExist: boolean) => any): any; diff --git a/types/memory-fs/test/index.ts b/types/memory-fs/test/index.ts index 07abb3e3fe..16d477baf2 100644 --- a/types/memory-fs/test/index.ts +++ b/types/memory-fs/test/index.ts @@ -15,3 +15,7 @@ fs.writeFile('hello', 'hahahahah', 'utf-8', function (err) { console.log(err.message); } }); + +fs.createReadStream('hello'); + +fs.createWriteStream('hello'); \ No newline at end of file diff --git a/types/mfiles/tsconfig.json b/types/mfiles/tsconfig.json index 295542875a..0b95d12fb9 100644 --- a/types/mfiles/tsconfig.json +++ b/types/mfiles/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/mkdirp-promise/index.d.ts b/types/mkdirp-promise/index.d.ts new file mode 100644 index 0000000000..a4f389bca3 --- /dev/null +++ b/types/mkdirp-promise/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for mkdirp-promise 5.0 +// Project: https://github.com/ahmadnassri/mkdirp-promise +// Definitions by: Alan Plum +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import mkdirp = require("mkdirp"); + +declare function mkdirpPromise( + path: string, + opts?: mkdirp.Mode | mkdirp.Options +): Promise; +export = mkdirpPromise; diff --git a/types/mkdirp-promise/mkdirp-promise-tests.ts b/types/mkdirp-promise/mkdirp-promise-tests.ts new file mode 100644 index 0000000000..28efeb0766 --- /dev/null +++ b/types/mkdirp-promise/mkdirp-promise-tests.ts @@ -0,0 +1,6 @@ +import mkdirpPromise = require("mkdirp-promise"); + +(async () => { + const path = await mkdirpPromise("hello"); + if (path) await mkdirpPromise(path, { mode: 123 }); +})(); diff --git a/types/mkdirp-promise/tsconfig.json b/types/mkdirp-promise/tsconfig.json new file mode 100644 index 0000000000..fd526f1aee --- /dev/null +++ b/types/mkdirp-promise/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "mkdirp-promise-tests.ts"] +} diff --git a/types/mkdirp-promise/tslint.json b/types/mkdirp-promise/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mkdirp-promise/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/mochaccino/index.d.ts b/types/mochaccino/index.d.ts index b230218ee9..3f0a2e9688 100644 --- a/types/mochaccino/index.d.ts +++ b/types/mochaccino/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/pawelgalazka/mochaccino#readme // Definitions by: Thomas-P // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as Sinon from "sinon"; export interface Expect { not: Expect; diff --git a/types/moment-timezone/index.d.ts b/types/moment-timezone/index.d.ts index da5e42bc2d..48eae90088 100644 --- a/types/moment-timezone/index.d.ts +++ b/types/moment-timezone/index.d.ts @@ -57,7 +57,7 @@ declare module "moment" { } interface Moment { - tz(): string; + tz(): string | undefined; tz(timezone: string): Moment; zoneAbbr(): string; zoneName(): string; diff --git a/types/moment-timezone/moment-timezone-tests.ts b/types/moment-timezone/moment-timezone-tests.ts index 66bb7403ea..44b00abf10 100644 --- a/types/moment-timezone/moment-timezone-tests.ts +++ b/types/moment-timezone/moment-timezone-tests.ts @@ -83,3 +83,5 @@ moment.tz.guess(true); const zoneAbbr: string = moment.tz('America/Los_Angeles').zoneAbbr(); const zoneName: string = moment.tz('America/Los_Angeles').zoneName(); + +const zoneType: string | undefined = moment.tz('2013-11-18 11:55').tz(); diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 036e9f58ce..34bdba9047 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -36,6 +36,7 @@ declare namespace next { } interface Server { + setAssetPrefix: (cdnUrl: string) => void; handleRequest( req: http.IncomingMessage, res: http.ServerResponse, diff --git a/types/node/index.d.ts b/types/node/index.d.ts index d964a41c43..9a9fc544e2 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -713,6 +713,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; env: ProcessEnv; exit(code?: number): never; diff --git a/types/node/v0/index.d.ts b/types/node/v0/index.d.ts index 37f92cbc50..b88dd54a0c 100644 --- a/types/node/v0/index.d.ts +++ b/types/node/v0/index.d.ts @@ -242,6 +242,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; env: any; exit(code?: number): void; getgid(): number; diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index db5518575d..dab3b0c5d9 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -417,6 +417,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; env: any; exit(code?: number): void; exitCode: number; diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 9d2ea9ea00..056021841c 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -480,6 +480,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; env: any; exit(code?: number): void; diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index 58497e23d6..055933977d 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -477,6 +477,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; env: any; exit(code?: number): never; diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 27014e0cb0..defcda33d8 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -561,6 +561,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; env: ProcessEnv; exit(code?: number): never; diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index 014fd9bac1..a7fea9c48e 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -704,6 +704,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; env: ProcessEnv; exit(code?: number): never; diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index d0eaf593c5..729b4c1bc1 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -15,11 +15,20 @@ Copyright (c) Microsoft Corporation //////////////////////////////////////////////////////////////// declare namespace Office { + /** + * Provides a container for APIs that are still in Preview, not released for use in production add-ins. + */ export var Preview: { + /** + * Initializes the use of custom JavaScript functions in Excel. + */ startCustomFunctions(): Promise; } export var Promise: PromiseConstructor; + /** + * Gets the Context object that represents the runtime environment of the add-in and provides access to the top-level objects of the API. + */ export var context: Context; /** * This method is called after the Office API was loaded. @@ -28,126 +37,231 @@ declare namespace Office { export function initialize(reason: InitializationReason): void; /** * Ensures that the Office JavaScript APIs are ready to be called by the add-in. If the framework hasn't initialized yet, the callback or promise will wait until the Office host is ready to accept API calls. - * Note that though this API is intended to be used inside an Office add-in, it can also be used outside the add-in. In that case, once Office.js determines that it is running outside of an Office host application, it will call the callback and resolve the promise with "null" for both the host and platform. + * Note that though this API is intended to be used inside an Office add-in, it can also be used outside the add-in. In that case, once Office.js determines that it is running outside of an Office host application, it will call the callback and resolve the promise with "null" for both the host and platform. * @param callback - An optional callback method, that will receive the host and platform info. Alternatively, rather than use a callback, an add-in may simply wait for the Promise returned by the function to resolve. * @returns A Promise that contains the host and platform info, once initialization is completed. */ export function onReady(callback?: (info: { host: HostType, platform: PlatformType }) => any): Promise<{ host: HostType, platform: PlatformType }>; /** * Indicates if the large namespace for objects will be used or not. - * @param useShortNamespace Indicates if 'true' that the short namespace will be used + * @param useShortNamespace Indicates if 'true' that the short namespace will be used */ export function useShortNamespace(useShortNamespace: boolean): void; // Enumerations + /** + * Specifies the result of an asynchronous call. + * @remarks + * Returned by the status property of the AsyncResult object. + * + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export enum AsyncResultStatus { /** - * Operation succeeded + * The call succeeded. */ Succeeded, /** - * Operation failed, check error object + * The call failed, check the error object. */ Failed } + /** + * Specifies whether the add-in was just inserted or was already contained in the document. + * + * @remarks + * Hosts: Excel, Project, Word + */ export enum InitializationReason { /** - * Indicates the app was just inserted in the document + * The add-in was just inserted into the document. */ Inserted, /** - * Indicates if the extension already existed in the document + * The add-in is already part of the document that was opened. */ DocumentOpened } + /** + * Specifies the host Office application in which the add-in is running. + * + * @remarks + * Hosts: Excel, Word, PowerPoint, Outlook, OneNote, Project, Access + */ export enum HostType { /** - * Host is Word + * The Office host is Microsoft Word. */ Word, /** - * Host is Excel + * The Office host is Microsoft Excel. */ Excel, /** - * Host is PowerPoint + * The Office host is Microsoft PowerPoint. */ PowerPoint, /** - * Host is Outlook + * The Office host is Microsoft Outlook. */ Outlook, /** - * Host is OneNote + * The Office host is Microsoft OneNote. */ OneNote, /** - * Host is Project + * The Office host is Microsoft Project. */ Project, /** - * Host is Access + * The Office host is Microsoft Access. */ Access } + /** + * Specifies the OS or other platform on which the Office host application is running. + * + * @remarks + * Hosts: Excel, Word, PowerPoint, Outlook, OneNote, Project, Access + */ export enum PlatformType { /** - * Platform is PC + * The platform is PC (Windows). */ PC, /** - * Platform is Web + * The platform is Office Online. */ OfficeOnline, /** - * Platform is Mac + * The platform is Mac. */ Mac, /** - * Platform is iOS + * The platform an iOS device. */ iOS, /** - * Platform is Android + * The platform is an Android device. */ Android, /** - * Platform is Winrt + * The platform is WinRT. */ Universal } // Objects - export interface AsyncResult { + /** + * An object which encapsulates the result of an asynchronous request, including status and error information if the request failed. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + * + * When the function you pass to the `callback` parameter of an "Async" method executes, it receives an AsyncResult object that you can access from the `callback` function's only parameter. + */ + export interface AsyncResult { + /** + * Gets the user-defined item passed to the optional `asyncContext` parameter of the invoked method in the same state as it was passed in. This the user-defined item (which can be of any JavaScript type: String, Number, Boolean, Object, Array, Null, or Undefined) passed to the optional `asyncContext` parameter of the invoked method. Returns Undefined, if you didn't pass anything to the asyncContext parameter. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ asyncContext: any; + /** + * Gets the [AsyncResultStatus](office.asyncresultstatus.md) of the asynchronous operation. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ status: AsyncResultStatus; + /** + * Gets an [Error](office.error.md) object that provides a description of the error, if any error occurred. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ error: Error; + /** + * Gets the payload or content of this asynchronous operation, if any. + + * @remarks + * You access the AsyncResult object in the function passed as the argument to the callback parameter of an "Async" method, such as the `getSelectedDataAsync` and `setSelectedDataAsync` methods of the Document object. + * + * Note: What the value property returns for a particular "Async" method varies depending on the purpose and context of that method. To determine what is returned by the value property for an "Async" method, refer to the "Callback value" section of the method's topic. For a complete listing of the "Async" methods, see the Remarks section of the AsyncResult object topic. + * + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ value: any; } + /** + * Represents the runtime environment of the add-in and provides access to key objects of the API. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export interface Context { + /** + * Provides information and access to the signed-in user. + */ auth: Auth; + /** + * Gets the locale (language) specified by the user for editing the document or item. + */ contentLanguage: string; + /** + * Gets the locale (language) specified by the user for the UI of the Office host application. + */ displayLanguage: string; + /** + * + */ license: string; + /** + * Provides access to the properties for Office theme colors. + */ officeTheme: OfficeTheme; + /** + * Provides access to the properties for Office theme colors. + */ touchEnabled: boolean; + /** + * Provides objects and methods that you can use to create and manipulate UI components, such as dialog boxes. + */ ui: UI; + /** + * Contains the host in which the add-in (web application) is running in. Possible values are: Word, Excel, PowerPoint + */ host: HostType; + /** + * Provides the platform on which the add-in is running. Possible values are: PC, OfficeOnline, Mac, iOS, Android, Universal + */ platform: PlatformType; + /** + * + */ diagnostics: { host: HostType; platform: PlatformType; version: string; }; + /** + * Provides a method for determining what requirement sets are supported on the current host and platform. + */ requirements: { /** * Check if the specified requirement set is supported by the host Office application. - * @param name - Set name. e.g.: "MatrixBindings". - * @param minVersion - The minimum required version. + * @param name - Set name; e.g., "MatrixBindings". + * @param minVersion - The minimum required version; e.g., "1.4". */ isSetSupported(name: string, minVersion?: number): boolean; } } /** * Provides specific information about an error that occurred during an asynchronous data operation. + * + * @remarks + * The Error object is accessed from the AsyncResult object that is returned in the function passed as the callback argument of an asynchronous data operation, such as the setSelectedDataAsync method of the Document object. + * + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word */ export interface Error { /** @@ -163,78 +277,97 @@ declare namespace Office { */ name: string; } + /** + * Provides objects and methods that you can use to create and manipulate UI components, such as dialog boxes, in your Office Add-ins. + */ export interface UI { /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. + * Displays a dialog to show or collect information from the user or to facilitate Web navigation. + * + * @remarks + * Hosts: Word, Excel, Outlook, PowerPoint + * + * Requirement sets: DialogApi, Mailbox 1.4 + * + * The initial page must be on the same domain as the parent page (the startAddress parameter). After the initial page loads, you can go to other domains. + * + * Any page calling office.context.ui.messageParent must also be on the same domain as the parent page. + * + * The following design considerations apply to dialog boxes: + * + * - An Office Add-in can have only one dialog box open at any time. + * + * - Every dialog box can be moved and resized by the user. + * + * - Every dialog box is centered on the screen when opened. + * + * - Dialog boxes appear on top of the host application and in the order in which they were created. + * + * Use a dialog box to: + * + * - Display authentication pages to collect user credentials. + * + * - Display an error/progress/input screen from a ShowTaspane or ExecuteAction command. + * + * - Temporarily increase the surface area that a user has available to complete a task. + * + * Do not use a dialog box to interact with a document. Use a task pane instead. + * + * @param startAddress - Accepts the initial HTTPS URL that opens in the dialog. + * @param options - Optional. Accepts a DialogOptions object to define dialog display. + * @param callback - Optional. Accepts a callback method to handle the dialog creation attempt. If successful, the AsyncResult.value is a DialogHandler object. */ - displayDialogAsync(startAddress: string): void; + displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void; /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. - * @param options Optional. Accepts a DialogOptions object to define dialog behaviors. - */ - displayDialogAsync(startAddress: string, options: DialogOptions): void; - /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. - * @param callback Optional. Accepts a callback method to handle the dialog creation attempt. - */ - displayDialogAsync(startAddress: string, callback: (result: AsyncResult) => void): void; - /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. - * @param options Optional. Accepts a DialogOptions object to define dialog behaviors. - * @param callback Optional. Accepts a callback method to handle the dialog creation attempt. - */ - displayDialogAsync(startAddress: string, options: DialogOptions, callback: (result: AsyncResult) => void): void; - - /** - * Synchronously delivers a message from the dialog to its parent add-in. + * Delivers a message from the dialog box to its parent/opener page. The page calling this API must be on the same domain as the parent. * @param messageObject Accepts a message from the dialog to deliver to the add-in. */ messageParent(messageObject: any): void; /** * Closes the UI container where the JavaScript is executing. - * - * Supported hosts: Outlook - Minimum requirement set: Mailbox 1.5 - * + * + * @remarks * The behavior of this method is specified by the following: - * - * Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open. - * - * Called from a taskpane: The taskpane will close. Any dialog opened by displayDialogAsync will also close. If the taskpane supports pinning and was pinned by the user, it will be un-pinned. - * - * Called from a module extension: No effect. + * + * - Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open. + * + * - Called from a taskpane: The taskpane will close. Any dialog opened by displayDialogAsync will also close. If the taskpane supports pinning and was pinned by the user, it will be un-pinned. + * + * - Called from a module extension: No effect. + * + * Hosts: Excel, Word, PowerPoint, Outlook (Minimum requirement set: Mailbox 1.5) */ closeContainer(): void; } export interface DialogOptions { /** - * Optional. Defines the width of the dialog as a percentage of the current display. Defaults to 99%. 250px minimum. + * Defines the width of the dialog as a percentage of the current display. Defaults to 80%. 250px minimum. */ height?: number, /** - * Optional. Defines the height of the dialog as a percentage of the current display. Defaults to 99%. 150px minimum. + * Defines the height of the dialog as a percentage of the current display. Defaults to 80%. 150px minimum. */ width?: number, /** - * Optional. Determines whether the dialog box should be displayed within an IFrame. This setting is only applicable in Office Online clients, and is ignored on other platforms. + * Determines whether the dialog box should be displayed within an IFrame. This setting is only applicable in Office Online clients, and is ignored by other platforms. If false (default), the dialog will be displayed as a new browser window (pop-up). Recommended for authentication pages that cannot be displayed in an IFrame. If true, the dialog will be displayed as a floating overlay with an IFrame. This is best for user experience and performance. */ displayInIframe?: boolean } export interface Auth { /** * Obtains an access token from AAD V 2.0 endpoint to grant the Office host application access to the add-in's web application. - * @param callback Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. + * + * @remarks + * Hosts: Excel, OneNote, Outlook, PowerPoint, Word + * + * Requirement sets: IdentityAPI + * + * This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph. + * + * @param options - Optional. Accepts an AuthOptions object to define sign-on behaviors. + * @param callback - Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. */ - getAccessTokenAsync(callback: (result: AsyncResult) => void): void; - /** - * Obtains an access token from AAD V 2.0 endpoint to grant the Office host application access to the add-in's web application. - * @param options Optional. Accepts an AuthOptions object to define sign-on behaviors. - * @param callback Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. - */ - getAccessTokenAsync(options: AuthOptions, callback: (result: AsyncResult) => void): void; + getAccessTokenAsync(options?: AuthOptions, callback?: (result: AsyncResult) => void): void; } export interface AuthOptions { @@ -270,7 +403,11 @@ declare namespace Office { */ close(): void; /** - * Adds an event handler for DialogMessageReceived or DialogEventReceived + * Registers an event handler. The two supported events are: + * + * - DialogMessageReceived. Triggered when the dialog box sends a message to its parent. + * + * - DialogEventReceived. Triggered when the dialog box has been closed or otherwise unloaded. */ addEventHandler(eventType: Office.EventType, handler: Function): void; @@ -281,79 +418,142 @@ declare namespace Office { /** * Returns a promise of an object described in the expression. Callback is invoked only if method fails. * @param expression The object to be retrieved. Example "bindings#BindingName", retrieves a binding promise for a binding named 'BindingName' - * @param callback The optional callback method + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ export function select(expression: string, callback?: (result: AsyncResult) => void): Binding; // Enumerations + /** + * Specifies the state of the active view of the document, for example, whether the user can edit the document. + * @remarks + * Hosts: PowerPoint + */ export enum ActiveView { + /** + * The active view of the host application only lets the user read the content in the document. + */ Read, + /** + * The active view of the host application lets the user edit the content in the document. + */ Edit } + /** + * Specifies the type of the binding object that should be returned. + * @remarks + * Hosts: Access, Excel, Word + */ export enum BindingType { /** - * Text based Binding + * Plain text. Data is returned as a run of characters. */ Text, /** - * Matrix based Binding + * Tabular data without a header row. Data is returned as an array of arrays, for example in this form: [[row1column1, row1column2],[row2column1, row2column2]] */ Matrix, /** - * Table based Binding + * Tabular data with a header row. Data is returned as a TableData object. */ Table } + /** + * Specifies how to coerce data returned or set by the invoked method. + * + * @remarks + * PowerPoint supports only Office.CoercionType.Text, Office.CoercionType.Image, and Office.CoercionType.SlideRange. Project supports only Office.CoercionType.Text. + * + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export enum CoercionType { /** - * Coerce as Text + * Return or set data as text (string).Data is returned or set as a one-dimensional run of characters. */ Text, /** - * Coerce as Matrix + * Return or set data as tabular data with no headers. Data is returned or set as an array of arrays containing one-dimensional runs of characters. For example, three rows of string values in two columns would be: [["R1C1", "R1C2"], ["R2C1", "R2C2"], ["R3C1", "R3C2"]]. + * @remarks + * Only applies to data in Excel and Word. */ Matrix, /** - * Coerce as Table + * Return or set data as tabular data with optional headers. Data is returned or set as an array of arrays with optional headers. + * @remarks + * Only applies to data in Access, Excel and Word. */ Table, /** - * Coerce as HTML + * Return or set data as HTML. + * @remarks + * Only applies to data in add-ins for Word and Outlook add-ins for Outlook (compose mode). */ Html, /** - * Coerce as Office Open XML + * Return or set data as Office Open XML. + * @remarks + * Only applies to data in Word. */ Ooxml, /** - * Coerce as JSON object containing an array of the ids, titles, and indexes of the selected slides. + * Return a JSON object that contains an array of the ids, titles, and indexes of the selected slides.For example, {"slides":[{"id":257,"title":"Slide 2","index":2},{"id":256,"title":"Slide 1","index":1}]} for a selection of two slides. + * @remarks + * Only applies to data in PowerPoint when calling the Document.getSelectedData method to get the current slide or selected range of slides. */ SlideRange, /** - * Coerce as Image + * Data is returned or set as an image stream. + * @remarks + * Only applies to data in Excel, Word and PowerPoint. */ Image } + /** + * Specifies whether the document in the associated application is read-only or read-write. + * @remarks + * Returned by the mode property of the Document object. + * + * Hosts: Excel, PowerPoint, Project, Word + */ export enum DocumentMode { /** - * Document in Read Only Mode + * The document is read-only. */ ReadOnly, /** - * Document in Read/Write Mode + * The document can be read and written to. */ ReadWrite } + /** + * Specifies the kind of event that was raised. Returned by the type property of an EventNameEventArgs object. + * + * @remarks + * Add-ins for Project support the Office.EventType.ResourceSelectionChanged, Office.EventType.TaskSelectionChanged, and Office.EventType.ViewSelectionChanged event types. + * + * Hosts: Access, Excel, PowerPoint, Project, Word + */ export enum EventType { /** - * Occurs when the user changes the current view of the document. + * A Document.ActiveViewChanged event was raised. */ ActiveViewChanged, /** - * Triggers when a binding level data change happens + * Occurs when data within the binding is changed. + * + * @remarks + * Hosts: Access, Excel, Word + * + * To add an event handler for the BindingDataChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingDataChangedEventArgs. */ BindingDataChanged, /** - * Triggers when a binding level selection happens + * Occurs when the selection is changed within the binding. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: BindingEvents + * + * To add an event handler for the BindingSelectionChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingSelectionChangedEventArgs. */ BindingSelectionChanged, /** @@ -369,7 +569,7 @@ declare namespace Office { */ DocumentSelectionChanged, /** - * Triggers when the active item changes + * A Document.SelectionChanged event was raised. */ ItemChanged, /** @@ -385,7 +585,7 @@ declare namespace Office { */ NodeReplaced, /** - * Triggers when settings change in a co-Auth session. + * A Settings.settingsChanged event was raised. */ SettingsChanged, /** @@ -393,7 +593,7 @@ declare namespace Office { */ TaskSelectionChanged, /** - * Triggers when a Resource selection happens in Project. + * Triggers when a Resource selection happens in Project. */ ResourceSelectionChanged, /** @@ -401,30 +601,48 @@ declare namespace Office { */ ViewSelectionChanged } + /** + * Specifies the format in which to return the document. + * + * @remarks + * Hosts: PowerPoint, Word + */ export enum FileType { /** - * Returns the file as plain text + * Returns only the text of the document as a string. (Word only) */ Text, /** - * Returns the file as a byte array + * Returns the entire document (.pptx, .docx, or .xslx) in Office Open XML (OOXML) format as a byte array. */ Compressed, /** - * Returns the file in PDF format as a byte array + * Returns the entire document in PDF format as a byte array. */ Pdf } + /** + * Specifies whether filtering from the host application is applied when the data is retrieved. + * + * @remarks + * Hosts: Excel, Project, Word + */ export enum FilterType { /** - * Returns all items + * Return all data (not filtered by the host application). */ All, /** - * Returns only visible items + * Return only the visible data (as filtered by the host application). */ OnlyVisible } + /** + * Specifies the type of place or object to navigate to. + * + * @remarks + * Hosts: Excel, PowerPoint, Word + */ export enum GoToType { /** * Goes to a binding object using the specified binding id. @@ -440,7 +658,7 @@ declare namespace Office { */ Slide, /** - * Goes to the specified index by slide number or enum Office.Index + * Goes to the specified index by slide number or Office.Index */ Index } @@ -450,364 +668,925 @@ declare namespace Office { Next, Previous } + /** + * Specifies whether to select (highlight) the location to navigate to (when using the Document.goToByIdAsync method). + * + * @remarks + * Hosts: Excel, PowerPoint, Word + */ export enum SelectionMode { Default, + /** + * The location will be selected (highlighted). + */ Selected, + /** + * The cursor is moved the beginning of the location. + */ None } + /** + * Specifies whether values, such as numbers and dates, returned by the invoked method are returned with their formatting applied. + * + * @remarks + * For example, if the valueFormat parameter is specified as "formatted", a number formatted as currency, or a date formatted as mm/dd/yy in the host application will have its formatting preserved. If the valueFormat parameter is specified as "unformatted", a date will be returned in its underlying sequential serial number form. + * + * Hosts: Excel, Project, Word + */ export enum ValueFormat { /** - * Returns items without format + * Return unformatted data. */ Unformatted, /** - * Returns items with format + * Return formatted data. */ Formatted } // Objects + /** + * Represents a binding to a section of the document. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement sets: MatrixBinding, TableBinding, TextBinding + * + * The Binding object exposes the functionality possessed by all bindings regardless of type. + * + * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: MatrixBinding, TableBinding, or TextBinding. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns. + */ export interface Binding { + /** + * Get the Document object associated with the binding. + * + * @remarks + * Hosts: Access, Excel, Word + */ document: Document; /** - * Id of the Binding + * A string that uniquely identifies this binding among the bindings in the same Document object. + * + * @remarks + * Hosts: Access, Excel, Word */ id: string; + /** + * Gets the type of the binding. + * + * @remarks + * Hosts: Access, Excel, Word + */ type: BindingType; /** - * Adds an event handler to the object using the specified event type. - * @param eventType The event type. For binding it can be 'bindingDataChanged' and 'bindingSelectionChanged' - * @param handler The name of the handler + * Adds an event handler to the object for the specified event type. + * + * @remarks + * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. + * + * @param eventType The event type. For example, for bindings, it can be **Office.EventType.BindingSelectionChanged**, **Office.EventType.BindingDataChanged**, or the corresponding text values of these enumerations. + * @param handler The event handler function to add. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Returns the current selection. - * @param options Syntax example: {coercionType: 'matrix,'valueFormat: 'formatted', filterType:'all'} - * coercionType: The expected shape of the selection. If not specified returns the bindingType shape. Use Office.CoercionType or text value. - * valueFormat: Get data with or without format. Use Office.ValueFormat or text value. - * startRow: Used in partial get for table/matrix. Indicates the start row. - * startColumn: Used in partial get for table/matrix. Indicates the start column. - * rowCount: Used in partial get for table/matrix. Indicates the number of rows from the start row. - * columnCount: Used in partial get for table/matrix. Indicates the number of columns from the start column. - * filterType: Get the visible or all the data. Useful when filtering data. Use Office.FilterType or text value. - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Returns the data contained within the binding. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings + * + * When called from a MatrixBinding or TableBinding, the getDataAsync method will return a subset of the bound values if the optional startRow, startColumn, rowCount, and columnCount parameters are specified (and they specify a contiguous and valid range). + * + * @param options An object with any of the following (example: {coercionType: 'matrix, 'valueFormat: 'formatted', filterType:'all'}): + * + * coercionType: The expected shape of the selection. Use Office.CoercionType or text value. Default: The original, uncoerced type of the binding. + * + * valueFormat: Specifies whether values, such as numbers and dates, are returned with their formatting applied. Use Office.ValueFormat or text value. Default: Unformatted data. + * + * startRow: For table or matrix bindings, specifies the zero-based starting row for a subset of the data in the binding. Default is first row. + * + * startColumn: For table or matrix bindings, specifies the zero-based starting column for a subset of the data in the binding. Default is first column. + * + * rowCount: For table or matrix bindings, specifies the number of rows offset from the startRow. Default is all subsequent rows. + * + * columnCount: For table or matrix bindings, specifies the number of columns offset from the startColumn. Default is all subsequent columns. + * + * filterType: Specify whether to get only the visible (filtered in) data or all the data (default is all). Useful when filtering data. Use Office.FilterType or text value. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * rows: Only for table bindings in content add-ins for Access. Specifies the pre-defined string "thisRow" to get data in the currently selected row. + + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getDataAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Removes an event handler from the object using the specified event type. + * Removes the specified handler from the binding for the specified event type. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: BindingEvents + * * @param eventType The event type. For binding can be 'bindingDataChanged' and 'bindingSelectionChanged' - * @param options Syntax example: {handler:eventHandler} - * handler: Indicates a specific handler to be removed, if not specified all handlers are removed - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * @param options An object with any of the following: + * + * handler: The handler to be removed, if not specified all handlers are removed. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Writes the specified data into the current selection. - * @param data The data to be set. Either a string or value, 2d array or TableData object - * @param options Syntax example: {coercionType:Office.CoercionType.Matrix} or {coercionType: 'matrix'} + * Writes data to the bound section of the document represented by the specified binding object. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings + * + * @param data The data to be set in the current selection. Possible data types by host: + * + * string: Excel, Excel Online, Word, and Word Online only + * + * array of arrays: Excel and Word only + * + * [TableData](office.tabledata.md): Access, Excel, and Word only + * + * HTML: Word and Word Online only + * + * Office Open XML: Word only + * + * @param options Any of the following: + * + * cellFormat: For an inserted table, a list of key-value pairs that specify a range of columns, rows, or cells and the cell formatting to apply to that range. + * * coercionType: Explicitly sets the shape of the data object. Use Office.CoercionType or text value. If not supplied is inferred from the data type. - * startRow: Used in partial set for table/matrix. Indicates the start row. - * startColumn: Used in partial set for table/matrix. Indicates the start column. - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + * columns: Only for table bindings in content add-ins for Access. Array of strings. Specifies the column names. + * + * rows: Only for table bindings in content add-ins for Access. **Office.TableRange.ThisRow** Specifies the pre-defined string "thisRow" to set data in the currently selected row. + * + * startRow: Specifies the zero-based starting row for a subset of the data in the binding. Only for table or matrix bindings. If omitted, data is set starting in the first row. + * + * startColumn: Specifies the zero-based starting column for a subset of the data. Only for table or matrix bindings. If omitted, data is set starting in the first column. + * + * tableOptions: For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ setDataAsync(data: TableData | any, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents the bindings the add-in has within the document. + * + * @remarks + * Hosts: + */ export interface Bindings { + /** + * Gets a Document object that represents the document associated with this set of bindings. + * + *remarks + * Hosts: Access, Excel, Word + */ document: Document; /** - * Creates a binding against a named object in the document + * Creates a binding against a named object in the document. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * + * For Excel, the itemName parameter can refer to a named range or a table. + * + * By default, adding a table in Excel assigns the name "Table1" for the first table you add, "Table2" for the second table you add, and so on. To assign a meaningful name for a table in the Excel UI, use the Table Name property on the Table Tools | Design tab of the ribbon. + * + * Note: In Excel, when specifying a table as a named item, you must fully qualify the name to include the worksheet name in the name of the table in this format: "Sheet1!Table1" + * + * For Word, the itemName parameter refers to the Title property of a Rich Text content control. (You can't bind to content controls other than the Rich Text content control.) + * + * By default, a content control has no Title value assigned. To assign a meaningful name in the Word UI, after inserting a Rich Text content control from the Controls group on the Developer tab of the ribbon, use the Properties command in the Controls group to display the Content Control Properties dialog box. Then set the Title property of the content control to the name you want to reference from your code. + * + * Note: In Word, if there are multiple Rich Text content controls with the same Title property value (name), and you try to bind to one these content controls with this method (by specifying its name as the itemName parameter), the operation will fail. + * * @param itemName Name of the bindable object in the document. For Example 'MyExpenses' table in Excel." - * @param bindingType The Office BindingType for the data - * @param options Syntax example: {id: "BindingID"} - * id: Name of the binding, autogenerated if not supplied. - * asyncContext: Object keeping state for the callback - * columns: The string[] of the columns involved in the binding - * @param callback The optional callback method + * @param bindingType The Office BindingType for the data. The method returns null if the selected object cannot be coerced into the specified type. + * @param options An object like {id: "BindingID"} that has any of the following properties: + * + * id: Unique name of the binding. Autogenerated if not supplied. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * columns: The string[] of the columns involved in the binding. + * + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addFromNamedItemAsync(itemName: string, bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Create a binding by prompting the user to make a selection on the document. - * @param bindingType The Office BindingType for the data - * @param options addFromPromptAsyncOptions- e.g. {promptText: "Please select data", id: "mySales"} - * promptText: Greet your users with a friendly word. - * asyncContext: Object keeping state for the callback - * id: Identifier. - * sampleData: A TableData that gives sample table in the Dialog.TableData.Headers is [][] of string. - * @param callback The optional callback method + * + * @remarks + * Hosts: Access, Excel + * + * Available in Requirement set: Not in a set + * + * Adds a binding object of the specified type to the Bindings collection, which will be identified with the supplied id. The method fails if the specified selection cannot be bound. + * + * @param bindingType Specifies the type of the binding object to create. Required. Returns null if the selected object cannot be coerced into the specified type. + * @param options An object like {promptText: "Please select data", id: "mySales"} with any of the following properties: + * + * promptText: Specifies the string to display in the prompt UI that tells the user what to select. Limited to 200 characters. If no promptText argument is passed, "Please make a selection" is displayed. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * id: Specifies the unique name to be used to identify the new binding object.If no argument is passed for the id parameter, the Binding.id is autogenerated. + * + * sampleData: Specifies a table of sample data displayed in the prompt UI as an example of the kinds of fields (columns) that can be bound by your add-in. The headers provided in the TableData object specify the labels used in the field selection UI. Optional. Note: This parameter is used only in add-ins for Access. It is ignored if provided when calling the method in an add-in for Excel. + * + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addFromPromptAsync(bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Create a binding based on what the user's current selection. - * @param bindingType The Office BindingType for the data - * @param options addFromSelectionAsyncOptions- e.g. {id: "BindingID"} - * id: Identifier. - * asyncContext: Object keeping state for the callback + * Create a binding based on the user's current selection. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * + * Adds the specified type of binding object to the Bindings collection, which will be identified with the supplied id. + * + * Note In Excel, if you call the addFromSelectionAsync method passing in the Binding.id of an existing binding, the Binding.type of that binding is used, and its type cannot be changed by specifying a different value for the bindingType parameter.If you need to use an existing id and change the bindingType, call the Bindings.releaseByIdAsync method first to release the binding, and then call the addFromSelectionAsync method to reestablish the binding with a new type. + * + * @param bindingType Specifies the type of the binding object to create. Required. Returns null if the selected object cannot be coerced into the specified type. + * @param options An object like {id: "BindingID"} with any of the following properties: + * + * id: Specifies the unique name to be used to identify the new binding object.If no argument is passed for the id parameter, the Binding.id is autogenerated. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * * columns: The string[] of the columns involved in the binding + * * sampleData: A TableData that gives sample table in the Dialog.TableData.Headers is [][] of string. - * @param callback The optional callback method + * + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addFromSelectionAsync(bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets an array with all the binding objects in the document. + * Gets all bindings that were previously created. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getAllAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Retrieves a binding based on its Name - * @param id The binding id + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: CustomXmlParts, MatrixBindings, TableBindings, TextBindings + * + * Fails if the specified id does not exist. + * + * @param id Specifies the unique name of the binding object. Required. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Removes the binding from the document - * @param id The binding id + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * + * Fails if the specified id does not exist. + * + * @param id Specifies the unique name to be used to identify the binding object. Required. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ releaseByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents the runtime environment of the add-in and provides access to key objects of the API. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export interface Context { + /** + * Gets an object that represents the document the content or task pane add-in is interacting with. + */ document: Document; } + /** + * Represents an XML node in a tree in a document. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ export interface CustomXmlNode { + /** + * Gets the base name of the node without the namespace prefix, if one exists. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ baseName: string; + /** + * Retrieves the string GUID of the CustomXMLPart. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ namespaceUri: string; + /** + * Gets the type of the CustomXMLNode. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ nodeType: string; /** - * Gets the nodes associated with the xPath expression. - * @param xPath The xPath expression + * Gets the nodes associated with the XPath expression. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * @param xPath The XPath expression that specifies the nodes to get. Required. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getNodesAsync(xPath: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Gets the node value. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getNodeValueAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Asynchronously gets the text of an XML node in a custom XML part. + * Gets the text of an XML node in a custom XML part. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getTextAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Gets the node's XML. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getXmlAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Sets the node value. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param value The value to be set on the node * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ setNodeValueAsync(value: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously sets the text of an XML node in a custom XML part. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param text Required. The text value of the XML node. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ setTextAsync(text: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Sets the node XML. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param xml The XML to be set on the node * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ setXmlAsync(xml: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents a single CustomXMLPart in a CustomXMLParts collection. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ export interface CustomXmlPart { + /** + * True, if the custom XML part is built in; otherwise false. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ builtIn: boolean; + /** + * Gets the GUID of the CustomXMLPart. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ id: string; + /** + * Gets the set of namespace prefix mappings (CustomXMLPrefixMappings) used against the current CustomXMLPart. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ namespaceManager: CustomXmlPrefixMappings; /** * Adds an event handler to the object using the specified event type. - * @param eventType The event type. For CustomXmlPartNode it can be 'nodeDeleted', 'nodeInserted' or 'nodeReplaced' - * @param handler The name of the handler + * + * @remarks + * Hosts: Word + * + * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. + * + * @param eventType Specifies the type of event to add. Required. For a CustomXmlPart object event, the eventType parameter can be specified as Office.EventType.DataNodeDeleted, Office.EventType.DataNodeInserted, Office.EventType.DataNodeReplaced, or the corresponding text values of these enumerations. + * @param handler The event handler function to add, whose only parameter is of type NodeDeletedEventArgs, NodeInsertedEventArgs, or NodeReplaceEventArgs. Required. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ - addHandlerAsync(eventType: EventType, handler?: (result: any) => void, options?: any, callback?: (result: AsyncResult) => void): void; + addHandlerAsync(eventType: EventType, handler: (result: any) => void, options?: any, callback?: (result: AsyncResult) => void): void; /** * Deletes the Custom XML Part. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ deleteAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets the nodes associated with the xPath expression. - * @param xPath The xPath expression + * Asynchronously gets any CustomXmlNodes in this custom XML part which match the specified XPath. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * @param xPath An XPath expression that specifies the nodes you want returned. Required. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getNodesAsync(xPath: string, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets the XML for the Custom XML Part. + * Asynchronously gets the XML inside this custom XML part. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getXmlAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Removes an event handler from the object using the specified event type. - * @param eventType The event type. For CustomXmlPartNode it can be 'nodeDeleted', 'nodeInserted' or 'nodeReplaced' - * @param options Syntax example: {handler:eventHandler} - * handler: Indicates a specific handler to be removed, if not specified all handlers are removed - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Removes an event handler for the specified event type. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * @param eventType Specifies the type of event to remove. Required.For a CustomXmlPart object event, the eventType parameter can be specified as Office.EventType.DataNodeDeleted, Office.EventType.DataNodeInserted, Office.EventType.DataNodeReplaced, or the corresponding text values of these enumerations. + * @param handler The event handler function to remove. If not specified, all event handlers for the specified eventType will be removed. + * @param options Syntax example: {asyncContext:context} + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ - removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType: EventType, handler?: (result: any) => void, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents a collection of CustomXmlPart objects. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ export interface CustomXmlParts { /** * Asynchronously adds a new custom XML part to a file. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param xml The XML to add to the newly created custom XML part. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addAsync(xml: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets the specified custom XML part by its id. - * @param id The id of the custom XML part. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * @param id The GUID of the custom XML part, including opening and closing braces. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets the specified custom XML part(s) by its namespace. - * @param ns The namespace to search. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * @param ns The namespace URI. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. - */ + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getByNamespaceAsync(ns: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents a collection of CustomXmlPart objects. + * + * @remarks + * Hosts: Word + */ export interface CustomXmlPrefixMappings { /** - * Adds a namespace. - * @param prefix The namespace prefix - * @param ns The namespace URI + * Asynchronously adds a prefix to namespace mapping to use when querying an item. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * If no namespace is assigned to the requested prefix, the method returns an empty string (""). + * + * @param prefix Specifies the prefix to add to the prefix mapping list. Required. + * @param ns Specifies the namespace URI to assign to the newly added prefix. Required. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addNamespaceAsync(prefix: string, ns: string, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets a namespace with the specified prefix - * @param prefix The namespace prefix + * Asynchronously gets the namespace mapped to the specified prefix. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * If the prefix already exists in the namespace manager, this method will overwrite the mapping of that prefix except when the prefix is one added or used by the data store internally, in which case it will return an error. + * + * @param prefix TSpecifies the prefix to get the namespace for. Required. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getNamespaceAsync(prefix: string, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets a prefix for the specified URI - * @param ns The namespace URI + * Asynchronously gets the prefix for the specified namespace. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * If no prefix is assigned to the requested namespace, the method returns an empty string (""). If there are multiple prefixes specified in the namespace manager, the method returns the first prefix that matches the supplied namespace. + * + * @param ns Specifies the namespace to get the prefix for. Required. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getPrefixAsync(ns: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * An abstract class that represents the document the add-in is interacting with. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + */ export interface Document { + /** + * Gets an object that provides access to the bindings defined in the document. + * + * @remarks + * Hosts: Access, Excel, Word + * + * You don't instantiate the Document object directly in your script. To call members of the Document object to interact with the current document or worksheet, use Office.context.document in your script. + */ bindings: Bindings; + /** + * Gets an object that represents the custom XML parts in the document. + * + * @remarks + * Hosts: Word + */ customXmlParts: CustomXmlParts; + /** + * Gets the mode the document is in. + * + * @remarks + * Hosts: Word + */ mode: DocumentMode; + /** + * Gets an object that represents the saved custom settings of the content or task pane add-in for the current document. + * + * @remarks + * Hosts: Word + */ settings: Settings; + /** + * Gets the URL of the document that the host application currently has open. Returns null if the URL is unavailable. + * + * @remarks + * Hosts: Word + */ url: string; /** - * Adds an event handler for the specified event type. - * @param eventType The event type. For document can be 'DocumentSelectionChanged' - * @param handler The name of the handler - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Adds an event handler for a Document object event. + * + * @remarks + * Hosts: Excel, PowerPoint, Project, Word + * + * Available in Requirement set: DocumentEvents + * + * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. + * + * @param eventType For a Document object event, the eventType parameter can be specified as Office.EventType.Document.SelectionChanged or Office.EventType.Document.ActiveViewChanged, or the corresponding text value of this enumeration. + * @param handler The event handler function to add, whose only parameter is of type DocumentSelectionChangedEventArgs. Required. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Returns the current view of the presentation. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * Returns the state of the current view of the presentation (edit or read). + * + * @remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: ActiveView + * + * Can trigger an event when the view changes. + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getActiveViewAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets the entire file in slices of up to 4MB. + * Returns the entire document file in slices of up to 4194304 bytes (4 MB). For add-ins for iOS, file slice is supported up to 65536 (64 KB). Note that specifying file slice size of above permitted limit will result in an "Internal Error" failure. + * + * @remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: File + * + * For add-ins running in Office host applications other than Office for iOS, the getFileAsync method supports getting files in slices of up to 4194304 bytes (4 MB). For add-ins running in Office for iOS apps, the getFileAsync method supports getting files in slices of up to 65536 (64 KB). + * + * The fileType parameter can be specified by using the FileType enumeration or text values. But the possible values vary with the host: + * + * Excel Online, Win32, Mac, and iOS: Office.FileType.Compressed + * + * PowerPoint on Windows desktop, Mac, and iPad, and PowerPoint Online: Office.FileType.Compressed, Office.FileType.Pdf + * + * Word on Windows desktop, Word on Mac, and Word Online: Office.FileType.Compressed, Office.FileType.Pdf, Office.FileType.Text + * + * Word on iPad: Office.FileType.Compressed, Office.FileType.Text + * * @param fileType The format in which the file will be returned - * @param options Syntax example: {sliceSize:1024} + * @param options An object like {sliceSize:1024} that has any of the following properties: + * * sliceSize: Specifies the desired slice size (in bytes) up to 4MB. If not specified a default slice size of 4MB will be used. - * @param callback The optional callback method + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getFileAsync(fileType: FileType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Gets file properties of the current document. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * + * @remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: not in a set + * + * You get the file's URL with the url property ( asyncResult.value.url). + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getFilePropertiesAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Returns the current selection. - * @param coercionType The expected shape of the selection. - * @param options Syntax example: {valueFormat: 'formatted', filterType:'all'} + * Reads the data contained in the current selection in the document. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: Selection + * + * The possible values for the coercionType parameter vary by the host: + * + * Excel, Excel Online, PowerPoint, PowerPoint Online, Word, and Word Online only: Office.CoercionType.Text (string) + * + * Excel, Word, and Word Online only: Office.CoercionType.Matrix (array of arrays) + * + * Access, Excel, Word, and Word Online only: Office.CoercionType.Table (TableData object) + * + * Word only: Office.CoercionType.Html + * + * Word and Word Online only: Office.CoercionType.Ooxml (Office Open XML) + * + * PowerPoint and PowerPoint Online only: Office.CoercionType.SlideRange + * + * @param coercionType The type of data structure to return. + * @param options An object like {valueFormat: 'formatted', filterType:'all'} that has any of the following properties: + * * valueFormat: Get data with or without format. Use Office.ValueFormat or text value. - * filterType: Get the visible or all the data. Useful when filtering data. Use Office.FilterType or text value. - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + * filterType: Get the visible or all the data. Useful when filtering data. Use Office.FilterType or text value. This parameter is ignored in Word documents. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getSelectedDataAsync(coercionType: CoercionType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Goes to the specified object or location in the document. + * + * @remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: not in a set + * + * PowerPoint doesn't support the goToByIdAsync method in Master Views. + * + * The behavior caused by the selectionMode option varies by host: + * + * In Excel: Office.SelectionMode.Selected selects all content in the binding, or named item. Office.SelectionMode.None for text bindings, selects the cell; for matrix bindings, table bindings, and named items, selects the first data cell (not first cell in header row for tables). + * + * In PowerPoint: Office.SelectionMode.Selected selects the slide title or first textbox on the slide. Office.SelectionMode.None Doesn't select anything. + * + * In Word: Office.SelectionMode.Selected selects all content in the binding. Office.SelectionMode.None for text bindings, moves the cursor to the beginning of the text; for matrix bindings and table bindings, selects the first data cell (not first cell in header row for tables). + * * @param id The identifier of the object or location to go to. * @param goToType The type of the location to go to. - * @param options Syntax example: {asyncContext:context} - * selectionMode: Use Office.SelectionMode or text value. - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * @param options An object like {asyncContext:context} with any of the following values: + * + * selectionMode: Specifies whether the location specified by the id parameter is selected (highlighted). Use Office.SelectionMode or text value. See Remarks for more. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ goToByIdAsync(id: string | number, goToType: GoToType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Removes an event handler for the specified event type. - * @param eventType The event type. For document can be 'DocumentSelectionChanged' - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * handler: The name of the handler. If not specified all handlers are removed - * @param callback The optional callback method + * + * @remarks + * Hosts: Excel, PowerPoint, Project, Word + * + * Available in Requirement set: DocumentEvents + * + * @param eventType The event type. For document can be 'Document.SelectionChanged' or 'Document.ActiveViewChanged'. + * @param options An object like Syntax example: {asyncContext:context} that has any of the following properties: + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * handler: The name of the handler. If not specified all handlers are removed. + * + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Writes the specified data into the current selection. - * @param data The data to be set. Either a string or value, 2d array or TableData object - * @param options Syntax example: {coercionType:Office.CoercionType.Matrix} or {coercionType: 'matrix'} + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word, Word Online + * + * Available in Requirement set: Selection + * + * The possible CoercionTypes that can be used for the data parameter, or for the coercionType option, vary by host: + * + * Office.CoercionType.Text: Excel, Word, PowerPoint + * + * Office.CoercionType.Matrix: Excel, Word + * + * Office.CoercionType.Table: Access, Excel, Word + * + * Office.CoercionType.Html: Word + * + * Office.CoercionType.Ooxml: Word + * + * Office.CoercionType.Image: Excel, Word, PowerPoint + * + * @param data The data to be set. Either a string or CoercionType value, 2d array or TableData object. + * @param options An object like {coercionType:Office.CoercionType.Matrix} with any of the following properties: + * * coercionType: Explicitly sets the shape of the data object. Use Office.CoercionType or text value. If not supplied is inferred from the data type. - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + * tableOptions: For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows + * + * cellFormat: For an inserted table, a list of key-value pairs that specify a range of columns, rows, or cells and the cell formatting to apply to that range + * + * imageLeft: (number) This option is applicable for inserting images. Indicates the insert location in relation to the left side of the slide for PowerPoint, and its relation to the currently selected cell in Excel. This value is ignored for Word. This value is in points. + * + * imageTop: (number) This option is applicable for inserting images. Indicates the insert location in relation to the top of the slide for PowerPoint, and its relation to the currently selected cell in Excel. This value is ignored for Word. This value is in points. + * + * imageWidth: (number) This option is applicable for inserting images. Indicates the image width. If this option is provided without the imageHeight, the image will scale to match the value of the image width. If both image width and image height are provided, the image will be resized accordingly. If neither the image height or width is provided, the default image size and aspect ratio will be used. This value is in points. + * + * imageHeight: (number) This option is applicable for inserting images. Indicates the image height. If this option is provided without the imageWidth, the image will scale to match the value of the image height. If both image width and image height are provided, the image will be resized accordingly. If neither the image height or width is provided, the default image size and aspect ratio will be used. This value is in points. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ setSelectedDataAsync(data: string | TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; } @@ -824,18 +1603,67 @@ declare namespace Office { */ type: EventType; } + /** + * Represents the document file associated with an Office Add-in. + * + * @remarks + * Access the File object with the AsyncResult.value property in the callback function passed to the Document.getFileAsync method. + * + * Hosts: PowerPoint, Word + */ export interface File { + /** + * Gets the document file size in bytes. + * + * @remarks + * Hosts: PowerPoint, Word + * + * Available in Requirement set: File + */ size: number; + /** + * Gets the number of slices into which the file is divided. + * @remarks + * Hosts: PowerPoint, Word + */ sliceCount: number; /** - * Closes the File. - * @param callback The optional callback method + * Closes the document file. + * @remarks + * No more than two documents are allowed to be in memory; otherwise the Document.getFileAsync operation will fail. Use the File.closeAsync method to close the file when you are finished working with it. + * + * Hosts: PowerPoint, Word + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the closeAsync method, you can use the properties of the AsyncResult object to return the following information. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Always returns undefined because there is no object or data to retrieve.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|A user-defined item of any type that is returned in the AsyncResult object without being altered.| + * + * Available in Requirement set: File */ closeAsync(callback?: (result: AsyncResult) => void): void; /** - * Gets the specified slice. - * @param sliceIndex The index of the slice to be retrieved - * @param callback The optional callback method + * Returns the specified slice. + * @remarks + * Hosts: PowerPoint, Word + * @param sliceIndex Specifies the zero-based index of the slice to be retrieved. Required. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the getSliceAsync method, you can use the properties of the AsyncResult object to return the following information. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Access the Slice object.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|A user-defined item of any type that is returned in the AsyncResult object without being altered.| + * + * Available in Requirement set: File */ getSliceAsync(sliceIndex: number, callback?: (result: AsyncResult) => void): void; } @@ -845,96 +1673,364 @@ declare namespace Office { */ url: string } + /** + * Represents a binding in two dimensions of rows and columns. + * + * @remarks + * Hosts: Excel, Word + * + * Available in Requirement set: MatrixBindings + * + * The MatrixBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. + */ export interface MatrixBinding extends Binding { + /** + * Gets the number of columns in the matrix data structure, as an integer value. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: MatrixBindings + */ columnCount: number; + /** + * Gets the number of rows in the matrix data structure, as an integer value. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: MatrixBindings + */ rowCount: number; } + /** + * Represents custom settings for a task pane or content add-in that are stored in the host document as name/value pairs. + * + * @remarks + * The settings created by using the methods of the Settings object are saved per add-in and per document. That is, they are available only to the add-in that created them, and only from the document in which they are saved. + * + * The name of a setting is a string, while the value can be a string, number, boolean, null, object, or array. + * + * The Settings object is automatically loaded as part of the Document object, and is available by calling the settings property of that object when the add-in is activated. The developer is responsible for calling the saveAsync method after adding or deleting settings to save the settings in the document. + * + * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + */ export interface Settings { /** - * Adds an event handler for the object using the specified event type. - * @param eventType The event type. For settings can be 'settingsChanged' - * @param handler The name of the handler - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Adds an event handler for the settingsChanged event. + * + * @remarks + * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. + * + * > [!IMPORTANT] + * > Your add-in's code can register a handler for the settingsChanged event when the add-in is running with any Excel client, but the event will fire only when the add-in is loaded with a spreadsheet that is opened in Excel Online, and more than one user is editing the spreadsheet (co-authoring). Therefore, effectively the settingsChanged event is supported only in Excel Online in co-authoring scenarios. + * + * Hosts: Excel + * + * Available in Requirement set: Settings + * + * @param eventType Specifies the type of event to add. Required. + * @param handler The event handler function to add. Required. + * @param options Specifies any of the following optional parameters. + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the addHandlerAsync method, you can use the properties of the AsyncResult object to return the following information. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Always returns undefined because there is no data or object to retrieve when adding an event handler.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|A user-defined item of any type that is returned in the AsyncResult object without being altered.| */ addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Retrieves the setting with the specified name. - * @param settingName The name of the setting + * Retrieves the specified setting. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * + * @param settingName The case-sensitive name of the setting to retrieve. + * @returns An object that has property names mapped to JSON serialized values. */ get(name: string): any; /** - * Gets the latest version of the settings object. - * @param callback The optional callback method + * Reads all settings persisted in the document and refreshes the content or task pane add-in's copy of those settings held in memory. + * + * @remarks + * This method is useful in Word and PowerPoint coauthoring scenarios when multiple instances of the same add-in are working against the same document. Because each add-in is working against an in-memory copy of the settings loaded from the document at the time the user opened it, the settings values used by each user can get out of sync. This can happen whenever an instance of the add-in calls the Settings.saveAsync method to persist all of that user's settings to the document. Calling the refreshAsync method from the event handler for the settingsChanged event of the add-in will refresh the settings values for all users. + * The refreshAsync method can be called from add-ins created for Excel, but since it doesn't support coauthoring there is no reason to do so. + * + * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the refreshAsync method, you can use the properties of the AsyncResult object to return the following information. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Access a Settings object with the refreshed values.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|A user-defined item of any type that is returned in the AsyncResult object without being altered.| */ refreshAsync(callback?: (result: AsyncResult) => void): void; /** - * Removes the setting with the specified name. - * @param settingName The name of the setting + * Removes the specified setting. + * + * @remarks + * null is a valid value for a setting. Therefore, assigning null to the setting will not remove it from the settings property bag. + * + * > [!IMPORTANT] + * > Be aware that the Settings.remove method affects only the in-memory copy of the settings property bag. To persist the removal of the specified setting in the document, at some point after calling the Settings.remove method and before the add-in is closed, you must call the Settings.saveAsync method. + * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * + * @param settingName The case-sensitive name of the setting to remove. */ remove(name: string): void; /** - * Removes an event handler for the specified event type. - * @param eventType The event type. For settings can be 'settingsChanged' - * @param options Syntax example: {handler:eventHandler} - * handler: Indicates a specific handler to be removed, if not specified all handlers are removed - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Removes an event handler for the settingsChanged event. + * + * @remarks + * If the optional handler parameter is omitted when calling the removeHandlerAsync method, all event handlers for the specified eventType will be removed. + * + * Hosts: Access, Excel, PowerPoint + * + * Available in Requirement set: Settings + * + * @param eventType Specifies the type of event to remove. Required. + * @param options Specifies any of the following optional parameters. + * @param handler Specifies the name of the handler to remove. + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the removeHandlerAsync method, you can use the properties of the AsyncResult object to return the following information. */ removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Saves all settings. + * Persists the in-memory copy of the settings property bag in the document. + * @remarks + * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use the set and get methods to work with the in-memory copy of the settings property bag. When you want to persist the settings so that they are available the next time the add-in is used, use the saveAsync method. + * + * > [!NOTE] + * > The saveAsync method persists the in-memory settings property bag into the document file; however, the changes to the document file itself are saved only when the user (or AutoRecover setting) saves the document to the file system. + * > The refreshAsync method is only useful in coauthoring scenarios (which are only supported in Word) when other instances of the same add-in might change the settings and those changes should be made available to all instances. + * + * Hosts: Access, Excel, PowerPoint, Word * @param options Syntax example: {overwriteIfStale:false} - * overwriteIfStale: Indicates whether the setting will be replaced if stale. - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * @param overwriteIfStale Indicates whether the setting will be replaced if stale. + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the saveAsync method, you can use the properties of the AsyncResult object to return the following information. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Always returns undefined because there is no object or data to retrieve.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|A user-defined item of any type that is returned in the AsyncResult object without being altered.| */ saveAsync(callback?: (result: AsyncResult) => void): void; /** - * Sets a value for the setting with the specified name. - * @param settingName The name of the setting - * @param value The value for the setting + * Sets or creates the specified setting. + * + * @remarks + * The set method creates a new setting of the specified name if it does not already exist, or sets an existing setting of the specified name in the in-memory copy of the settings property bag. After you call the Settings.saveAsync method, the value is stored in the document as the serialized JSON representation of its data type. A maximum of 2MB is available for the settings of each add-in. + * + * > [!IMPORTANT] + * > Be aware that the Settings.set method affects only the in-memory copy of the settings property bag. To make sure that additions or changes to settings will be available to your add-in the next time the document is opened, at some point after calling the Settings.set method and before the add-in is closed, you must call the Settings.saveAsync method to persist settings in the document. + * + * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * + * @param settingName The case-sensitive name of the setting to set or create. + * @param value Specifies the value to be stored. */ set(name: string, value: any): void; } + /** + * Represents a slice of a document file. + * + * @remarks + * The Slice object is accessed with the File.getSliceAsync method. + * + * Hosts: PowerPoint, Word + * + * Available in Requirement set: File + */ export interface Slice { + /** + * Gets the raw data of the file slice in Office.FileType.Text ("text") or Office.FileType.Compressed ("compressed") format as specified by the fileType parameter of the call to the Document.getFileAsync method. + * + * @remarks + * Files in the "compressed" format will return a byte array that can be transformed to a base64-encoded string if required. + * + * Hosts: PowerPoint, Word + * + * Available in Requirement set: File + */ data: any; + /** + * Gets the zero-based index of the file slice. + * + * @remarks + * Hosts: PowerPoint, Word + * + * Available in Requirement set: File + */ index: number; + /** + * Gets the size of the slice in bytes. + * + * @remarks + * Hosts: PowerPoint, Word + * + * Available in Requirement set: File + */ size: number; } + /** + * Represents a binding in two dimensions of rows and columns, optionally with headers. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: TableBindings + * + * The TableBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. + * + * For Excel, note that after you establish a table binding in Excel, each new row a user adds to the table is automatically included in the binding and rowCount increases. + */ export interface TableBinding extends Binding { + /** + * Gets the number of columns in the TableBinding, as an integer value. + * + * @remarks + * Hosts: Access, Excel,Word + * + * Available in Requirement set: TableBindings + */ columnCount: number; + /** + * True, if the table has headers; otherwise false. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: TableBindings + */ hasHeaders: boolean; + /** + * Gets the number of rows in the TableBinding, as an integer value. + * + * @remarks + * Hosts: Access, Excel,Word + * + * Available in Requirement set: TableBindings + * + * When you insert an empty table by selecting a single row in Excel 2013 and Excel Online (using Table on the Insert tab), both Office host applications create a single row of headers followed by a single blank row. However, if your add-in's script creates a binding for this newly inserted table (for example, by using the addFromSelectionAsync method), and then checks the value of the rowCount property, the value returned will differ depending whether the spreadsheet is open in Excel 2013 or Excel Online. + + * - In Excel on the desktop, rowCount will return 0 (the blank row following the headers is not counted). + * + * - In Excel Online, rowCount will return 1 (the blank row following the headers is counted). + * + * You can work around this difference in your script by checking if rowCount == 1, and if so, then checking if the row contains all empty strings. + * + * In content add-ins for Access, for performance reasons the rowCount property always returns -1. + */ rowCount: number; /** - * Adds the specified columns to the table - * @param tableData A TableData object with the headers and rows + * Adds the specified data to the table as additional columns. + * + * @remarks + * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings + * + * To add one or more columns specifying the values of the data and headers, pass a TableData object as the data parameter. To add one or more columns specifying only the data, pass an array of arrays ("matrix") as the data parameter. + * + * The success or failure of an addColumnsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be completely rolled back (and the AsyncResult.status property returned to the callback will report failure): + * + * - Each row in the array you pass as the data argument must have the same number of rows as the table being updated. If not, the entire operation will fail. + * + * - Each row and cell in the array must successfully add that row or cell to the table in the newly added column(s). If any row or cell fails to be set for any reason, the entire operation will fail. + * + * - If you pass a TableData object as the data argument, the number of header rows must match that of the table being updated. + * + * Additional remark for Excel Online: The total number of cells in the TableData object passed to the data parameter can't exceed 20,000 in a single call to this method. + * + * @param tableData An array of arrays ("matrix") or a TableData object that contains one or more columns of data to add to the table. Required. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addColumnsAsync(tableData: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; /** - * Adds the specified rows to the table - * @param rows A 2D array with the rows to add + * Adds the specified data to the table as additional rows. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: TableBindings + * + * To add one or more columns specifying the values of the data and headers, pass a TableData object as the data parameter. To add one or more columns specifying only the data, pass an array of arrays ("matrix") as the data parameter. + * + * The success or failure of an addRowsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be completely rolled back (and the AsyncResult.status property returned to the callback will report failure): + * + * - Each row in the array you pass as the data argument must have the same number of columns as the table being updated. If not, the entire operation will fail. + * + * - Each column and cell in the array must successfully add that column or cell to the table in the newly added rows(s). If any column or cell fails to be set for any reason, the entire operation will fail. + * + * - If you pass a TableData object as the data argument, the number of header rows must match that of the table being updated. + * + * Additional remark for Excel Online: The total number of cells in the TableData object passed to the data parameter can't exceed 20,000 in a single call to this method. + * + * @param rows An array of arrays ("matrix") or a TableData object that contains one or more rows of data to add to the table. Required. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addRowsAsync(rows: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; /** - * Clears the table + * Deletes all non-header rows and their values in the table, shifting appropriately for the host application. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: TableBindings + * + * In Excel, if the table has no header row, this method will delete the table itself. + * * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ deleteAllDataValuesAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Clears formatting on the bound table. + * + * @remarks + * Hosts: Excel + * + * Available in Requirement set: Not in a set + * + * See [Format tables in add-ins for Excel](https://docs.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-tables#format-a-table) for more information. + * * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ clearFormatsAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** @@ -942,560 +2038,2199 @@ declare namespace Office { * @param cellReference An object literal containing name-value pairs that specify the range of cells to get formatting from. * @param formats An array specifying the format properties to get. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getFormatsAsync(cellReference?: any, formats?: any[], options?: any, callback?: (result: AsyncResult) => void): void; /** * Sets formatting on specified items and data in the table. + * + * @remarks + * Hosts: Excel + * + * Available in Requirement set: Not in a set + * * @param formatsInfo Array elements are themselves three-element arrays:[target, type, formats] + * * target: The identifier of the item to format. String. + * * type: The kind of item to format. String. + * * formats: An object literal containing a list of property name-value pairs that define the formatting to apply. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ setFormatsAsync(formatsInfo?: any[], options?: any, callback?: (result: AsyncResult) => void): void; /** * Updates table formatting options on the bound table. + * + * @remarks + * Hosts: Excel + * + * Available in Requirement set: Not in a set + * * @param tableOptions An object literal containing a list of property name-value pairs that define the table options to apply. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ setTableOptionsAsync(tableOptions: any, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents the data in a table or a TableBinding. + * + * @remarks + * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings + */ export class TableData { constructor(rows: any[][], headers: any[]); constructor(); + /** + * Gets or sets the headers of the table. + * @remarks + * To specify headers, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify headers for a two-column table you would set the header property to [['header1', 'header2']]. + * + * If you specify null for the headers property (or leaving the property empty when you construct a TableData object), the following results occur when your code executes: + * + * - If you insert a new table, the default column headers for the table are created. + * + * - If you overwrite or update an existing table, the existing headers are not altered. + * + * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings + */ headers: any[]; + /** + * Gets or sets the rows in the table. Returns an array of arrays that contains the data in the table. Returns an empty array ``, if there are no rows. + * @remarks + * To specify rows, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify two rows of string values in a two-column table you would set the rows property to [['a', 'b'], ['c', 'd']]. + * + * If you specify null for the rows property (or leave the property empty when you construct a TableData object), the following results occur when your code executes: + * + * - If you insert a new table, a blank row will be inserted. + * + * - If you overwrite or update an existing table, the existing rows are not altered. + * + * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings + */ rows: any[][]; } + /** + * Specifies enumerated values for the cells: property in the cellFormat parameter of [table formatting methods](https://dev.office.com/reference/docs/excel/format-tables-in-add-ins-for-excel.htm). + * + * @remarks + * Hosts: Excel + */ export enum Table { + /** + * The entire table, including column headers, data, and totals (if any). + */ All, + /** + * Only the data (no headers and totals). + */ Data, + /** + * Only the header row. + */ Headers } + /** + * Represents a bound text selection in the document. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: TextBindings + * + * The TextBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. It does not implement any additional properties or methods of its own. + */ export interface TextBinding extends Binding { } + /** + * Specifies the project fields that are available as a parameter for the getProjectFieldAsync method. + * + * @remarks + * A ProjectProjectFields constant can be used as a parameter of the getProjectFieldAsync method. + * + * Hosts: Project + */ export enum ProjectProjectFields { + /** + * The number of digits after the decimal for the currency. + */ CurrencyDigits, + /** + * The currency symbol. + */ CurrencySymbol, + /** + * The placement of the currency symbol: Not specified = -1; Before the value with no space ($0) = 0; After the value with no space (0$) = 1; Before the value with a space ($ 0) = 2; After the value with a space (0 $) = 3. + */ CurrencySymbolPosition, DurationUnits, + /** + * The GUID of the project. + */ GUID, + /** + * The project finish date. + */ Finish, + /** + * The project start date. + */ Start, + /** + * Specifies whether the project is read-only. + */ ReadOnly, + /** + * The project version. + */ VERSION, + /** + * The work units of the project, such as days or hours. + */ WorkUnits, + /** + * The Project Web App URL, for projects that are stored in Project Server. + */ ProjectServerUrl, + /** + * The SharePoint URL, for projects that are synchronized with a SharePoint list. + */ WSSUrl, + /** + * The name of the SharePoint list, for projects that are synchronized with a tasks list. + */ WSSList } + /** + * Specifies the resource fields that are available as a parameter for the getResourceFieldAsync method. + * + * @remarks + * A ProjectResourceFields constant can be used as a parameter of the getResourceFieldAsync method. + * + * For more information about working with fields in Project, see [Available fields](https://support.office.com/article/Available-fields-reference-615a4563-1cc3-40f4-b66f-1b17e793a460) reference. In Project Help, search for Available fields. + */ export enum ProjectResourceFields { + /** + * The accrual method that defines how a task accrues the cost of the resource: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Accrual, + /** + * The calculated actual cost of the resource for assignments in the project. + */ ActualCost, + /** + * The actual overtime cost for a resource. + */ ActualOvertimeCost, + /** + * The actual overtime work for a resource, in minutes. + */ ActualOvertimeWork, + /** + * The actual overtime work for the resource that has been protected (made read-only). + */ ActualOvertimeWorkProtected, + /** + * The actual work that the resource has done on assignments in the project. + */ ActualWork, + /** + * The actual work for the resource that has been protected (made read-only). + */ ActualWorkProtected, + /** + * The name of the base calendar for the resource. + */ BaseCalendar, + /** + * The budget cost for the baseline resource. + */ Baseline10BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline10BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline10Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline10Work, + /** + * The budget cost for the baseline resource. + */ Baseline1BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline1BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline1Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline1Work, + /** + * The budget cost for the baseline resource. + */ Baseline2BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline2BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline2Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline2Work, + /** + * The budget cost for the baseline resource. + */ Baseline3BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline3BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline3Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline3Work, + /** + * The budget cost for the baseline resource. + */ Baseline4BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline4BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline4Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline4Work, + /** + * The budget cost for the baseline resource. + */ Baseline5BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline5BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline5Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline5Work, + /** + * The budget cost for the baseline resource. + */ Baseline6BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline6BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline6Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline6Work, + /** + * The budget cost for the baseline resource. + */ Baseline7BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline7BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline7Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline7Work, + /** + * The budget cost for the baseline resource. + */ Baseline8BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline8BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline8Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline8Work, + /** + * The budget cost for the baseline resource. + */ Baseline9BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline9BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline9Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline9Work, + /** + * The budget cost for the baseline resource. + */ BaselineBudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ BaselineBudgetWork, + /** + * The baseline cost for the resource for assignments in the project. + */ BaselineCost, + /** + * The baseline work for the resource for assignments in the project, in minutes. + */ BaselineWork, + /** + * The budget cost for the resource. + */ BudgetCost, + /** + * The budget work for the resource. + */ BudgetWork, + /** + * The GUID of the resource calendar. + */ ResourceCalendarGUID, + /** + * The code value of the resource. + */ Code, + /** + * A cost field for the resource. + */ Cost1, + /** + * A cost field for the resource. + */ Cost10, + /** + * A cost field for the resource. + */ Cost2, + /** + * A cost field for the resource. + */ Cost3, + /** + * A cost field for the resource. + */ Cost4, + /** + * A cost field for the resource. + */ Cost5, + /** + * A cost field for the resource. + */ Cost6, + /** + * A cost field for the resource. + */ Cost7, + /** + * A cost field for the resource. + */ Cost8, + /** + * A cost field for the resource. + */ Cost9, + /** + * The date the resource was created. + */ ResourceCreationDate, + /** + * A date field for the resource. + */ Date1, + /** + * A date field for the resource. + */ Date10, + /** + * A date field for the resource. + */ Date2, + /** + * A date field for the resource. + */ Date3, + /** + * A date field for the resource. + */ Date4, + /** + * A date field for the resource. + */ Date5, + /** + * A date field for the resource. + */ Date6, + /** + * A date field for the resource. + */ Date7, + /** + * A date field for the resource. + */ Date8, + /** + * A date field for the resource. + */ Date9, + /** + * A duration field for the resource. + */ Duration1, + /** + * A duration field for the resource. + */ Duration10, + /** + * A duration field for the resource. + */ Duration2, + /** + * A duration field for the resource. + */ Duration3, + /** + * A duration field for the resource. + */ Duration4, + /** + * A duration field for the resource. + */ Duration5, + /** + * A duration field for the resource. + */ Duration6, + /** + * A duration field for the resource. + */ Duration7, + /** + * A duration field for the resource. + */ Duration8, + /** + * A duration field for the resource. + */ Duration9, + /** + * The email address of the resource. + */ Email, + /** + * The end date of the resource availability. + */ End, + /** + * A finish field for the task. + */ Finish1, + /** + * A finish field for the task. + */ Finish10, + /** + * A finish field for the task. + */ Finish2, + /** + * A finish field for the task. + */ Finish3, + /** + * A finish field for the task. + */ Finish4, + /** + * A finish field for the task. + */ Finish5, + /** + * A finish field for the task. + */ Finish6, + /** + * A finish field for the task. + */ Finish7, + /** + * A finish field for the task. + */ Finish8, + /** + * A finish field for the task. + */ Finish9, + /** + * A Boolean flag field for the resource. + */ Flag10, + /** + * A Boolean flag field for the resource. + */ Flag1, + /** + * A Boolean flag field for the resource. + */ Flag11, + /** + * A Boolean flag field for the resource. + */ Flag12, + /** + * A Boolean flag field for the resource. + */ Flag13, + /** + * A Boolean flag field for the resource. + */ Flag14, + /** + * A Boolean flag field for the resource. + */ Flag15, + /** + * A Boolean flag field for the resource. + */ Flag16, + /** + * A Boolean flag field for the resource. + */ Flag17, + /** + * A Boolean flag field for the resource. + */ Flag18, + /** + * A Boolean flag field for the resource. + */ Flag19, + /** + * A Boolean flag field for the resource. + */ Flag2, + /** + * A Boolean flag field for the resource. + */ Flag20, + /** + * A Boolean flag field for the resource. + */ Flag3, + /** + * A Boolean flag field for the resource. + */ Flag4, + /** + * A Boolean flag field for the resource. + */ Flag5, + /** + * A Boolean flag field for the resource. + */ Flag6, + /** + * A Boolean flag field for the resource. + */ Flag7, + /** + * A Boolean flag field for the resource. + */ Flag8, + /** + * A Boolean flag field for the resource. + */ Flag9, + /** + * The group the resource belongs to. + */ Group, + /** + * The percentage of work units that the resource has assigned in the project. If the resource is working full-time on the project, Units = 100. + */ Units, + /** + * The name of the resource. + */ Name, + /** + * The text value of the notes regarding the resource. + */ Notes, + /** + * A number field for the resource. + */ Number1, + /** + * A number field for the resource. + */ Number10, + /** + * A number field for the resource. + */ Number11, + /** + * A number field for the resource. + */ Number12, + /** + * A number field for the resource. + */ Number13, + /** + * A number field for the resource. + */ Number14, + /** + * A number field for the resource. + */ Number15, + /** + * A number field for the resource. + */ Number16, + /** + * A number field for the resource. + */ Number17, + /** + * A number field for the resource. + */ Number18, + /** + * A number field for the resource. + */ Number19, + /** + * A number field for the resource. + */ Number2, + /** + * A number field for the resource. + */ Number20, + /** + * A number field for the resource. + */ Number3, + /** + * A number field for the resource. + */ Number4, + /** + * A number field for the resource. + */ Number5, + /** + * A number field for the resource. + */ Number6, + /** + * A number field for the resource. + */ Number7, + /** + * A number field for the resource. + */ Number8, + /** + * A number field for the resource. + */ Number9, + /** + * The overtime cost for a resource. + */ OvertimeCost, + /** + * The overtime rate for a resource. + */ OvertimeRate, + /** + * The overtime work for a resource. + */ OvertimeWork, + /** + * The percentage of work complete for a resource. + */ PercentWorkComplete, + /** + * The cost per use of the resource. + */ CostPerUse, + /** + * Indicates whether the resource is a generic resource (identified by skill rather than by name). + */ Generic, + /** + * Indicates whether the resource is overallocated. + */ OverAllocated, + /** + * The amount of regular work for the resource. + */ RegularWork, + /** + * The remaining cost for the resource. + */ RemainingCost, + /** + * The remaining overtime cost for the resource. + */ RemainingOvertimeCost, + /** + * The remaining overtime work for the resource, in minutes. + */ RemainingOvertimeWork, + /** + * The remaining work for the resource, in minutes. + */ RemainingWork, + /** + * The ID of the resource. + */ ResourceGUID, + /** + * The total cost of the resource. + */ Cost, + /** + * The total work for the resource, in minutes. + */ Work, + /** + * The start date for the resource. + */ Start, + /** + * A start field for the resource. + */ Start1, + /** + * A start field for the resource. + */ Start10, + /** + * A start field for the resource. + */ Start2, + /** + * A start field for the resource. + */ Start3, + /** + * A start field for the resource. + */ Start4, + /** + * A start field for the resource. + */ Start5, + /** + * A start field for the resource. + */ Start6, + /** + * A start field for the resource. + */ Start7, + /** + * A start field for the resource. + */ Start8, + /** + * A start field for the resource. + */ Start9, + /** + * The standard rate of pay for the resource, in cost per hour. + */ StandardRate, + /** + * A text field for the resource. + */ Text1, + /** + * A text field for the resource. + */ Text10, + /** + * A text field for the resource. + */ Text11, + /** + * A text field for the resource. + */ Text12, + /** + * A text field for the resource. + */ Text13, + /** + * A text field for the resource. + */ Text14, + /** + * A text field for the resource. + */ Text15, + /** + * A text field for the resource. + */ Text16, + /** + * A text field for the resource. + */ Text17, + /** + * A text field for the resource. + */ Text18, + /** + * A text field for the resource. + */ Text19, + /** + * A text field for the resource. + */ Text2, + /** + * A text field for the resource. + */ Text20, + /** + * A text field for the resource. + */ Text21, + /** + * A text field for the resource. + */ Text22, + /** + * A text field for the resource. + */ Text23, + /** + * A text field for the resource. + */ Text24, + /** + * A text field for the resource. + */ Text25, + /** + * A text field for the resource. + */ Text26, + /** + * A text field for the resource. + */ Text27, + /** + * A text field for the resource. + */ Text28, + /** + * A text field for the resource. + */ Text29, + /** + * A text field for the resource. + */ Text3, + /** + * A text field for the resource. + */ Text30, + /** + * A text field for the resource. + */ Text4, + /** + * A text field for the resource. + */ Text5, + /** + * A text field for the resource. + */ Text6, + /** + * A text field for the resource. + */ Text7, + /** + * A text field for the resource. + */ Text8, + /** + * A text field for the resource. + */ Text9 } + /** + * Specifies the task fields that are available as a parameter for the getTaskFieldAsync method. + * + * @remarks + * A ProjectTaskFields constant can be used as a parameter of the getTaskFieldAsync method. + * + * For more information about working with fields in Project, see the [Available fields](https://support.office.com/article/Available-fields-reference-615a4563-1cc3-40f4-b66f-1b17e793a460) reference. In Project Help, search for Available fields. + * + * Hosts: Project + */ export enum ProjectTaskFields { + /** + * The current actual cost for the task. + */ ActualCost, + /** + * The actual duration of the task, in minutes. + */ ActualDuration, + /** + * The actual finish date of the task. + */ ActualFinish, + /** + * The actual overtime cost for the task. + */ ActualOvertimeCost, + /** + * The actual overtime work for the task, in minutes. + */ ActualOvertimeWork, + /** + * The actual start date of the task. + */ ActualStart, + /** + * The actual work for the task, in minutes. + */ ActualWork, + /** + * A text field for the task. + */ Text1, + /** + * A text field for the task. + */ Text10, + /** + * A finish field for the task. + */ Finish10, + /** + * A start field for the task. + */ Start10, + /** + * A text field for the task. + */ Text11, + /** + * A text field for the task. + */ Text12, + /** + * A text field for the task. + */ Text13, + /** + * A text field for the task. + */ Text14, + /** + * A text field for the task. + */ Text15, + /** + * A text field for the task. + */ Text16, + /** + * A text field for the task. + */ Text17, + /** + * A text field for the task. + */ Text18, + /** + * A text field for the task. + */ Text19, + /** + * A finish field for the task. + */ Finish1, + /** + * A start field for the task. + */ Start1, + /** + * A text field for the task. + */ Text2, + /** + * A text field for the task. + */ Text20, + /** + * A text field for the task. + */ Text21, + /** + * A text field for the task. + */ Text22, + /** + * A text field for the task. + */ Text23, + /** + * A text field for the task. + */ Text24, + /** + * A text field for the task. + */ Text25, + /** + * A text field for the task. + */ Text26, + /** + * A text field for the task. + */ Text27, + /** + * A text field for the task. + */ Text28, + /** + * A text field for the task. + */ Text29, + /** + * A finish field for the task. + */ Finish2, + /** + * A start field for the task. + */ Start2, + /** + * A text field for the task. + */ Text3, + /** + * A text field for the task. + */ Text30, + /** + * A finish field for the task. + */ Finish3, + /** + * A start field for the task. + */ Start3, + /** + * A text field for the task. + */ Text4, + /** + * A finish field for the task. + */ Finish4, + /** + * A start field for the task. + */ Start4, + /** + * A text field for the task. + */ Text5, + /** + * A finish field for the task. + */ Finish5, + /** + * A start field for the task. + */ Start5, + /** + * A text field for the task. + */ Text6, + /** + * A finish field for the task. + */ Finish6, + /** + * A start field for the task. + */ Start6, + /** + * A text field for the task. + */ Text7, + /** + * A finish field for the task. + */ Finish7, + /** + * A start field for the task. + */ Start7, + /** + * A text field for the task. + */ Text8, + /** + * A finish field for the task. + */ Finish8, + /** + * A start field for the task. + */ Start8, + /** + * A text field for the task. + */ Text9, + /** + * A finish field for the task. + */ Finish9, + /** + * A start field for the task. + */ Start9, + /** + * The budget cost for the baseline task. + */ Baseline10BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline10BudgetWork, + /** + * The cost for the baseline task. + */ Baseline10Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline10Duration, + /** + * The finish date for the baseline task. + */ Baseline10Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline10FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline10FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline10Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline10Work, + /** + * The budget cost for the baseline task. + */ Baseline1BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline1BudgetWork, + /** + * The cost for the baseline task. + */ Baseline1Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline1Duration, + /** + * The finish date for the baseline task. + */ Baseline1Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline1FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline1FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline1Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline1Work, + /** + * The budget cost for the baseline task. + */ Baseline2BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline2BudgetWork, + /** + * The cost for the baseline task. + */ Baseline2Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline2Duration, + /** + * The finish date for the baseline task. + */ Baseline2Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline2FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline2FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline2Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline2Work, + /** + * The budget cost for the baseline task. + */ Baseline3BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline3BudgetWork, + /** + * The cost for the baseline task. + */ Baseline3Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline3Duration, + /** + * The finish date for the baseline task. + */ Baseline3Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline3FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline3FixedCostAccrual, + /** + * The start date for the baseline task. + */ Basline3Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline3Work, + /** + * The budget cost for the baseline task. + */ Baseline4BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline4BudgetWork, + /** + * The cost for the baseline task. + */ Baseline4Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline4Duration, + /** + * The finish date for the baseline task. + */ Baseline4Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline4FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline4FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline4Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline4Work, + /** + * The budget cost for the baseline task. + */ Baseline5BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline5BudgetWork, + /** + * The cost for the baseline task. + */ Baseline5Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline5Duration, + /** + * The finish date for the baseline task. + */ Baseline5Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline5FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline5FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline5Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline5Work, + /** + * The budget cost for the baseline task. + */ Baseline6BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline6BudgetWork, + /** + * The cost for the baseline task. + */ Baseline6Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline6Duration, + /** + * The finish date for the baseline task. + */ Baseline6Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline6FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline6FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline6Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline6Work, + /** + * The budget cost for the baseline task. + */ Baseline7BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline7BudgetWork, + /** + * The cost for the baseline task. + */ Baseline7Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline7Duration, + /** + * The finish date for the baseline task. + */ Baseline7Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline7FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline7FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline7Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline7Work, + /** + * The budget cost for the baseline task. + */ Baseline8BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline8BudgetWork, + /** + * The cost for the baseline task. + */ Baseline8Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline8Duration, + /** + * The finish date for the baseline task. + */ Baseline8Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline8FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline8FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline8Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline8Work, + /** + * The budget cost for the baseline task. + */ Baseline9BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline9BudgetWork, + /** + * The cost for the baseline task. + */ Baseline9Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline9Duration, + /** + * The finish date for the baseline task. + */ Baseline9Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline9FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline9FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline9Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline9Work, + /** + * The budget cost for the baseline task. + */ BaselineBudgetCost, + /** + * The budget work for the baseline task, in hours. + */ BaselineBudgetWork, + /** + * The cost for the baseline task. + */ BaselineCost, + /** + * The duration for the baseline task, in minutes. + */ BaselineDuration, + /** + * The finish date for the baseline task. + */ BaselineFinish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ BaselineFixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ BaselineFixedCostAccrual, + /** + * The start date for the baseline task. + */ BaselineStart, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ BaselineWork, + /** + * The budget cost for the task. + */ BudgetCost, BudgetFixedCost, - BudgetFixedWork, + BudgetFixedWork, + /** + * The budget work for the task, in hours. + */ BudgetWork, + /** + * The GUID of the task calendar. + */ TaskCalendarGUID, + /** + * A constraint date for the task. + */ ConstraintDate, + /** + * A constraint type for the task: As Soon As Possible = 0, As Late As Possible = 1, Must Start On = 2, Must Finish On = 3, Start No Earlier Than = 4, Start No Later Than = 5, Finish No Earlier Than = 6, Finish No Later Than = 7. + */ ConstraintType, + /** + * A cost field of the task. + */ Cost1, + /** + * A cost field of the task. + */ Cost10, + /** + * A cost field of the task. + */ Cost2, + /** + * A cost field of the task. + */ Cost3, + /** + * A cost field of the task. + */ Cost4, + /** + * A cost field of the task. + */ Cost5, + /** + * A cost field of the task. + */ Cost6, + /** + * A cost field of the task. + */ Cost7, + /** + * A cost field of the task. + */ Cost8, + /** + * A cost field of the task. + */ Cost9, + /** + * A date field of the task. + */ Date1, + /** + * A date field of the task. + */ Date10, + /** + * A date field of the task. + */ Date2, + /** + * A date field of the task. + */ Date3, + /** + * A date field of the task. + */ Date4, + /** + * A date field of the task. + */ Date5, + /** + * A date field of the task. + */ Date6, + /** + * A date field of the task. + */ Date7, + /** + * A date field of the task. + */ Date8, + /** + * A date field of the task. + */ Date9, + /** + * The deadline for a task. + */ Deadline, + /** + * A duration field of the task. + */ Duration1, + /** + * A duration field of the task. + */ Duration10, + /** + * A duration field of the task. + */ Duration2, + /** + * A duration field of the task. + */ Duration3, + /** + * A duration field of the task. + */ Duration4, + /** + * A duration field of the task. + */ Duration5, + /** + * A duration field of the task. + */ Duration6, + /** + * A duration field of the task. + */ Duration7, + /** + * A duration field of the task. + */ Duration8, + /** + * A duration field of the task. + */ Duration9, + /** + * A duration field of the task. + */ Duration, + /** + * The method for calculating earned value for the task. + */ EarnedValueMethod, + /** + * The duration between the Early Finish and Late Finish dates for the task, in minutes. + */ FinishSlack, + /** + * The fixed cost for the task. + */ FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ FixedCostAccrual, + /** + * A Boolean flag field for the task. + */ Flag10, + /** + * A Boolean flag field for the task. + */ Flag1, + /** + * A Boolean flag field for the task. + */ Flag11, + /** + * A Boolean flag field for the task. + */ Flag12, + /** + * A Boolean flag field for the task. + */ Flag13, + /** + * A Boolean flag field for the task. + */ Flag14, + /** + * A Boolean flag field for the task. + */ Flag15, + /** + * A Boolean flag field for the task. + */ Flag16, + /** + * A Boolean flag field for the task. + */ Flag17, + /** + * A Boolean flag field for the task. + */ Flag18, + /** + * A Boolean flag field for the task. + */ Flag19, + /** + * A Boolean flag field for the task. + */ Flag2, + /** + * A Boolean flag field for the task. + */ Flag20, + /** + * A Boolean flag field for the task. + */ Flag3, + /** + * A Boolean flag field for the task. + */ Flag4, + /** + * A Boolean flag field for the task. + */ Flag5, + /** + * A Boolean flag field for the task. + */ Flag6, + /** + * A Boolean flag field for the task. + */ Flag7, + /** + * A Boolean flag field for the task. + */ Flag8, + /** + * A Boolean flag field for the task. + */ Flag9, + /** + * The amount of time that the task can be delayed without delaying its successor tasks. + */ FreeSlack, + /** + * Indicates whether the task has rollup subtasks. + */ HasRollupSubTasks, + /** + * The index of the selected task. After the project summary task, the index of the first task in a project is 1. + */ ID, + /** + * The name of the task. + */ Name, + /** + * The text value of the notes regarding the task. + */ Notes, + /** + * A number field for the task. + */ Number1, + /** + * A number field for the task. + */ Number10, + /** + * A number field for the task. + */ Number11, + /** + * A number field for the task. + */ Number12, + /** + * A number field for the task. + */ Number13, + /** + * A number field for the task. + */ Number14, + /** + * A number field for the task. + */ Number15, + /** + * A number field for the task. + */ Number16, + /** + * A number field for the task. + */ Number17, + /** + * A number field for the task. + */ Number18, + /** + * A number field for the task. + */ Number19, + /** + * A number field for the task. + */ Number2, + /** + * A number field for the task. + */ Number20, + /** + * A number field for the task. + */ Number3, + /** + * A number field for the task. + */ Number4, + /** + * A number field for the task. + */ Number5, + /** + * A number field for the task. + */ Number6, + /** + * A number field for the task. + */ Number7, + /** + * A number field for the task. + */ Number8, + /** + * A number field for the task. + */ Number9, + /** + * The scheduled (as opposed to actual) duration of the task. + */ ScheduledDuration, + /** + * The scheduled (as opposed to actual) finish date of the task. + */ ScheduledFinish, + /** + * The scheduled (as opposed to actual) start date of the task. + */ ScheduledStart, + /** + * The level of the task in the outline hierarchy. + */ OutlineLevel, + /** + * The overtime cost for the task. + */ OvertimeCost, + /** + * The overtime work for the task. + */ OvertimeWork, + /** + * The percent complete status of the task. + */ PercentComplete, + /** + * The percentage of work completed for the task. + */ PercentWorkComplete, + /** + * The IDs of the task's predecessors. + */ Predecessors, + /** + * The finish date of a task before leveling occurred. + */ PreleveledFinish, + /** + * The start date of a task before leveling occurred. + */ PreleveledStart, + /** + * The priority of the task, with values from 0 (low) to 1000 (high). The default priority value is 500. + */ Priority, + /** + * Indicates whether the task is active. + */ Active, + /** + * Indicates whether the task is on the critical path. + */ Critical, + /** + * Indicates whether the task is a milestone. + */ Milestone, + /** + * Indicates whether any assignments for a task are overallocated. + */ Overallocated, + /** + * Indicates whether subtask information is rolled up to the summary task bar. + */ IsRollup, + /** + * Indicates whether the task is a summary task. + */ Summary, + /** + * The amount of regular work for the task. + */ RegularWork, + /** + * The remaining cost for the task. + */ RemainingCost, + /** + * The remaining duration for the task, in minutes. + */ RemainingDuration, + /** + * The remaining overtime cost for the task. + */ RemainingOvertimeCost, + /** + * The remaining work for the task, in minutes. + */ RemainingWork, + /** + * The names of the resources assigned to a task. + */ ResourceNames, + /** + * The total cost of the task. + */ Cost, + /** + * The finish date of the task. + */ Finish, + /** + * The start date of the task. + */ Start, + /** + * The total person-hours scheduled for the task, in minutes. + */ Work, + /** + * The duration between the Early Start and Late Start dates for the task. + */ StartSlack, + /** + * The status of the task: Complete = 0, on schedule = 1, late = 2, future task = 3, status not available = 4. + */ Status, + /** + * The IDs of the task's successors. + */ Successors, + /** + * The enterprise resource responsible for accepting or rejecting assignment progress updates for the task. + */ StatusManager, + /** + * The total slack time for the task, in minutes. + */ TotalSlack, + /** + * The GUID of the task. + */ TaskGUID, + /** + * The way the task is calculated: Fixed units = 0, fixed duration = 1, fixed work = 2. + */ Type, + /** + * The work breakdown structure code of the task. + */ WBS, + /** + * The work breakdown structure codes of the task predecessors, separated by the list separator. + */ WBSPREDECESSORS, + /** + * The work breakdown structure codes of the task successors, separated by the list separator. + */ WBSSUCCESSORS, + /** + * The ID of the task in a SharePoint list, for a project that is synchronized with a SharePoint tasks list. + */ WSSID } + /** + * Specifies the types of views that the getSelectedViewAsync method can recognize. + * + * @remarks + * The getSelectedViewAsync method returns the ProjectViewTypes constant value and name that corresponds to the active view. + * + * Hosts: Project + */ export enum ProjectViewTypes { + /** + * The Gantt chart view. + */ Gantt, + /** + * The Network Diagram view. + */ NetworkDiagram, + /** + * The Task Diagram view. + */ TaskDiagram, + /** + * The Task form view. + */ TaskForm, + /** + * The Task Sheet view. + */ TaskSheet, + /** + * The Resource Form view. + */ ResourceForm, + /** + * The Resource Sheet view. + */ ResourceSheet, + /** + * The Resource Graph view. + */ ResourceGraph, + /** + * The Team Planner view. + */ TeamPlanner, + /** + * The Task Details view. + */ TaskDetails, + /** + * The Task Name Form view. + */ TaskNameForm, + /** + * The Resource Names view. + */ ResourceNames, + /** + * The Calendar view. + */ Calendar, + /** + * The Task Usage view. + */ TaskUsage, + /** + * The Resource Usage view. + */ ResourceUsage, + /** + * The Timeline view. + */ Timeline } // Objects @@ -1504,8 +4239,8 @@ declare namespace Office { * Get Project field (Ex. ProjectWebAccessURL). * @param fieldId Project level fields. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getProjectFieldAsync(fieldId: number, options?: any, callback?: (result: AsyncResult) => void): void; /** @@ -1513,37 +4248,37 @@ declare namespace Office { * @param resourceId Either a string or value of the Resource Id. * @param fieldId Resource Fields. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getResourceFieldAsync(resourceId: string, fieldId: number, options?: any, callback?: (result: AsyncResult) => void): void; /** * Get the current selected Resource's Id. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getSelectedResourceAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Get the current selected Task's Id. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getSelectedTaskAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Get the current selected View Type (Ex. Gantt) and View Name. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getSelectedViewAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Get the Task Name, WSS Task Id, and ResourceNames for given taskId. * @param taskId Either a string or value of the Task Id. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getTaskAsync(taskId: string, options?: any, callback?: (result: AsyncResult) => void): void; /** @@ -1551,15 +4286,15 @@ declare namespace Office { * @param taskId Either a string or value of the Task Id. * @param fieldId Task Fields. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getTaskFieldAsync(taskId: string, fieldId: number, options?: any, callback?: (result: AsyncResult) => void): void; /** * Get the WSS Url and list name for the Tasks List, the MPP is synced too. * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getWSSUrlAsync(options?: any, callback?: (result: AsyncResult) => void): void; } @@ -1848,8 +4583,17 @@ declare namespace Office { phoneNumbers: Array; urls: Array; } + /** + * Represents the runtime environment of the add-in and provides access to key objects of the API. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export interface Context { mailbox: Mailbox; + /** + * Gets an object that represents the saved custom settings of the add-in. + */ roamingSettings: RoamingSettings; } export interface CustomProperties { @@ -3081,22 +5825,34 @@ declare namespace Excel { /** * * Gets the Binding object that represents the binding that raised the SelectionChanged event. + * + * @remarks + * Hosts: Access, Excel, Word * * [Api set: ExcelApi 1.2] */ binding: Excel.Binding; /** * - * Gets the number of columns selected. + * Gets the number of columns selected. The number of columns selected. If a single cell is selected returns 1. * * [Api set: ExcelApi 1.2] + * + * @remarks + * If the user makes a non-contiguous selection, the count for the last contiguous selection within the binding is returned. + * + * For Word, this property will work only for bindings of BindingType "table". If the binding is of type "matrix", null is returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property to work correctly. */ columnCount: number; /** - * - * Gets the number of rows selected. + * Gets the number of columns selected. The number of columns selected. If a single cell is selected returns 1. * * [Api set: ExcelApi 1.2] + * + * @remarks + * If the user makes a non-contiguous selection, the count for the last contiguous selection within the binding is returned. + * + * For Word, this property will work only for bindings of BindingType "table". If the binding is of type "matrix", null is returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property to work correctly. */ rowCount: number; /** @@ -44430,4 +47186,4 @@ declare namespace Visio { //////////////////////////////////////////////////////////////// //////////////////////// End Visio APIs //////////////////////// -//////////////////////////////////////////////////////////////// \ No newline at end of file +////////////////////////////////////////////////////////////////Contains the host in which the add-in (web application) is running in. Possible values are: Word, Excel, PowerPoint \ No newline at end of file diff --git a/types/p-memoize/index.d.ts b/types/p-memoize/index.d.ts new file mode 100644 index 0000000000..0b997b4b19 --- /dev/null +++ b/types/p-memoize/index.d.ts @@ -0,0 +1,56 @@ +// Type definitions for p-memoize 1.0 +// Project: https://github.com/sindresorhus/p-memoize#readme +// Definitions by: forabi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +interface MemOptions { + /** + * Milliseconds until the cache expires. + * @default Infinity + */ + maxAge?: number; + + /** + * Determines the cache key for storing the result based on the + * function arguments. By default, if there's only one argument and + * it's a primitive, it's used directly as a key, otherwise it's all + * the function arguments JSON stringified as an array. + * + * You could for example change it to only cache on the first argument + * `x => JSON.stringify(x)`. + */ + cacheKey?: (...args: any[]) => string; + + /** + * Use a different cache storage. + * Must implement the following methods: + * `.has(key)`, `.get(key)`, `.set(key, value)`, `.delete(key)`, and optionally `.clear()` + * You could for example use a `WeakMap` instead or `quick-lru` for a LRU cache. + * + * @default new Map() + */ + cache?: pMemoize.Cache; + + /** Cache rejected promises. */ + cachePromiseRejection?: boolean; +} + +type PMemoize = any>( + f: T, + memoizeOptions?: MemOptions +) => T; + +declare const pMemoize: PMemoize; + +declare namespace pMemoize { + interface Cache { + get(key: K): V; + set(key: K, value: V): void; + has(key: K): boolean; + delete(key: K): void; + clear?(): void; + } +} + +export = pMemoize; diff --git a/types/p-memoize/p-memoize-tests.ts b/types/p-memoize/p-memoize-tests.ts new file mode 100644 index 0000000000..8626482dab --- /dev/null +++ b/types/p-memoize/p-memoize-tests.ts @@ -0,0 +1,13 @@ +import pMemoize = require('p-memoize'); +import { Cache } from 'p-memoize'; + +const a = pMemoize(async () => Promise.resolve('Hello world!')); + +const b = pMemoize(async () => Promise.resolve(1), { + maxAge: 1000, + cache: new Map() +}); + +a(); + +b(); diff --git a/types/p-memoize/tsconfig.json b/types/p-memoize/tsconfig.json new file mode 100644 index 0000000000..0605de1be9 --- /dev/null +++ b/types/p-memoize/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": ["index.d.ts", "p-memoize-tests.ts"] +} diff --git a/types/p-memoize/tslint.json b/types/p-memoize/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/p-memoize/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pegjs/index.d.ts b/types/pegjs/index.d.ts index 722153038b..c5cdb533ec 100644 --- a/types/pegjs/index.d.ts +++ b/types/pegjs/index.d.ts @@ -51,8 +51,9 @@ export type GrammarError = PegjsError; export var GrammarError: any; export interface ParserOptions { - startRule: string; - tracer: any; + startRule?: string; + tracer?: any; + [key: string]: any; } export interface Parser { diff --git a/types/pegjs/pegjs-tests.ts b/types/pegjs/pegjs-tests.ts index 267a64b060..f2a3d543ed 100644 --- a/types/pegjs/pegjs-tests.ts +++ b/types/pegjs/pegjs-tests.ts @@ -26,6 +26,11 @@ import * as pegjs from 'pegjs'; }) } +{ + let parser: pegjs.Parser = pegjs.generate('start = "a" { return options; }'); + let parsed: any = parser.parse("a", {a: 42}); +} + try { let source: string = pegjs.generate("A = 'test'", {output: "source"}); } catch (error) { @@ -44,4 +49,4 @@ try { console.log(e.location.end.line); console.log(e.message); console.log(e.name); -} \ No newline at end of file +} diff --git a/types/pino/index.d.ts b/types/pino/index.d.ts index 02b66cc745..0f98e0a622 100644 --- a/types/pino/index.d.ts +++ b/types/pino/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for pino 4.7 +// Type definitions for pino 4.16 // Project: https://github.com/pinojs/pino.git // Definitions by: Peter Snider // BendingBender +// Christian Rackerseder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -192,6 +193,10 @@ declare namespace P { trace?: WriteFn; } & { [logLevel: string]: WriteFn }); }; + /** + * key-value object added as child logger to each log line. If set to null the base child logger is not added + */ + base?: { [key: string]: any } | null; } interface PrettyOptions { diff --git a/types/pino/pino-tests.ts b/types/pino/pino-tests.ts index cc7704be77..6d226a1d92 100644 --- a/types/pino/pino-tests.ts +++ b/types/pino/pino-tests.ts @@ -49,6 +49,9 @@ pino({ } }); +pino({ base: null }); +pino({ base: { foo: 'bar' } }); + if ('pino' in log) console.log(`pino version: ${log.pino}`); log.child({a: 'property'}).info('hello child!'); diff --git a/types/playcanvas/engine/framework/application.d.ts b/types/playcanvas/engine/framework/application.d.ts index 6ef4d996d1..fccb92e2ca 100644 --- a/types/playcanvas/engine/framework/application.d.ts +++ b/types/playcanvas/engine/framework/application.d.ts @@ -436,6 +436,27 @@ declare namespace pc { */ renderLine(start: pc.Vec3, end: pc.Vec3, startColor: pc.Color, endColor: pc.Color, lineType: number): void; + /** + * @function + * @name pc.Application#renderLine^5 + * @description Draw a line which blends between two colors with specified line type + * @param {pc.Vec3} start The start of the line + * @param {pc.Vec3} end The end of the line + * @param {pc.Color} color The start color of the line + * @param {Object} options + * @param {Number} [options.layer] lineType The type of rendering to use: pc.LINEBATCH_WORLD, pc.LINEBATCH_OVERLAY, pc.LINEBATCH_GIZMO. Default is pc.LAYERID_IMMEDIATE + * @example + * var start = new pc.Vec3(0,0,0); + * var end = new pc.Vec3(1,0,0); + * var startColor = new pc.Color(1,1,1); + * const options = { + * layer: pc.LINEBATCH_OVERLAY, + * }; + * + * app.renderLine(start, end, color, options); + */ + renderLine(start: pc.Vec3, end: pc.Vec3, color: pc.Color, options: object): void; + /** * @function * @name pc.Application#renderLines diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index ac35dc064b..c4cd97b0ba 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for plotly.js 1.36 +// Type definitions for plotly.js 1.37 // Project: https://plot.ly/javascript/ // Definitions by: Chris Gervang // Martin Duparc @@ -386,7 +386,16 @@ export interface ScatterData { 'marker.colorbar': {}; // TODO mode: 'lines' | 'markers' | 'text' | 'lines+markers' | 'text+markers' | 'text+lines' | 'text+lines+markers' | 'none'; hoveron: 'points' | 'fills'; - hoverinfo: 'text'; + hoverinfo: 'all' | 'name' | 'none' | 'skip' | 'text' | + 'x' | 'x+text' | 'x+name' | + 'x+y' | 'x+y+text' | 'x+y+name' | + 'x+y+z' | 'x+y+z+text' | 'x+y+z+name' | + 'y+x' | 'y+x+text' | 'y+x+name' | + 'y+z' | 'y+z+text' | 'y+z+name' | + 'y+x+z' | 'y+x+z+text' | 'y+x+z+name' | + 'z+x' | 'z+x+text' | 'z+x+name' | + 'z+y+x' | 'z+y+x+text' | 'z+y+x+name' | + 'z+x+y' | 'z+x+y+text' | 'z+x+y+name'; fill: 'none' | 'tozeroy' | 'tozerox' | 'tonexty' | 'tonextx' | 'toself' | 'tonext'; fillcolor: string; legendgroup: string; @@ -394,6 +403,11 @@ export interface ScatterData { connectgaps: boolean; } +/** + * Any combination of "x", "y", "z", "text", "name" joined with a "+" OR "all" or "none" or "skip". + * examples: "x", "y", "x+y", "x+y+z", "all" + * default: "all" + */ export interface ScatterMarker { symbol: string | string[]; // Drawing.symbolList color: Color | number[]; diff --git a/types/prettier/index.d.ts b/types/prettier/index.d.ts index dbc358bfc9..fd20fdd167 100644 --- a/types/prettier/index.d.ts +++ b/types/prettier/index.d.ts @@ -8,15 +8,15 @@ export type AST = any; export type Doc = doc.builders.Doc; // https://github.com/prettier/prettier/blob/master/src/common/fast-path.js -export interface FastPath { +export interface FastPath { stack: any[]; - getName(): null | number | string; - getValue(): any; - getNode(count?: number): any; - getParentNode(count?: number): any; - call(callback: (path: this) => T, ...names: string[]): T; - each(callback: (path: this) => void, ...names: string[]): void; - map(callback: (path: this, index: number) => T, ...names: string[]): T[]; + getName(): null | PropertyKey; + getValue(): T; + getNode(count?: number): null | T; + getParentNode(count?: number): null | T; + call(callback: (path: this) => U, ...names: PropertyKey[]): U; + each(callback: (path: this) => void, ...names: PropertyKey[]): void; + map(callback: (path: this, index: number) => U, ...names: PropertyKey[]): U[]; } export type BuiltInParser = (text: string, options?: any) => AST; @@ -107,6 +107,7 @@ export interface RequiredOptions extends doc.printer.Options { export interface ParserOptions extends RequiredOptions { locStart: (node: any) => number; locEnd: (node: any) => number; + originalText: string; } export interface Plugin { diff --git a/types/prop-types/index.d.ts b/types/prop-types/index.d.ts index ebeef159b0..67146e6cc7 100644 --- a/types/prop-types/index.d.ts +++ b/types/prop-types/index.d.ts @@ -28,3 +28,15 @@ export function oneOfType(types: Array>): Requireable; export function arrayOf(type: Validator): Requireable; export function objectOf(type: Validator): Requireable; export function shape(type: ValidationMap): Requireable; + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param typeSpecs Map of name to a ReactPropType + * @param values Runtime values that need to be type-checked + * @param location e.g. "prop", "context", "child context" + * @param componentName Name of the component for error messages. + * @param getStack Returns the component stack. + */ +export function checkPropTypes(typeSpecs: any, values: any, location: string, componentName: string, getStack?: () => any): void; diff --git a/types/prop-types/prop-types-tests.ts b/types/prop-types/prop-types-tests.ts index 238a22b1ef..4d5a939b6e 100644 --- a/types/prop-types/prop-types-tests.ts +++ b/types/prop-types/prop-types-tests.ts @@ -25,3 +25,5 @@ const propTypes: PropTypes.ValidationMap = { node: PropTypes.node.isRequired, element: PropTypes.element.isRequired }; + +PropTypes.checkPropTypes({xs: PropTypes.array}, {xs: []}, 'location', 'componentName'); diff --git a/types/ps-tree/index.d.ts b/types/ps-tree/index.d.ts new file mode 100644 index 0000000000..ff60b6241e --- /dev/null +++ b/types/ps-tree/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for ps-tree 1.1 +// Project: http://github.com/indexzero/ps-tree +// Definitions by: Alessio Paccoia +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +declare namespace ps_tree { + interface PS { + COMMAND: string; + PPID: string; + PID: string; + STAT: string; + } + + const prototype: { + }; +} + +declare function ps_tree(pid: number, callback: (error: Error, children: ReadonlyArray) => void): void; + +export as namespace ps_tree; +export = ps_tree; diff --git a/types/ps-tree/ps-tree-tests.ts b/types/ps-tree/ps-tree-tests.ts new file mode 100644 index 0000000000..2ef6c48c27 --- /dev/null +++ b/types/ps-tree/ps-tree-tests.ts @@ -0,0 +1,9 @@ +import ps_tree from "ps-tree"; + +ps_tree(1, () => {}); // $ExpectType void +ps_tree(1, (error: Error, children: ReadonlyArray) => { + children[0].COMMAND; // $ExpectType string + children[0].PID; // $ExpectType string + children[0].PPID; // $ExpectType string + children[0].STAT; // $ExpectType string +}); diff --git a/types/ps-tree/tsconfig.json b/types/ps-tree/tsconfig.json new file mode 100644 index 0000000000..9bb8c2d8e1 --- /dev/null +++ b/types/ps-tree/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "esModuleInterop": true, + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ps-tree-tests.ts" + ] +} diff --git a/types/ps-tree/tslint.json b/types/ps-tree/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ps-tree/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/qunit/index.d.ts b/types/qunit/index.d.ts index a0276a3488..2b7eb586ff 100644 --- a/types/qunit/index.d.ts +++ b/types/qunit/index.d.ts @@ -595,6 +595,14 @@ interface QUnit { */ todo(name: string, callback?: (assert: Assert) => void): void; + /** + * Compares two values. Returns true if they are equivalent. + * + * @param a The first value + * @param b The second value + */ + equiv(a: T, b: T): boolean; + /** * Are the test running from the server or not. */ diff --git a/types/qunit/qunit-tests.ts b/types/qunit/qunit-tests.ts index 25ffc9fbf1..e726113604 100644 --- a/types/qunit/qunit-tests.ts +++ b/types/qunit/qunit-tests.ts @@ -556,3 +556,9 @@ QUnit.test( "test with beforeEach and afterEach", function( assert ) { QUnit.todo( "a todo test", function( assert ) { assert.equal( 0, 1, "0 does not equal 1, so this todo should pass" ); }); + +let equivResult: boolean; +equivResult = QUnit.equiv({}, {}); +equivResult = QUnit.equiv(1, 2); +equivResult = QUnit.equiv('foo', 'bar'); +equivResult = QUnit.equiv(['foo'], ['bar']); diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 9849ee48b1..3ee2bd3dfa 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -20,6 +20,7 @@ // Keagan McClelland // Tomas Szabo // Bonggyun Lee +// Marcin Biernat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -82,9 +83,28 @@ declare namespace R { (obj: Dictionary): Dictionary; } - type Evolver = - | ((x: T) => T) - | { [K in keyof T]?: Evolver }; + type Evolve, E extends Evolver> = { + [P in keyof O]: P extends keyof E ? EvolveValue : O[P]; + }; + + type EvolveValue = + E extends (value: V) => any ? ReturnType : + E extends Evolver ? EvolveNestedValue : + never; + + type EvolveNestedValue = + V extends object ? (V extends Evolvable ? Evolve : never) : never; + + interface Evolver { + [key: string]: ((value: any) => any) | Evolver; + } + + // Represents all objects evolvable with Evolver E + type Evolvable = { + [P in keyof E]?: E[P] extends (value: infer V) => any ? V : + E[P] extends Evolver ? Evolvable : + never + }; // @see https://gist.github.com/donnut/fd56232da58d25ceecf1, comment by @albrow interface CurriedTypeGuard2 { @@ -293,7 +313,7 @@ declare namespace R { * Creates a function that is bound to a context. Note: R.bind does not provide the additional argument-binding * capabilities of Function.prototype.bind. */ - bind(thisObj: T, fn: (...args: any[]) => any): (...args: any[]) => any; + bind(fn: (...args: any[]) => any, thisObj: T): (...args: any[]) => any; /** * A function wrapping calls to the two functions in an && operation, returning the result of the first function @@ -604,8 +624,8 @@ declare namespace R { /** * Creates a new object by evolving a shallow copy of object, according to the transformation functions. */ - evolve(transformations: Evolver, obj: V): V; - evolve(transformations: Evolver): (obj: W) => W; + evolve>(transformations: E, obj: V): Evolve; + evolve(transformations: E): >(obj: V) => Evolve; /* * A function that always returns false. Any passed in parameters are ignored. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 8cbbf9ceac..2d8cfb1e21 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1307,19 +1307,55 @@ type Pair = KeyValuePair; }; () => { - const a1 = R.evolve({elapsed: R.add(1), remaining: R.add(-1)}, {name: "Tomato", elapsed: 100, remaining: 1400}); - const a2 = R.evolve({elapsed: R.add(1), remaining: R.add(-1)})({name: "Tomato", elapsed: 100, remaining: 1400}); -}; + // No type transformation -() => { - // const tomato = {firstName: 'Tomato ', data: {elapsed: 100, remaining: 1400}, id:123}; - // const transformations = { - // firstName: R.trim, - // lastName: R.trim, // Will not get invoked. - // data: {elapsed: R.add(1), remaining: R.add(-1)} - // }; - // const a = R.evolve(transformations, tomato); // => {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123} - // const b = R.evolve(transformations)(tomato); // => {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123} + const a1 = R.evolve({ elapsed: R.add(1), remaining: R.add(-1) }, { name: "Tomato", elapsed: 100, remaining: 1400 }); + + const a1Test: { elapsed: number, remaining: number, name: string } = a1; + + const a2 = R.evolve({ elapsed: R.add(1), remaining: R.add(-1) })({ name: "Tomato", elapsed: 100, remaining: 1400 }); + + const a2Test: { elapsed: number, remaining: number, name: string } = a2; + + // Object doesn't have all evolver keys + + const a3 = R.evolve({ age: R.add(1), name: R.trim }, { name: "Potato", elapsed: 100 }); + + const a3Test: { name: string, elapsed: number } = a3; + + // Flat transformation + + const ex0 = R.evolve({ a: parseInt }, { a: '10', b: 1 }); + + const ex0Test: { a: number, b: number } = ex0; + + // Nested transformation: + + const ex1 = R.evolve( + { a: { b: R.toString, d: { e: R.toString } } }, + { a: { b: 1, c: null, d: { e: 2 } } }, + ); + + const ex1Test: { a: { b: string, c: null, d: { e: string } } } = ex1; + + // Mapping a nested object with a single function + + const ex2 = R.evolve( + { a: (obj: { foo: string }) => ({ bar: 1, baz: 2 }) }, + { a: { foo: 'a', skipped: 3 }, b: null }, + ); + + const ex2Test: { a: { bar: number, baz: number }, b: null } = ex2; + + // Nested curried: + + const ex3 = R.evolve( + { a: { b: R.toString, d: { e: R.toString } } }, + )( + { a: { b: 1, c: null, d: { e: 2 } } } + ); + + const ex3Test: { a: { b: string, c: null, d: { e: string } } } = ex3; }; () => { @@ -2417,3 +2453,7 @@ class Why { R.intersection([1, 2, 3], [2, 3, 3, 4]); // => [2, 3] R.intersection([1, 2, 3])([2, 3, 3, 4]); // => [2, 3] }; + +() => { + R.bind(console.log, console); +}; diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index aac9e1ea9f..1ec7cc1e26 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for rc-tree 1.10 +// Type definitions for rc-tree 1.11 // Project: https://github.com/react-component/tree // Definitions by: John Reilly , Methuselah96 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -41,6 +41,10 @@ export interface TreeNodeProps { * whether it is a leaf node */ isLeaf?: boolean; + /** + * customize icon. When you pass component, whose render will receive full TreeNode props as component props + */ + icon?: JSX.Element | ((props: InternalTreeNodeProps) => JSX.Element); } export class TreeNode extends Component { } @@ -65,6 +69,21 @@ export interface SelectData { event: "select"; } +export interface OnRightClickData { + event: Event; + node: InternalTreeNode; +} + +export interface OnMouseEnterData { + event: Event; + node: InternalTreeNode; +} + +export interface OnMouseLeaveData { + event: Event; + node: InternalTreeNode; +} + export interface OnDragStartData { event: Event; node: InternalTreeNode; @@ -76,6 +95,16 @@ export interface OnDragEnterData { expandedKeys: string[]; } +export interface OnDragOverData { + event: Event; + node: InternalTreeNode; +} + +export interface OnDragLeaveData { + event: Event; + node: InternalTreeNode; +} + export interface OnDropData { event: Event; node: InternalTreeNode; @@ -83,6 +112,11 @@ export interface OnDropData { dragNodesKeys: string[]; } +export interface OnDragEndData { + event: Event; + node: InternalTreeNode; +} + export interface TreeProps { /** * additional css class of root dom node @@ -92,6 +126,10 @@ export interface TreeProps { * prefix class */ prefixCls?: string; + /** + * whether disabled the tree + */ + disabled?: boolean; /** * whether show line */ @@ -124,6 +162,10 @@ export interface TreeProps { * control expanding of specific treeNodes */ expandedKeys?: string[]; + /** + * auto expand parent treeNodes when init + */ + defaultExpandParent?: boolean; /** * whether auto expand parent treeNodes */ @@ -146,6 +188,10 @@ export interface TreeProps { * default selected treeNodes */ defaultSelectedKeys?: string[]; + /** + * customize icon. When you pass component, whose render will receive full TreeNode props as component props + */ + icon?: JSX.Element | ((props: InternalTreeNodeProps) => JSX.Element); /** * Controlled selected treeNodes(After setting, defaultSelectedKeys will not work) */ @@ -170,6 +216,18 @@ export interface TreeProps { * load data asynchronously */ loadData?(node: InternalTreeNode): Promise; + /** + * select current treeNode and show customized contextmenu + */ + onRightClick?: (props: OnRightClickData) => void; + /** + * call when mouse enter a treeNode + */ + onMouseEnter?: (props: OnMouseEnterData) => void; + /** + * call when mouse leave a treeNode + */ + onMouseLeave?: (props: OnMouseLeaveData) => void; /** * whether can drag treeNode. */ @@ -182,10 +240,22 @@ export interface TreeProps { * event on drag enter */ onDragEnter?: (props: OnDragEnterData) => void; + /** + * it execs when fire the tree's dragover event + */ + onDragOver?: (props: OnDragOverData) => void; + /** + * it execs when fire the tree's dragleave event + */ + onDragLeave?: (props: OnDragLeaveData) => void; /** * event on drag drop */ onDrop?: (props: OnDropData) => void; + /** + * it execs when fire the tree's dragend event + */ + onDragEnd?: (props: OnDragEndData) => void; } export default class Tree extends Component { } diff --git a/types/react-aria-menubutton/index.d.ts b/types/react-aria-menubutton/index.d.ts index 52a77e7435..f7a4ef7de0 100644 --- a/types/react-aria-menubutton/index.d.ts +++ b/types/react-aria-menubutton/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-aria-menubutton 5.0 +// Type definitions for react-aria-menubutton 5.1 // Project: https://github.com/davidtheclark/react-aria-menubutton // Definitions by: Muhammad Fawwaz Orabi // Chris Rohlfs @@ -19,7 +19,7 @@ export interface WrapperProps * It will be passed the value of the selected `MenuItem` and * the React `SyntheticEvent`. */ - onSelection(value: any, event: React.SyntheticEvent): any; + onSelection?(value: any, event: React.SyntheticEvent): any; /** * A callback to run when the menu is opened or closed. diff --git a/types/react-collapsible/index.d.ts b/types/react-collapsible/index.d.ts new file mode 100644 index 0000000000..ad56aba34e --- /dev/null +++ b/types/react-collapsible/index.d.ts @@ -0,0 +1,37 @@ +// Type definitions for react-collapsible 2.2 +// Project: https://github.com/glennflanagan/react-collapsible#readme +// Definitions by: knegusen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; +export interface CollapsibleProp { + children?: string | React.ReactNode; + transitionTime?: number; + transitionCloseTime?: number; + triggerTagName?: string; + easing?: string; + open?: boolean; + classParentString?: string; + openedClassName?: string; + triggerStyle?: object; + triggerClassName?: string; + triggerOpenedClassName?: string; + contentOuterClassName?: string; + contentInnerClassName?: string; + accordionPosition?: string | number; + handleTriggerClick?: (accordionPosition?: string | number) => void; + onOpen?: () => void; + onClose?: () => void; + onOpening?: () => void; + onClosing?: () => void; + trigger?: string | React.ReactNode; + triggerWhenOpen?: string | React.ReactNode; + triggerDisabled?: boolean; + lazyRender?: boolean; + overflowWhenOpen?: 'hidden' | 'visible' | 'auto' | 'scroll' | 'inherit' | 'initial' | 'unset'; + triggerSibling?: React.ReactNode | string | (() => void); + tabIndex?: number; +} + +export default class Collapsible extends React.Component {} diff --git a/types/react-collapsible/react-collapsible-tests.tsx b/types/react-collapsible/react-collapsible-tests.tsx new file mode 100644 index 0000000000..69050d6b8c --- /dev/null +++ b/types/react-collapsible/react-collapsible-tests.tsx @@ -0,0 +1,17 @@ +import Collapsible from "react-collapsible"; +import * as React from "react"; + +const Component = ( +
+ +

+ This is the collapsible content. It can be any element or React + component you like. +

+

+ It can even be another Collapsible component. Check out the next + section! +

+
+
+); diff --git a/types/react-collapsible/tsconfig.json b/types/react-collapsible/tsconfig.json new file mode 100644 index 0000000000..a75a29a44a --- /dev/null +++ b/types/react-collapsible/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-collapsible-tests.tsx" + ] +} diff --git a/types/react-collapsible/tslint.json b/types/react-collapsible/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-collapsible/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-monaco-editor/index.d.ts b/types/react-monaco-editor/index.d.ts deleted file mode 100644 index f6245a82f4..0000000000 --- a/types/react-monaco-editor/index.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -// Type definitions for react-monaco-editor 0.10 -// Project: https://github.com/superRaytin/react-monaco-editor -// Definitions by: Joshua Netterfield -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 - -/// - -import * as React from "react"; - -export interface ReactMonacoEditorProps { - /** - * Width of editor. Defaults to 100%. - */ - width?: string | number; - - /** - * Height of editor. Defaults to 500. - */ - height?: string | number; - - /** - * Value of the auto created model in the editor. - * If you specify value property, the component behaves in controlled mode. Otherwise, it behaves in uncontrolled mode. - */ - value?: string; - - /** - * The initial value of the auto created model in the editor. - */ - defaultValue?: string; - - /** - * The initial language of the auto created model in the editor. Defaults to 'javascript'. - */ - language?: string; - - /** - * Theme to be used for rendering. - * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'. - * You can create custom themes via `monaco.editor.defineTheme`. - */ - theme?: string; - - /** - * Refer to Monaco interface IEditorOptions. - */ - options?: monaco.editor.IEditorOptions; - - /** - * An event emitted when the editor has been mounted (similar to componentDidMount of React). - */ - editorDidMount?(editor: monaco.editor.ICodeEditor, monacoModule: typeof monaco): void; - - /** - * An event emitted before the editor mounted (similar to componentWillMount of React). - */ - editorWillMount?(monacoModule: typeof monaco): void; - - /** - * An event emitted when the content of the current model has changed. - */ - onChange?(val: string, ev: monaco.editor.IModelContentChangedEvent): void; - - /** - * Optional, allow to config loader url and relative path of module, refer to require.config. - */ - requireConfig?: object; - - /** - * Optional, allow to pass a different context then the global window onto which the monaco instance will be loaded. Useful if you want to load the editor in an iframe. - */ - context?: object; -} - -export default class ReactMonacoEditor extends React.Component { - editor: monaco.editor.ICodeEditor; -} diff --git a/types/react-monaco-editor/package.json b/types/react-monaco-editor/package.json deleted file mode 100644 index c30b05905b..0000000000 --- a/types/react-monaco-editor/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "monaco-editor": "^0.10.0" - } -} diff --git a/types/react-monaco-editor/react-monaco-editor-tests.tsx b/types/react-monaco-editor/react-monaco-editor-tests.tsx deleted file mode 100644 index 0c46e4cfd8..0000000000 --- a/types/react-monaco-editor/react-monaco-editor-tests.tsx +++ /dev/null @@ -1,149 +0,0 @@ -// Adapted from https://github.com/superRaytin/react-monaco-editor/blob/master/examples/index.js - -import * as React from 'react'; -import { render } from 'react-dom'; -import MonacoEditor from 'react-monaco-editor'; - -interface CodeEditorState { - code?: string; -} - -// Using with webpack -class CodeEditor extends React.Component { - constructor(props: object) { - super(props); - this.state = { - code: '// type your code... \n', - }; - } - editor: monaco.editor.ICodeEditor; - editorDidMount = (editor: monaco.editor.ICodeEditor) => { - console.log('editorDidMount', editor, editor.getValue(), editor.getModel()); - this.editor = editor; - } - onChange = (newValue: string, e: monaco.editor.IModelContentChangedEvent) => { - console.log('onChange', newValue, e); - this.setState({ - code: newValue, - }); - } - changeEditorValue = () => { - if (this.editor) { - this.editor.setValue('// code changed! \n'); - } - } - changeBySetState = () => { - this.setState({code: '// code changed by setState! \n'}); - } - render() { - const code = this.state.code; - const options = { - selectOnLineNumbers: true, - roundedSelection: false, - readOnly: false, - theme: 'vs', - cursorStyle: 'line', - automaticLayout: false, - }; - return ( -
-
- - -
-
- -
- ); - } -} - -// Using with require.config -class AnotherEditor extends React.Component { - constructor(props: object) { - super(props); - const jsonCode = [ - '{', - ' "$schema": "http://myserver/foo-schema.json"', - "}" - ].join('\n'); - this.state = { - code: jsonCode, - }; - } - editorWillMount = (monacoModule: typeof monaco) => { - monacoModule.languages.json.jsonDefaults.setDiagnosticsOptions({ - schemas: [{ - uri: "http://myserver/foo-schema.json", - schema: { - type: "object", - properties: { - p1: { - enum: [ "v1", "v2"] - }, - p2: { - $ref: "http://myserver/bar-schema.json" - } - } - } - }, { - uri: "http://myserver/bar-schema.json", - schema: { - type: "object", - properties: { - q1: { - enum: [ "x1", "x2"] - } - } - } - }] - }); - } - render() { - const code = this.state.code; - const requireConfig = { - url: 'https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.1/require.min.js', - paths: { - vs: 'https://as.alipayobjects.com/g/cicada/monaco-editor-mirror/0.6.1/min/vs' - } - }; - return ( -
- -
- ); - } -} - -class App extends React.Component { - render() { - return ( -
-

Monaco Editor Sample (controlled mode)

- -
-

Another editor (uncontrolled mode)

- -
- ); - } -} - -render( - , - document.getElementById('root') -); diff --git a/types/react-native-auth0/index.d.ts b/types/react-native-auth0/index.d.ts index 153bfd65d9..1291baeafd 100644 --- a/types/react-native-auth0/index.d.ts +++ b/types/react-native-auth0/index.d.ts @@ -54,6 +54,7 @@ export interface PasswordRealmResponse { idToken: string; scope: string; tokenType: "Bearer"; + refreshToken?: string; } export interface RefreshTokenParams { diff --git a/types/react-native-auth0/react-native-auth0-tests.ts b/types/react-native-auth0/react-native-auth0-tests.ts index 3f659cbdee..08f8b0bc59 100644 --- a/types/react-native-auth0/react-native-auth0-tests.ts +++ b/types/react-native-auth0/react-native-auth0-tests.ts @@ -30,12 +30,19 @@ auth0.auth.logoutUrl({ returnTo: "http://localhost:3000" }); -auth0.auth.passwordRealm({ - username: "me@example.com", - password: "password", - realm: "realm", - audience: "user-info" -}); +auth0.auth + .passwordRealm({ + username: "me@example.com", + password: "password", + realm: "realm", + audience: "user-info" + }) + .then(res => { + if (res.refreshToken) { + return res.refreshToken; + } + return res.accessToken; + }); auth0.auth.refreshToken({ refreshToken: "refresh-token", diff --git a/types/react-native-multi-slider/index.d.ts b/types/react-native-multi-slider/index.d.ts new file mode 100644 index 0000000000..a3a5f39c63 --- /dev/null +++ b/types/react-native-multi-slider/index.d.ts @@ -0,0 +1,145 @@ +// Type definitions for react-native-multi-slider 0.3 +// Project: https://github.com/JackDanielsAndCode/react-native-multi-slider#readme +// Definitions by: Edward Sammut Alessi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; +import { ViewStyle } from "react-native"; + +export interface MarkerProps { + pressed?: number; + markerStyle?: ViewStyle; + pressedMarkerStyle?: ViewStyle; + value?: number; +} + +export interface MultiSliderProps { + /** + * An array containing one or two values (determines one or two markers respectively) that are the initial marker values. + * Note these must be possible values from your set up. + * + * Default [0] + */ + values?: number[]; + + /** + * Function to be called at beginning of press + */ + onValuesChangeStart?: () => void; + + /** + * Function called after every change in value, with current values passed in as an array. + */ + onValuesChange?: (change: number[]) => void; + + /** + * Function called on end of press with final values passed in as an array + */ + onValuesChangeFinish?: (change: number[]) => void; + + /** + * Width of track + * + * Default 280 + */ + sliderLength?: number; + + /** + * TODO + */ + sliderOrientation?: "horizontal" | "vertical"; + + /** + * Area to be touched, should enclose the whole marker. + * Will be automatically centered and contain the marker. + * Slip displacement If finger leaves the marker measures distance before responder cuts out and changes are no + * longer registered, if not given marker will be active until pressed released. + */ + touchDimensions?: { + height: number; + width: number; + borderRadius: number; + slipDisplacement: number; + }; + + customMarker?: React.ComponentType; + + /** + * Slider min value corresponding to far left + * + * Default 0 + */ + min?: number; + + /** + * Slider max value corresponding to far right + * + * Default 10 + */ + max?: number; + + /** + * The step size between values. Make sure min max range is divisible by this to get expected results + * + * Default 1 + */ + step?: number; + + /** + * Array of values corresponding to the slider's position (left to right on slider index 0 to end respectively). + * Values of any type can be inserted and the slider will simply give them back in the callbacks + */ + optionsArray?: number[]; + + /** + * Style of sliders container, note be careful in applying styles that may affect the children's (i.e. the slider's) positioning + * + * Default { height: 30 } + */ + containerStyle?: ViewStyle; + + /** + * Customise the track + * + * Default { borderRadius: 7, height: 3.5 } + */ + trackStyle?: ViewStyle; + + /** + * Style for the track up to a single marker or between double markers + * + * Default { backgroundColor: 'blue' } + */ + selectedStyle?: ViewStyle; + + /** + * Style for remaining track + * + * Default { backgroundColor: 'grey' } + */ + unselectedStyle?: ViewStyle; + + /** + * Customise the marker's style + * + * Default { + * height:30, + * width: 30, + * borderRadius: 15, + * backgroundColor:'#E8E8E8', + * borderWidth: 0.5, + * borderColor: 'grey', + * } + */ + markerStyle?: ViewStyle; + + /** + * Style to be given to marker when pressed + * + * Default { backgroundColor:'#D3D3D3' } + */ + pressedMarkerStyle?: ViewStyle; +} + +export default class MultiSlider extends React.Component {} diff --git a/types/react-native-multi-slider/react-native-multi-slider-tests.tsx b/types/react-native-multi-slider/react-native-multi-slider-tests.tsx new file mode 100644 index 0000000000..1bb7a3ad4f --- /dev/null +++ b/types/react-native-multi-slider/react-native-multi-slider-tests.tsx @@ -0,0 +1,68 @@ +import * as React from "react"; +import { View } from "react-native"; +import MultiSlider from "react-native-multi-slider"; + +class SliderTest extends React.Component { + getInitialState() { + return { + sliderOneChanging: false, + sliderOneValue: [ 5 ], + }; + } + + SliderOneValuesChangeStart() { + return true; + } + + SliderOneValuesChange(values: number[]) { + return values[0]; + } + + SliderOneValuesChangeFinish() { + return false; + } + + /** + * Examples as from https://github.com/JackDanielsAndCode/react-native-multi-slider/blob/master/index.ios.js + */ + render() { + return ( + + + + + + } + sliderLength={280} + /> + + ); + } +} diff --git a/types/react-native-multi-slider/tsconfig.json b/types/react-native-multi-slider/tsconfig.json new file mode 100644 index 0000000000..c67d12e21d --- /dev/null +++ b/types/react-native-multi-slider/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "jsx": "react-native", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-native-multi-slider-tests.tsx" + ] +} diff --git a/types/react-native-multi-slider/tslint.json b/types/react-native-multi-slider/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-multi-slider/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index e7e0451845..168db34cc5 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -3523,10 +3523,10 @@ declare class ImageComponent extends React.Component {} declare const ImageBase: Constructor & typeof ImageComponent; export class Image extends ImageBase { resizeMode: ImageResizeMode; - getSize(uri: string, success: (width: number, height: number) => void, failure: (error: any) => void): any; - prefetch(url: string): any; - abortPrefetch?(requestId: number): void; - queryCache?(urls: string[]): Promise>; + static getSize(uri: string, success: (width: number, height: number) => void, failure: (error: any) => void): any; + static prefetch(url: string): any; + static abortPrefetch?(requestId: number): void; + static queryCache?(urls: string[]): Promise>; } export interface ImageBackgroundProps extends ImagePropsBase { diff --git a/types/react-native/legacy-properties.d.ts b/types/react-native/legacy-properties.d.ts index eae30f65c7..ab87361485 100644 --- a/types/react-native/legacy-properties.d.ts +++ b/types/react-native/legacy-properties.d.ts @@ -1,5 +1,4 @@ import { - LayoutProps, TextProps, TextPropsIOS, TextPropsAndroid, @@ -77,9 +76,6 @@ declare module "react-native" { * The following lines ensure compatibility with *Properties and should be removed in the future */ - /** @deprecated Use LayoutProps */ - export type LayoutProperties = LayoutProps; - /** @deprecated Use TextProps */ export type TextProperties = TextProps; diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 35a194b0e7..f87ce26356 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -4,6 +4,7 @@ // Matt Martin // Eloy Durán // Nicolas Pirotte +// Cameron Knight // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -76,7 +77,7 @@ export const graphql: GraphqlInterface; export interface QueryRendererProps { cacheConfig?: RelayRuntimeTypes.CacheConfig; environment: RelayRuntimeTypes.Environment; - query: RelayRuntimeTypes.GraphQLTaggedNode; + query?: RelayRuntimeTypes.GraphQLTaggedNode | null; render(readyState: ReadyState): React.ReactElement | undefined | null; variables: RelayRuntimeTypes.Variables; rerunParamExperimental?: RelayRuntimeTypes.RerunParam; diff --git a/types/react-relay/test/react-relay-tests.tsx b/types/react-relay/test/react-relay-tests.tsx index cc25f5f368..bf3e2d1475 100644 --- a/types/react-relay/test/react-relay-tests.tsx +++ b/types/react-relay/test/react-relay-tests.tsx @@ -28,16 +28,16 @@ const modernEnvironment = new Environment({ network, store }); // ~~~~~~~~~~~~~~~~~~~~~ // Modern QueryRenderer // ~~~~~~~~~~~~~~~~~~~~~ -const MyQueryRenderer = (props: { name: string }) => ( +const MyQueryRenderer = (props: { name: string, show: boolean }) => ( ( /> ); +const MyEmptyQueryRenderer = () => ( + { + if (error) { + return
{error.message}
; + } else if (props) { + throw new Error('This code path should never be hit'); + } + return
Loading
; + }} + /> +); + // ~~~~~~~~~~~~~~~~~~~~~ // Modern RefetchContainer // ~~~~~~~~~~~~~~~~~~~~~ diff --git a/types/react-tooltip/index.d.ts b/types/react-tooltip/index.d.ts index e9690b8f5c..044e737402 100644 --- a/types/react-tooltip/index.d.ts +++ b/types/react-tooltip/index.d.ts @@ -39,7 +39,7 @@ declare namespace ReactTooltip { type ElementEvents = (keyof HTMLElementEventMap) | string; type WindowEvents = (keyof WindowEventMap) | string; - type GetContentCallback = () => React.ReactNode; + type GetContentCallback = (dataTip: string) => React.ReactNode; type GetContent = GetContentCallback | [GetContentCallback, number]; type Place = "top" | "right" | "bottom" | "left"; diff --git a/types/react-tooltip/react-tooltip-tests.tsx b/types/react-tooltip/react-tooltip-tests.tsx index 97b7a085ea..313804c901 100644 --- a/types/react-tooltip/react-tooltip-tests.tsx +++ b/types/react-tooltip/react-tooltip-tests.tsx @@ -8,7 +8,7 @@ export class ReactTooltipTest extends React.PureComponent { } render() { - const getContent: ReactTooltip.GetContent = [() => Math.floor(Math.random() * 100), 30]; + const getContent: ReactTooltip.GetContent = [dataTip => Math.floor(Math.random() * 100), 30]; return
; } } diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index b274430529..ecdcd1f420 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -284,6 +284,8 @@ export interface CartesianGridProps extends Partial { offset?: object; chartWidth?: number; chartHeight?: number; + horizontalFill?: string[]; + verticalFill?: string[]; } export class CartesianGrid extends React.Component { } diff --git a/types/recharts/recharts-tests.tsx b/types/recharts/recharts-tests.tsx index 39bcf69c89..7eed634119 100644 --- a/types/recharts/recharts-tests.tsx +++ b/types/recharts/recharts-tests.tsx @@ -96,7 +96,53 @@ class Component extends React.Component<{}, ComponentState> { - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/types/rmfr/index.d.ts b/types/rmfr/index.d.ts new file mode 100644 index 0000000000..fc7c608e81 --- /dev/null +++ b/types/rmfr/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for rmfr 2.0 +// Project: https://github.com/shinnn/rmfr#readme +// Definitions by: Alan Plum +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import rimraf = require("rimraf"); + +declare namespace rmfr { + type Options = rimraf.Options & { + glob?: rimraf.Options["glob"] | true; + disableGlob?: never; + }; +} +declare function rmfr(path: string, options?: rmfr.Options): Promise; + +export = rmfr; diff --git a/types/rmfr/rmfr-tests.ts b/types/rmfr/rmfr-tests.ts new file mode 100644 index 0000000000..efec2dd480 --- /dev/null +++ b/types/rmfr/rmfr-tests.ts @@ -0,0 +1,39 @@ +import rmfr = require("rmfr"); + +(async () => { + // happy + await rmfr("tmp_file"); + await rmfr("tmp_d*", {}); + await rmfr("../{tmp_d*,test.js}", { + glob: { + cwd: "node_modules", + ignore: "some_filename" + } + }); + await rmfr("test.js", { + glob: { + cwd: "this/directory/does/not/exist" + } + }); + + // $ExpectError + await rmfr(".gitignore", { unlink: (path, cb) => cb(new Error()) }); + // $ExpectError + await rmfr(); + // $ExpectError + await rmfr("<", { o: "O" }, "/"); + // $ExpectError + await rmfr(["1"], { glob: true }); + // $ExpectError + await rmfr("foo", 1); + // $ExpectError + await rmfr("foo", { chmod: new Set(["a"]) }); + // $ExpectError + await rmfr("foo", { + maxBusyTries: "foo", + emfileWait: "bar", + glob: "baz" + }); + // $ExpectError + await rmfr("foo", { disableGlob: true }); +})(); diff --git a/types/rmfr/tsconfig.json b/types/rmfr/tsconfig.json new file mode 100644 index 0000000000..cbe39dd006 --- /dev/null +++ b/types/rmfr/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "rmfr-tests.ts"] +} diff --git a/types/rmfr/tslint.json b/types/rmfr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rmfr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index cc4bef61ba..c847c073b8 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3366,6 +3366,13 @@ declare namespace sequelize { * Throw EmptyResultError if a record is not found */ rejectOnEmpty?: boolean; + + /** + * Force the query to use the write pool + * + * Defaults to false + */ + useMaster?: boolean; } type AnyFindOptions = FindOptions; @@ -4085,6 +4092,15 @@ declare namespace sequelize { /** * Set associations with other models * + * Not part of the sequelize API, used as convention to associate models after creation. e.g.: + * ```js + * Object.keys(models).forEach(modelName => { + * if (models[modelName].associate) { + * models[modelName].associate(models); + * } + * }); + * ``` + * * @param models */ associate?(models: Models): void; diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index bc600c961d..3d2bbdfe05 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1523,6 +1523,13 @@ s.define( 'ScopeMe', { } } ); +// Test convention method used to associate models after creation +Object.keys(s.models).forEach(modelName => { + if (s.models[modelName].associate) { + s.models[modelName].associate(s.models); + } +}); + // Generic find options interface ChairAttributes { id: number; diff --git a/types/shelljs/index.d.ts b/types/shelljs/index.d.ts index 601668f65f..1f1eb5c375 100644 --- a/types/shelljs/index.d.ts +++ b/types/shelljs/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for ShellJS 0.7 +// Type definitions for ShellJS 0.8 // Project: http://shelljs.org // Definitions by: Niklas Mollenhauer // Vojtech Jasny // George Kalpakas +// Paul Huynh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -11,10 +12,10 @@ import child = require("child_process"); import glob = require("glob"); /** - * Changes to directory dir for the duration of the script + * Changes to directory dir for the duration of the script. Changes to home directory if no argument is supplied. * @param dir Directory to change in. */ -export function cd(dir: string): void; +export function cd(dir?: string): void; /** * Returns the current directory. @@ -31,7 +32,7 @@ export function ls(...paths: Array): ShellArray; /** * Returns array of files in the given path, or in current directory if no path provided. - * @param options Available options: -R (recursive), -A (all files, include files beginning with ., except for . and ..) + * @param options Available options: -R: recursive -A: all files (include files beginning with ., except for . and ..) -L: follow symlinks -d: list directories themselves, not their contents -l: list objects representing each file, each with fields containing ls -l output fields. See fs.Stats for more info * @param ...paths Paths to search. * @return An array of files in the given path(s). */ @@ -53,7 +54,7 @@ export function cp(source: string | string[], dest: string): void; /** * Copies files. The wildcard * is accepted. - * @param options Available options: -f (force), -r, -R (recursive) + * @param options Available options: -f: force (default behavior) -n: no-clobber -u: only copy if source is newer than dest -r, -R: recursive -L: follow symlinks -P: don't follow symlinks * @param source The source. * @param dest The destination. */ @@ -79,6 +80,14 @@ export function rm(options: string, ...files: Array): void; */ export function mv(source: string | string[], dest: string): void; +/** + * Moves files. The wildcard * is accepted. + * @param options Available options: -f: force (default behavior) -n: no-clobber + * @param source The source. + * @param dest The destination. + */ +export function mv(options: string, source: string | string[], dest: string): void; + /** * Creates directories. * @param ...dir Directories to create. @@ -138,7 +147,7 @@ export function grep(regex_filter: string | RegExp, ...files: Array any; export interface ExecOptions extends child.ExecOptions { + /** Do not echo program output to console (default: false). */ silent?: boolean; + /** Asynchronous execution. If a callback is provided, it will be set to true, regardless of the passed value (default: false). */ async?: boolean; + /** Character encoding to use. Affects the values returned to stdout and stderr, and what is written to stdout and stderr when not in silent mode (default: 'utf8'). */ + encoding?: string; } export interface ExecOutputReturnValue { @@ -440,6 +461,47 @@ export function touch(files: string[]): void; export function touch(options: TouchOptionsLiteral, ...files: Array): void; export function touch(options: TouchOptionsArray, ...files: Array): void; +export interface HeadOptions { + /** Show the first lines of the files. */ + '-n': number; +} + +/** Read the start of a file. */ +export function head(...files: Array): ShellString; +/** Read the start of a file. */ +export function head(options: HeadOptions, ...files: Array): ShellString; + +/** + * Return the contents of the files, sorted line-by-line. Sorting multiple files mixes their content (just as unix sort does). + */ +export function sort(...files: Array): ShellString; + +/** + * Return the contents of the files, sorted line-by-line. Sorting multiple files mixes their content (just as unix sort does). + * @param options Available options: -r: Reverse the results -n: Compare according to numerical value + */ +export function sort(options: string, ...files: Array): ShellString; + +export interface TailOptions { + /** Show the last lines of files. */ + '-n': number; +} + +/** Read the end of a file. */ +export function tail(...files: Array): ShellString; +/** Read the end of a file. */ +export function tail(options: TailOptions, ...files: Array): ShellString; + +/** + * Filter adjacent matching lines from input. + */ +export function uniq(input: string, output?: string): ShellString; +/** + * Filter adjacent matching lines from input. + * @param options Available options: -i: Ignore case while comparing -c: Prefix lines by the number of occurrences -d: Only print duplicate lines, one for each group of identical lines + */ +export function uniq(options: string, input: string, output?: string): ShellString; + /** * Sets global configuration variables * @param options Available options: `+/-e`: exit upon error (`config.fatal`), `+/-v`: verbose: show all commands (`config.verbose`), `+/-f`: disable filename expansion (globbing) diff --git a/types/shelljs/shelljs-tests.ts b/types/shelljs/shelljs-tests.ts index da3175f5c6..37dccddff6 100644 --- a/types/shelljs/shelljs-tests.ts +++ b/types/shelljs/shelljs-tests.ts @@ -135,6 +135,21 @@ shell.touch({ '-r': '/some/file.txt' }, '/Users/brandom/test1'); shell.touch({ '-r': '/some/file.txt' }, '/Users/brandom/test1', '/Users/brandom/test2'); shell.touch({ '-r': '/oome/file.txt' }, ['/Users/brandom/test1', '/Users/brandom/test2']); +shell.head({'-n': 1}, 'file*.txt'); +shell.head('file1', 'file2'); +shell.head(['file1', 'file2']); // same as above + +shell.sort('foo.txt', 'bar.txt'); +shell.sort('-r', 'foo.txt'); + +shell.tail({'-n': 1}, 'file*.txt'); +shell.tail('file1', 'file2'); +shell.tail(['file1', 'file2']); // same as above + +shell.uniq('foo.txt'); +shell.uniq('-i', 'foo.txt'); +shell.uniq('-cd', 'foo.txt', 'bar.txt'); + const tmp = shell.tempdir(); // "/tmp" for most *nix platforms const errorlol = shell.error(); diff --git a/types/should-sinon/index.d.ts b/types/should-sinon/index.d.ts index 25233c1c61..467d217aa9 100644 --- a/types/should-sinon/index.d.ts +++ b/types/should-sinon/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/shouldjs/sinon // Definitions by: AryloYeung // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as s from "sinon"; import should = require("should"); diff --git a/types/sinon-as-promised/index.d.ts b/types/sinon-as-promised/index.d.ts index 097e13a1a0..49e9b29bd3 100644 --- a/types/sinon-as-promised/index.d.ts +++ b/types/sinon-as-promised/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/bendrucker/sinon-as-promised // Definitions by: igrayson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as s from "sinon"; diff --git a/types/sinon-chai/index.d.ts b/types/sinon-chai/index.d.ts index 8c6d7eb2d0..cff6d0b3a2 100644 --- a/types/sinon-chai/index.d.ts +++ b/types/sinon-chai/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/domenic/sinon-chai // Definitions by: Kazi Manzur Rashid , Jed Mao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// /// diff --git a/types/sinon-chrome/index.d.ts b/types/sinon-chrome/index.d.ts index 263135e060..9776b0bb30 100644 --- a/types/sinon-chrome/index.d.ts +++ b/types/sinon-chrome/index.d.ts @@ -4,7 +4,7 @@ // CRIMX // kobanyan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.8 /// /// diff --git a/types/sinon-express-mock/index.d.ts b/types/sinon-express-mock/index.d.ts index 10c8ef824d..f3974fc005 100644 --- a/types/sinon-express-mock/index.d.ts +++ b/types/sinon-express-mock/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Jared Chapiewsky // Tomek Łaziuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import { SinonStub, diff --git a/types/sinon-mongoose/index.d.ts b/types/sinon-mongoose/index.d.ts index 2d9099a060..86109b4917 100644 --- a/types/sinon-mongoose/index.d.ts +++ b/types/sinon-mongoose/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/underscopeio/sinon-mongoose // Definitions by: stevehipwell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as s from "sinon"; diff --git a/types/sinon-stub-promise/index.d.ts b/types/sinon-stub-promise/index.d.ts index 6de3b17b2a..d817113cf7 100644 --- a/types/sinon-stub-promise/index.d.ts +++ b/types/sinon-stub-promise/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Thiago Temple // Tim Stackhouse // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// diff --git a/types/sinon-test/index.d.ts b/types/sinon-test/index.d.ts index 4cda8702a6..902064a7cb 100644 --- a/types/sinon-test/index.d.ts +++ b/types/sinon-test/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/sinonjs/sinon-test // Definitions by: Francis Saul // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as Sinon from 'sinon'; diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index 2395ee2ed2..4bdf3272ee 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -1,12 +1,13 @@ -// Type definitions for Sinon 4.3 +// Type definitions for Sinon 5.0 // Project: http://sinonjs.org/ // Definitions by: William Sears // Jonathan Little // Lukas Spieß // Nico Jansen // James Garbutt +// Josh Goldberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 // sinon uses DOM dependencies which are absent in browser-less environment like node.js // to avoid compiler errors this monkey patch is used @@ -17,15 +18,13 @@ interface Document { } // tslint:disable-line no-empty-interface declare namespace Sinon { interface SinonSpyCallApi { // Properties - thisValue: any; args: any[]; - exception: any; - returnValue: any; // Methods calledOn(obj: any): boolean; calledWith(...args: any[]): boolean; calledWithExactly(...args: any[]): boolean; + calledWithNew(): boolean; calledOnceWith(...args: any[]): boolean; calledOnceWithExactly(...args: any[]): boolean; calledWithMatch(...args: any[]): boolean; @@ -46,9 +45,14 @@ declare namespace Sinon { } interface SinonSpyCall extends SinonSpyCallApi { + thisValue: any; + exception: any; + returnValue: any; + callback: Function | undefined; + lastArg: any; + calledBefore(call: SinonSpyCall): boolean; calledAfter(call: SinonSpyCall): boolean; - calledWithNew(call: SinonSpyCall): boolean; } interface SinonSpy extends SinonSpyCallApi { @@ -74,7 +78,6 @@ declare namespace Sinon { calledAfter(anotherSpy: SinonSpy): boolean; calledImmediatelyBefore(anotherSpy: SinonSpy): boolean; calledImmediatelyAfter(anotherSpy: SinonSpy): boolean; - calledWithNew(): boolean; withArgs(...args: any[]): SinonSpy; alwaysCalledOn(obj: any): boolean; alwaysCalledWith(...args: any[]): boolean; @@ -89,8 +92,6 @@ declare namespace Sinon { invokeCallback(...args: any[]): void; getCall(n: number): SinonSpyCall; getCalls(): SinonSpyCall[]; - /// @deprecated Use resetHistory() instead - reset(): void; resetHistory(): void; printf(format: string, ...args: any[]): string; restore(): void; @@ -102,13 +103,9 @@ declare namespace Sinon { (obj: T, method: keyof T): SinonSpy; } - interface SinonStatic { - spy: SinonSpyStatic; - } - interface SinonStub extends SinonSpy { resetBehavior(): void; - resetHistory(): void; + reset(): void; usingPromise(promiseLibrary: any): SinonStub; returns(obj: any): SinonStub; @@ -132,7 +129,7 @@ declare namespace Sinon { callsArgOnAsync(index: number, context: any): SinonStub; callsArgWithAsync(index: number, ...args: any[]): SinonStub; callsArgOnWithAsync(index: number, context: any, ...args: any[]): SinonStub; - callsFake(func: (...args: any[]) => void): SinonStub; + callsFake(func: (...args: any[]) => any): SinonStub; get(func: () => any): SinonStub; set(func: (v: any) => void): SinonStub; onCall(n: number): SinonStub; @@ -156,11 +153,6 @@ declare namespace Sinon { (): SinonStub; (obj: T): SinonStubbedInstance; (obj: T, method: keyof T): SinonStub; - (obj: T, method: keyof T, func: Function): SinonStub; - } - - interface SinonStatic { - stub: SinonStubStatic; } interface SinonExpectation extends SinonStub { @@ -193,23 +185,29 @@ declare namespace Sinon { (obj: any): SinonMock; } - interface SinonStatic { - expectation: SinonExpectationStatic; - mock: SinonMockStatic; - } + type SinonTimerId = number | { id: number }; interface SinonFakeTimers { now: number; - create(now: number): SinonFakeTimers; - setTimeout(callback: (...args: any[]) => void, timeout: number, ...args: any[]): number; - clearTimeout(id: number): void; - setInterval(callback: (...args: any[]) => void, timeout: number, ...args: any[]): number; - clearInterval(id: number): void; - tick(ms: number): number; + + setTimeout(callback: (...args: any[]) => void, timeout: number, ...args: any[]): SinonTimerId; + clearTimeout(id: SinonTimerId): void; + setInterval(callback: (...args: any[]) => void, timeout: number, ...args: any[]): SinonTimerId; + clearInterval(id: SinonTimerId): void; + setImmediate(callback: (...args: any[]) => void, ...args: any[]): SinonTimerId; + clearImmediate(id: SinonTimerId): void; + requestAnimationFrame(callback: (...args: any[]) => void): number; + cancelAnimationFrame(id: number): void; + nextTick(callback: () => void): void; + + tick(ms: number | string): void; next(): void; runAll(): void; runToLast(): void; reset(): void; + runMicrotasks(): void; + runToFrame(): void; + Date(): Date; Date(year: number): Date; Date(year: number, month: number): Date; @@ -218,7 +216,9 @@ declare namespace Sinon { Date(year: number, month: number, day: number, hour: number, minute: number): Date; Date(year: number, month: number, day: number, hour: number, minute: number, second: number): Date; Date(year: number, month: number, day: number, hour: number, minute: number, second: number, ms: number): Date; + restore(): void; + uninstall(): void; /** * Simulate the user changing the system clock while your program is running. It changes the 'now' timestamp @@ -240,16 +240,6 @@ declare namespace Sinon { shouldAdvanceTime: boolean; } - interface SinonFakeTimersStatic { - (now?: number | Date): SinonFakeTimers; - (config?: Partial): SinonFakeTimers; - } - - interface SinonStatic { - useFakeTimers: SinonFakeTimersStatic; - clock: SinonFakeTimers; - } - interface SinonFakeUploadProgress { eventListeners: { progress: any[]; @@ -265,7 +255,6 @@ declare namespace Sinon { interface SinonFakeXMLHttpRequest { // Properties - onCreate(xhr: SinonFakeXMLHttpRequest): void; url: string; method: string; requestHeaders: any; @@ -283,8 +272,6 @@ declare namespace Sinon { // Methods restore(): void; - useFilters: boolean; - addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void; setResponseHeaders(headers: any): void; setResponseBody(body: string): void; respond(status: number, headers: any, body: string): void; @@ -293,11 +280,11 @@ declare namespace Sinon { onerror(): void; } - type SinonFakeXMLHttpRequestStatic = () => SinonFakeXMLHttpRequest; - - interface SinonStatic { - useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; - FakeXMLHttpRequest: SinonFakeXMLHttpRequest; + interface SinonFakeXMLHttpRequestStatic { + new(): SinonFakeXMLHttpRequest; + useFilters: boolean; + addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void; + onCreate(xhr: SinonFakeXMLHttpRequest): void; } interface SinonFakeServer extends SinonFakeServerOptions { @@ -326,24 +313,19 @@ declare namespace Sinon { } interface SinonFakeServerOptions { - autoRespond?: boolean; - autoRespondAfter?: number; - fakeHTTPMethods?: boolean; - respondImmediately?: boolean; + autoRespond: boolean; + autoRespondAfter: number; + fakeHTTPMethods: boolean; + respondImmediately: boolean; } interface SinonFakeServerStatic { - create(options?: SinonFakeServerOptions): SinonFakeServer; - } - - interface SinonStatic { - fakeServer: SinonFakeServerStatic; - fakeServerWithClock: SinonFakeServerStatic; + create(options?: Partial): SinonFakeServer; } interface SinonExposeOptions { - prefix?: string; - includeFail?: boolean; + prefix: string; + includeFail: boolean; } interface SinonAssert { @@ -378,16 +360,13 @@ declare namespace Sinon { alwaysThrew(spy: SinonSpy, exception: string): void; alwaysThrew(spy: SinonSpy, exception: any): void; match(actual: any, expected: any): void; - expose(obj: any, options?: SinonExposeOptions): void; - } - - interface SinonStatic { - assert: SinonAssert; + expose(obj: any, options?: Partial): void; } interface SinonMatcher { and(expr: SinonMatcher): SinonMatcher; or(expr: SinonMatcher): SinonMatcher; + test(val: any): boolean; } interface SinonArrayMatcher extends SinonMatcher { @@ -443,8 +422,8 @@ declare namespace Sinon { (value: number): SinonMatcher; (value: string): SinonMatcher; (expr: RegExp): SinonMatcher; - (obj: any): SinonMatcher; (callback: (value: any) => boolean, message?: string): SinonMatcher; + (obj: object): SinonMatcher; any: SinonMatcher; defined: SinonMatcher; truthy: SinonMatcher; @@ -474,86 +453,16 @@ declare namespace Sinon { instanceOf(type: any): SinonMatcher; has(property: string, expect?: any): SinonMatcher; hasOwn(property: string, expect?: any): SinonMatcher; - } - - interface SinonStatic { - match: SinonMatch; + hasNested(path: string, expect?: any): SinonMatcher; + every(matcher: SinonMatcher): SinonMatcher; + some(matcher: SinonMatcher): SinonMatcher; } interface SinonSandboxConfig { - injectInto?: any; - properties?: string[]; - useFakeTimers?: any; - useFakeServer?: any; - } - - interface SinonSandbox { - assert: SinonAssert; - clock: SinonFakeTimers; - requests: SinonFakeXMLHttpRequest; - server: SinonFakeServer; - spy: SinonSpyStatic; - stub: SinonStubStatic; - mock: SinonMockStatic; - useFakeTimers: SinonFakeTimersStatic; - useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; - useFakeServer(): SinonFakeServer; - restore(): void; - reset(): void; - resetHistory(): void; - resetBehavior(): void; - usingPromise(promiseLibrary: any): SinonSandbox; - verify(): void; - verifyAndRestore(): void; - createStubInstance(constructor: any): any; - createStubInstance(constructor: StubbableType): SinonStubbedInstance; - } - - interface SinonSandboxStatic { - create(config?: SinonSandboxConfig): SinonSandbox; - } - - interface SinonStatic { - createSandbox(config?: SinonSandboxConfig): SinonSandbox; - defaultConfig: SinonSandboxConfig; - sandbox: SinonSandboxStatic; - } - - interface SinonTestConfig { - injectIntoThis?: boolean; - injectInto?: any; - properties?: string[]; - useFakeTimers?: boolean; - useFakeServer?: boolean; - } - - interface SinonTestWrapper extends SinonSandbox { - (...args: any[]): any; - } - - // Utility overridables - interface SinonStatic { - /** - * Creates a new object with the given functions as the prototype and stubs all implemented functions. - * - * @param constructor Object or class to stub. - * @returns A stubbed version of the constructor. - * @remarks The given constructor function is not invoked. See also the stub API. - */ - createStubInstance(constructor: any): any; - - /** - * Creates a new object with the given functions as the prototype and stubs all implemented functions. - * - * @template TType Type being stubbed. - * @param constructor Object or class to stub. - * @returns A stubbed version of the constructor. - * @remarks The given constructor function is not invoked. See also the stub API. - */ - createStubInstance(constructor: StubbableType): SinonStubbedInstance; - - format(obj: any): string; - restore(object: any): void; + injectInto: object | null; + properties: string[]; + useFakeTimers: boolean | Partial; + useFakeServer: boolean | SinonFakeServer; } /** @@ -566,15 +475,103 @@ declare namespace Sinon { } /** - * An instance of a stubbed object type with members replaced by stubs. + * An instance of a stubbed object type with functions replaced by stubs. * * @template TType Object type being stubbed. */ type SinonStubbedInstance = { - // TODO: this should really only replace functions on TType with SinonStubs, not all properties - // Likely infeasible without mapped conditional types, per https://github.com/Microsoft/TypeScript/issues/12424 - [P in keyof TType]: SinonStub; + [P in keyof TType]: SinonStubbedMember; }; + + /** + * Replaces a type with a Sinon stub if it's a function. + */ + type SinonStubbedMember = T extends Function ? SinonStub : T; + + interface SinonFake { + (): SinonSpy; + (fn: Function): SinonSpy; + returns(val: any): SinonSpy; + throws(val: Error | string): SinonSpy; + resolves(val: any): SinonSpy; + rejects(val: any): SinonSpy; + yields(...args: any[]): SinonSpy; + yieldsAsync(...args: any[]): SinonSpy; + } + + interface SinonSandbox { + assert: SinonAssert; + clock: SinonFakeTimers; + requests: SinonFakeXMLHttpRequest[]; + server: SinonFakeServer; + spy: SinonSpyStatic; + stub: SinonStubStatic; + mock: SinonMockStatic; + + useFakeTimers(config?: number | Date | Partial): SinonFakeTimers; + useFakeXMLHttpRequest(): SinonFakeXMLHttpRequestStatic; + useFakeServer(): SinonFakeServer; + restore(): void; + reset(): void; + resetHistory(): void; + resetBehavior(): void; + usingPromise(promiseLibrary: any): SinonSandbox; + verify(): void; + verifyAndRestore(): void; + + replace( + obj: T, + prop: TKey, + replacement: T[TKey]): T[TKey]; + replaceGetter( + obj: T, + prop: TKey, + replacement: () => T[TKey]): () => T[TKey]; + replaceSetter( + obj: T, + prop: TKey, + replacement: (val: T[TKey]) => void): (val: T[TKey]) => void; + + /** + * Creates a new object with the given functions as the prototype and stubs all implemented functions. + * + * @template TType Type being stubbed. + * @param constructor Object or class to stub. + * @returns A stubbed version of the constructor. + * @remarks The given constructor function is not invoked. See also the stub API. + */ + createStubInstance(constructor: StubbableType): SinonStubbedInstance; + } + + interface SinonApi { + fake: SinonFake; + match: SinonMatch; + spyCall(...args: any[]): SinonSpyCall; + expectation: SinonExpectationStatic; + + clock: { + create(now: number | Date): SinonFakeTimers; + }; + + FakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; + + fakeServer: SinonFakeServerStatic; + fakeServerWithClock: SinonFakeServerStatic; + + createSandbox(config?: Partial): SinonSandbox; + defaultConfig: Partial; + } + + interface LegacySandbox { + sandbox: { + /** + * @deprecated Since 5.0, use `sinon.createSandbox` instead + */ + create(config?: Partial): SinonSandbox; + }; + } + + type SinonStatic = SinonSandbox & LegacySandbox & SinonApi; } declare const Sinon: Sinon.SinonStatic; diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index 17e8cc6084..0a88a4eeba 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -1,317 +1,437 @@ import sinon = require("sinon"); -function once(fn: Function) { - let called = false; - let returnValue: any; - - return function(this: any) { - if (!called) { - called = true; - returnValue = fn.apply(this, arguments); - } - return returnValue; - }; -} - -function testOne() { - const callback = sinon.spy(); - const proxy = once(callback); - proxy(); - if (callback.calledOnce) { console.log("test1 calledOnce success"); } else { console.log("test1 calledOnce failure"); } -} - -function testTwo() { - const callback = sinon.spy(() => { }); - const proxy = once(callback); - proxy(); - proxy(); - if (callback.calledOnce) { console.log("test2 calledOnce success"); } else { console.log("test2 calledOnce failure"); } -} - -function testThree() { - const obj = { thisObj: true }; - const callback = sinon.spy({}, "method"); - const proxy = once(callback); - proxy.call(obj, callback, 1, 2, 3); - if (callback.calledOn(obj)) { console.log("test3 calledOn success"); } else { console.log("test3 calledOn failure"); } - if (callback.calledWith(callback, 1, 2, 3)) { console.log("test3 calledWith success"); } else { console.log("test3 calledWith failure"); } -} - -function testFour() { - const callback = sinon.stub().returns(42); - const proxy = once(callback); - const val = proxy.apply(callback, [1, 2, 3]); - if (val === 42) { console.log("test4 returns success"); } else { console.log("test4 returns failure"); } -} - -function testFive() { - const callback = sinon.stub().returnsArg(1); - const proxy = once(callback); - const val = proxy.apply(callback, [1, 2, 3]); - if (val === 2) { console.log("test5 returnsArg success"); } else { console.log("test5 returnsArg failure"); } -} - -const objectUnderTest: any = { - process: (obj: any) => { - // It doesn't really matter what's here because the stub is going to replace this function - return obj.success(99); - } -}; - -function testSix() { - const stub = sinon.stub(objectUnderTest, "process").yieldsTo("success"); - objectUnderTest.process({ - success: () => { console.log("test6 yieldsTo success"); }, - failure: () => { console.log("test6 yieldsTo failure"); } - }); - stub.restore(); -} - -function testSeven() { - const obj = { functionToTest: () => { } }; - const mockObj = sinon.mock(obj); - obj.functionToTest(); - mockObj.expects('functionToTest').once(); -} - -function testEight() { - sinon.match.typeOf("object").and(sinon.match.has("pages")); -} - -function testNine() { - const callback = sinon.stub().returns(42); - callback({ x: 5, y: 5 }); - callback.calledWithMatch({ x: 5 }); - callback.alwaysCalledWithMatch({ y: 5 }); - callback.neverCalledWithMatch({ x: 6 }); - callback.notCalledWithMatch({ x: 6 }); - callback.calledOnceWith({ x: 5, y: 5 }); - callback.calledOnceWithExactly({ x: 5, y: 5 }); - sinon.assert.calledWithMatch(callback, { x: 5 }); - sinon.assert.alwaysCalledWithMatch(callback, { y: 5 }); - sinon.assert.neverCalledWithMatch(callback, { x: 6 }); - - callback.call("this", "that"); - callback.throws("Error"); - try { - callback(15); - } catch (e) { } - sinon.assert.calledWith(callback.firstCall, { x: 5, y: 5}); - sinon.assert.calledWithExactly(callback.firstCall, { x: 5, y: 5 }); - sinon.assert.calledWithMatch(callback.firstCall, { x: 5 }); - sinon.assert.calledOn(callback.secondCall, "this"); - sinon.assert.threw(callback.thirdCall); - sinon.assert.threw(callback.thirdCall, "Error"); - new (callback as any)(); - sinon.assert.calledWithNew(callback); - sinon.assert.calledWithNew(callback.getCall(4)); -} - -function testAssert() { - sinon.assert.match(1, 1 + 1); - sinon.assert.match("abc", "abc"); - sinon.assert.match({ a: 1 }, { b: 2, c: "abc" }); -} - function testSandbox() { - const config = { - injectInto: null, - properties: ["spy", "stub", "mock", "clock", "server", "requests"], - useFakeServer: true, + const obj = {}; + + sinon.createSandbox({ + injectInto: obj, + properties: ['spy', 'stub'], useFakeTimers: true, - }; - - let sandbox = sinon.sandbox.create(); - sandbox = sinon.sandbox.create(config); - sandbox = sinon.sandbox.create(sinon.defaultConfig); - - sandbox = sinon.createSandbox(); - sandbox = sinon.createSandbox(config); - sandbox = sinon.createSandbox(sinon.defaultConfig); - - sandbox = sandbox.usingPromise(Promise); - - sandbox.assert.notCalled(sinon.spy()); - - if (sandbox.spy().called) { - sandbox.stub(objectUnderTest, "process").yieldsTo("success"); - sandbox.mock(objectUnderTest).expects("process").once(); - } - sandbox.useFakeTimers(); - sandbox.useFakeTimers({ - now: 1, - toFake: ['Date'] + useFakeServer: true }); - sandbox.useFakeXMLHttpRequest(); - sandbox.useFakeServer(); - sandbox.restore(); - sandbox.reset(); - sandbox.resetHistory(); - sandbox.resetBehavior(); - sandbox.verify(); - sandbox.verifyAndRestore(); - sandbox.createStubInstance(TestCreateStubInstance).someTestMethod('some argument'); - sandbox.createStubInstance(TestCreateStubInstance).someTestMethod('some argument'); -} + sinon.createSandbox({ + injectInto: null + }); + sinon.createSandbox({ + useFakeTimers: { + now: 1000, + shouldAdvanceTime: false + }, + useFakeServer: sinon.fakeServer.create() + }); + sinon.createSandbox(sinon.defaultConfig); + sinon.sandbox.create(); + sinon.sandbox.create(sinon.defaultConfig); -function testPromises() { - let resolveStub = sinon.stub().resolves(); - resolveStub = sinon.stub().resolves(10); - const rejectStub1 = sinon.stub().rejects(); - let rejectsStub2 = sinon.stub().rejects(new Error('Specified error')); - rejectsStub2 = sinon.stub().rejects("TypeError"); -} + const sb = sinon.createSandbox(); -function testMatchInvoke() { - const stub = sinon.stub(); - stub(123); - stub.calledWithMatch(sinon.match(123)); - stub.calledWithMatch(sinon.match((value: any) => value === 123)); - stub.calledWithMatch(sinon.match((value: any) => value === 123, "Must be 123")); -} + sb.assert.pass('foo'); + sb.clock.tick(1000); + sb.spy(); + sb.stub(); + sb.mock(obj); -function testSymbolMatch() { - const stub = sinon.stub(); - stub(Symbol('TestSymbol')); - stub.calledWithMatch(sinon.match.symbol); -} + sb.useFakeTimers(); + sb.useFakeTimers(1000); + sb.useFakeTimers(new Date()); + sb.useFakeTimers({ + now: 1000 + }); -function testResetHistory() { - sinon.stub().resetHistory(); - sinon.spy().resetHistory(); -} + const xhr = sb.useFakeXMLHttpRequest(); + xhr.useFilters = true; -function testUsingPromises() { - const stub: sinon.SinonStub = sinon.stub().usingPromise(Promise); -} + const server = sb.useFakeServer(); + server.respondWith('foo'); -function testArrayMatchers() { - const stub = sinon.stub(); - stub([{ a: 'b' }]); - stub.calledWithMatch(sinon.match.array); - stub.calledWithMatch(sinon.match.array.deepEquals([{ a: 'b' }])); - stub.calledWithMatch(sinon.match.array.startsWith([{ a: 'b' }])); - stub.calledWithMatch(sinon.match.array.deepEquals([{ a: 'b' }])); - stub.calledWithMatch(sinon.match.array.contains([{ a: 'b' }])); -} + sb.restore(); + sb.reset(); + sb.resetHistory(); + sb.resetBehavior(); + sb.usingPromise(Promise); + sb.verify(); + sb.verifyAndRestore(); -function testMapMatcher() { - const stub = sinon.stub(); - stub(new Map([['a', true], ['b', false]])); - stub.calledWithMatch(sinon.match.map); - stub.calledWithMatch(sinon.match.map.deepEquals(new Map([['a', true], ['b', false]]))); - stub.calledWithMatch(sinon.match.map.contains(new Map([['a', true]]))); -} - -function testSetMatcher() { - const stub = sinon.stub(); - stub(new Set(['a', true])); - stub.calledWithMatch(sinon.match.set); - stub.calledWithMatch(sinon.match.set.deepEquals(new Set(['a', true]))); - stub.calledWithMatch(sinon.match.set.contains(new Set([true]))); -} - -function testGetterStub() { - const myObj = { - prop: 'foo' + const replaceMe = { + prop: 5, + method() { return 6; }, + get getter() { return 7; }, + get setter() { return true; }, + set setter(val) { } }; - const stub = sinon.stub(myObj, 'prop').get(() => 'bar'); - stub.restore(); -} + sb.replace(replaceMe, 'prop', 10); + sb.replace(replaceMe, 'method', sb.spy()); + sb.replaceGetter(replaceMe, 'getter', () => 14); + sb.replaceSetter(replaceMe, 'setter', (v) => { }); -function testSetterStub() { - const myObj = { - prop: 'foo', - prop2: 'bar' + const cls = class { + foo() {} + bar: number; }; - const stub = sinon.stub(myObj, 'prop').set((val: string) => myObj.prop2 = val); - stub.restore(); -} - -function testValueStub() { - const myObj = { - prop: 'foo' - }; - - const stub = sinon.stub(myObj, 'prop').value('bar'); - stub.restore(); -} - -function testThrowsStub() { - sinon.stub().throws(new Error('foo')); - sinon.stub().throwsException(new Error('foo')); - sinon.stub().throws('foo'); - sinon.stub().throwsException('foo'); -} - -function testSpy() { - const otherSpy = sinon.spy(); - sinon.spy().calledAfter(otherSpy); - sinon.spy().calledBefore(otherSpy); - sinon.spy().calledImmediatelyAfter(otherSpy); - sinon.spy().calledImmediatelyBefore(otherSpy); + const stubInstance = sb.createStubInstance(cls); + stubInstance.foo.calledWith('foo'); + const clsFoo: sinon.SinonStub = stubInstance.foo; + const clsBar: number = stubInstance.bar; } function testFakeServer() { + let s = sinon.fakeServer.create(); + s = sinon.fakeServerWithClock.create(); + sinon.fakeServer.create({ autoRespond: true, autoRespondAfter: 3, fakeHTTPMethods: true, respondImmediately: false }); + + sinon.fakeServer.create({ + autoRespond: true, + autoRespondAfter: 3 + }); } -function testStubObject() { - const myObj = { - setStatus() {}, - json() {} +function testXHR() { + const xhr = new sinon.FakeXMLHttpRequest(); + const headers = xhr.getAllResponseHeaders(); + const header = xhr.getResponseHeader('foo'); + + xhr.restore(); + xhr.setResponseHeaders({ 'Content-Type': 'text/html' }); + xhr.setResponseBody('foo'); + xhr.respond(200, { 'Content-Type': 'foo' }, 'bar'); + xhr.error(); + + sinon.FakeXMLHttpRequest.useFilters = true; + sinon.FakeXMLHttpRequest.addFilter((method, url, async, user, pass) => true); + sinon.FakeXMLHttpRequest.onCreate = (xhr) => {}; +} + +function testClock() { + let clock = sinon.clock.create(1000); + clock = sinon.clock.create(new Date()); + + let now = 0; + now = clock.now; + + const fn = () => {}; + + clock.setTimeout(fn, 0); + clock.setTimeout(fn, 0, 'a', 'b'); + clock.setInterval(fn, 0); + clock.setInterval(fn, 0, 'a', 'b'); + clock.setImmediate(fn); + clock.setImmediate(fn, 'a', 'b'); + clock.requestAnimationFrame(fn); + + let timer = clock.setTimeout(fn, 0); + clock.clearTimeout(timer); + timer = clock.setInterval(fn, 0); + clock.clearInterval(timer); + timer = clock.setImmediate(fn); + clock.clearImmediate(timer); + + const animTimer = clock.requestAnimationFrame(fn); + clock.cancelAnimationFrame(animTimer); + + clock.nextTick(fn); + clock.tick(1); + clock.tick('00:10'); + clock.next(); + clock.runAll(); + clock.runToLast(); + clock.reset(); + clock.runMicrotasks(); + clock.runToFrame(); + clock.restore(); + clock.uninstall(); + clock.setSystemTime(1000); + clock.setSystemTime(new Date()); +} + +function testExpectation() { + const obj = {}; + + let ex = sinon.expectation.create(); + ex = sinon.expectation.create('some name'); + + ex.atLeast(5).atMost(10); + ex.never(); + ex.once(); + ex.twice(); + ex.thrice(); + ex.exactly(5); + ex.withArgs('a', 'b'); + ex.withExactArgs('a', 'b'); + ex.on(obj); + ex.verify(); + ex.restore(); +} + +function testMatch() { + const obj = {}; + const fn = () => {}; + + sinon.match(5).test(5); + sinon.match('str').test('foo'); + sinon.match(/foo/).test('foo'); + sinon.match({ a: 5, b: 6 }).test({}); + sinon.match((v) => true).test('foo'); + sinon.match((v) => true, 'some message').test('foo'); + sinon.match.any.test('foo'); + sinon.match.defined.test('foo'); + sinon.match.truthy.test('foo'); + sinon.match.falsy.test('foo'); + sinon.match.bool.test('foo'); + sinon.match.number.test('foo'); + sinon.match.string.test('foo'); + sinon.match.object.test('foo'); + sinon.match.func.test(fn); + sinon.match.map.test(new Map([['a', 1], ['b', 2]])); + sinon.match.set.test(new Set([1, 2, 3])); + sinon.match.array.test([1, 2, 3]); + sinon.match.regexp.test('foo'); + sinon.match.date.test('foo'); + sinon.match.symbol.test('foo'); + sinon.match.same(obj); + sinon.match.typeOf('string').test('foo'); + sinon.match.instanceOf(fn).test('foo'); + sinon.match.has('prop').test(obj); + sinon.match.has('prop', 123).test(obj); + sinon.match.hasOwn('prop').test(obj); + sinon.match.hasOwn('prop', 123).test(obj); + sinon.match.hasNested('prop.foo.bar').test(obj); + sinon.match.hasNested('prop.foo.bar', 123).test(obj); + sinon.match.every(sinon.match.number).test([1, 2, 'three']); + sinon.match.some(sinon.match.number).test([1, 2, 'three']); + sinon.match.array.deepEquals([{ a: 'b' }]).test([]); + sinon.match.array.startsWith([{ a: 'b' }]).test([]); + sinon.match.array.deepEquals([{ a: 'b' }]).test([]); + sinon.match.array.contains([{ a: 'b' }]).test([]); + sinon.match.map.deepEquals(new Map([['a', true], ['b', false]])).test(new Map()); + sinon.match.map.contains(new Map([['a', true]])).test(new Map()); +} + +function testFake() { + const fn = () => {}; + let fake = sinon.fake(); + + fake = sinon.fake(() => true); + fake = sinon.fake.returns(5); + fake = sinon.fake.throws('foo'); + fake = sinon.fake.throws(new Error('foo')); + fake = sinon.fake.resolves('foo'); + fake = sinon.fake.rejects('foo'); + fake = sinon.fake.yields(1, 2, fn); + fake = sinon.fake.yieldsAsync(1, 2, fn); + + fake.calledWith('foo'); +} + +function testAssert() { + const spy = sinon.spy(); + const spyTwo = sinon.spy(); + const obj = {}; + + sinon.assert.fail(); + sinon.assert.fail('foo'); + sinon.assert.pass('foo'); + sinon.assert.notCalled(spy); + sinon.assert.called(spy); + sinon.assert.calledOnce(spy); + sinon.assert.calledTwice(spy); + sinon.assert.calledThrice(spy); + sinon.assert.callCount(spy, 3); + sinon.assert.callOrder(spy, spyTwo); + sinon.assert.calledOn(spy, obj); + sinon.assert.calledOn(spy.firstCall, obj); + sinon.assert.alwaysCalledOn(spy, obj); + sinon.assert.alwaysCalledWith(spy, 'a', 'b', 'c'); + sinon.assert.neverCalledWith(spy, 'a', 'b', 'c'); + sinon.assert.calledWithExactly(spy, 'a', 'b', 'c'); + sinon.assert.alwaysCalledWithExactly(spy, 'a', 'b', 'c'); + sinon.assert.calledWithMatch(spy, 'a', 'b', 'c'); + sinon.assert.calledWithMatch(spy.firstCall, 'a', 'b', 'c'); + sinon.assert.alwaysCalledWithMatch(spy, 'a', 'b', 'c'); + sinon.assert.neverCalledWithMatch(spy, 'a', 'b', 'c'); + sinon.assert.calledWithNew(spy); + sinon.assert.calledWithNew(spy.firstCall); + sinon.assert.threw(spy); + sinon.assert.threw(spy.firstCall); + sinon.assert.threw(spy, 'foo error'); + sinon.assert.threw(spy.firstCall, 'foo error'); + sinon.assert.threw(spy, new Error('foo')); + sinon.assert.threw(spy.firstCall, new Error('foo')); + sinon.assert.alwaysThrew(spy); + sinon.assert.alwaysThrew(spy, 'foo error'); + sinon.assert.alwaysThrew(spy, new Error('foo')); + sinon.assert.match('a', 'b'); + sinon.assert.match(1, 1 + 1); + sinon.assert.match({ a: 1 }, { b: 2, c: 'abc' }); + sinon.assert.expose(obj); + sinon.assert.expose(obj, { prefix: 'blah' }); + sinon.assert.expose(obj, { includeFail: true }); +} + +function testSpy() { + const fn = () => {}; + const obj = class { + foo() {} }; - const stub = sinon.stub(myObj); - stub.setStatus.returns(stub); - stub.json.callCount; + const instance = new obj(); + + let spy = sinon.spy(); + const spyTwo = sinon.spy(); + + spy = sinon.spy(fn); + spy = sinon.spy(instance, 'foo'); + + let count = 0; + count = spy.callCount; + + let called = false; + called = spy.called; + called = spy.notCalled; + called = spy.calledOnce; + called = spy.calledTwice; + called = spy.calledThrice; + + let arr: any[] = []; + arr = spy.thisValues; + arr = spy.args; + arr = spy.exceptions; + arr = spy.returnValues; + + spy('a', 'b'); + spy(1, 2); + spy(true); + + spy.calledBefore(spyTwo); + spy.calledAfter(spyTwo); + spy.calledImmediatelyBefore(spyTwo); + spy.calledImmediatelyAfter(spyTwo); + spy.calledWithNew(); + spy.withArgs('a', 1).calledBefore(spyTwo); + spy.alwaysCalledOn(instance); + spy.alwaysCalledWith('a', 1); + spy.alwaysCalledWith('a'); + spy.alwaysCalledWithExactly('a', 1); + spy.alwaysCalledWithMatch('foo'); + spy.neverCalledWith('b', 2); + spy.neverCalledWith('b'); + spy.neverCalledWithMatch('foo', 'bar'); + spy.alwaysThrew(); + spy.alwaysThrew('foo'); + spy.alwaysThrew(new Error('foo')); + spy.alwaysReturned('foo'); + spy.invokeCallback('a', 'b'); + spy.calledOn(instance); + spy.calledWith('a', 2); + spy.calledWithExactly('a', 2); + spy.calledOnceWith('a', 2); + spy.calledOnceWithExactly('a', 2); + spy.calledWithMatch('bar', 2); + spy.notCalledWith('a', 2); + spy.notCalledWithMatch('a', 2); + spy.returned(true); + spy.returned('foo'); + spy.returned(2); + spy.threw(); + spy.threw('foo'); + spy.threw(new Error('foo')); + spy.callArg(1); + spy.callArgOn(1, instance); + spy.callArgOn(1, instance, 'a', 2); + spy.callArgWith(1, 'a', 2); + spy.callArgOnWith(1, instance, 'a', 2); + spy.yield('a', 2); + spy.yieldOn(instance, 'a', 2); + spy.yieldTo('prop', 'a', 2); + spy.yieldToOn('prop', instance, 'a', 2); + + let call = spy.firstCall; + call = spy.secondCall; + call = spy.thirdCall; + call = spy.lastCall; + call = spy.getCall(1); + call = spy.getCalls()[0]; + + call.calledBefore(call); + call.calledAfter(call); + call.calledWithNew(); + + spy.resetHistory(); + spy.restore(); } -testOne(); -testTwo(); -testThree(); -testFour(); -testFive(); -testSix(); -testSeven(); -testEight(); -testNine(); -testPromises(); -testSandbox(); -testSpy(); -testSymbolMatch(); -testResetHistory(); -testUsingPromises(); -testGetterStub(); -testSetterStub(); -testValueStub(); -testThrowsStub(); -testFakeServer(); +function testStub() { + const obj = class { + foo() {} + }; + const instance = new obj(); -const clock = sinon.useFakeTimers(); -clock.setSystemTime(1000); -clock.setSystemTime(new Date()); + let stub = sinon.stub(); + stub = sinon.stub(instance, 'foo'); -class TestCreateStubInstance { - someTestMethod(testArg: string) { } + const spy: sinon.SinonSpy = stub; + + sinon.stub(instance); + + stub.reset(); + stub.resetBehavior(); + stub.usingPromise(Promise); + + stub.returns(true); + stub.returns(5); + stub.returns('foo'); + stub.returnsArg(1); + stub.returnsThis(); + stub.resolves(); + stub.resolves('foo'); + stub.throws(); + stub.throws('err'); + stub.throws(new Error('err')); + stub.throwsArg(1); + stub.throwsException('err'); + stub.throwsException(new Error('err')); + stub.rejects(); + stub.rejects('TypeError'); + stub.rejects(1234); + stub.callsArg(1); + stub.callThrough(); + stub.callsArgOn(1, instance); + stub.callsArgWith(1, 'a', 2); + stub.callsArgAsync(1); + stub.callsArgOnAsync(1, instance); + stub.callsArgWithAsync(1, 'a', 2); + stub.callsArgOnWithAsync(1, instance, 'a', 2); + stub.callsFake(() => {}); + stub.get(() => true); + stub.set((v) => {}); + stub.onCall(1).returns(true); + stub.onFirstCall().resolves('foo'); + stub.onSecondCall().resolves('foo'); + stub.onThirdCall().resolves('foo'); + stub.value('foo'); + stub.yields('a', 2); + stub.yieldsOn(instance, 'a', 2); + stub.yieldsRight('a', 2); + stub.yieldsTo('foo', 'a', 2); + stub.yieldsToOn('foo', instance, 'a', 2); + stub.yieldsAsync('a', 2); + stub.yieldsOnAsync(instance, 'a', 2); + stub.yieldsToAsync('foo', 'a', 2); + stub.yieldsToOnAsync('foo', instance, 'a', 2); + stub.withArgs('a', 2).returns(true); } -sinon.createStubInstance(TestCreateStubInstance).someTestMethod('some argument'); -sinon.createStubInstance(TestCreateStubInstance).someTestMethod('some argument'); +function testMock() { + const obj = {}; + const mock = sinon.mock(obj); -function testGetCalls() { - const double = sinon.spy((a: number) => a * 2); - double(2); - double(4); - double.getCall(0).args.length === 1; - const secondCall = double.getCalls().find(call => call.args[0] === 4); - if (secondCall) { - secondCall.returnValue === 8; - } + mock.expects('method').atLeast(2).atMost(5); + mock.restore(); + mock.verify(); } diff --git a/types/sinon/tsconfig.json b/types/sinon/tsconfig.json index 2c9b85ec00..3a554d52cc 100644 --- a/types/sinon/tsconfig.json +++ b/types/sinon/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "target": "es5", "module": "commonjs", "lib": [ "es6", @@ -21,4 +22,4 @@ "index.d.ts", "sinon-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/sparkpost/index.d.ts b/types/sparkpost/index.d.ts index b6914240b2..661d8b74c5 100644 --- a/types/sparkpost/index.d.ts +++ b/types/sparkpost/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for sparkpost 2.1 // Project: https://github.com/SparkPost/node-sparkpost -// Definitions by: Joshua DeVinney , Bond +// Definitions by: Joshua DeVinney , Bond , Victor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -1139,6 +1139,10 @@ declare namespace SparkPost { abuse_at_status: "valid" | "invalid" | "unverified" | "pending"; /** Verification status of postmaster@ mailbox */ postmaster_at_status: "valid" | "invalid" | "unverified" | "pending"; + /** Verification status of CNAME configuration */ + cname_status: "valid" | "invalid" | "unverified" | "pending"; + /** Verification status of MX configuration */ + mx_status: "valid" | "invalid" | "unverified" | "pending"; } interface VerifyOptions { @@ -1173,6 +1177,10 @@ declare namespace SparkPost { * */ abuse_at_token?: string; + /** + * Request verification of CNAME record + */ + cname_verify?: boolean; } interface VerifyResults extends Status { diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 418525d38f..991d4a618a 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -4460,7 +4460,7 @@ declare namespace Stripe { billing?: SubscriptionBilling; /** - * Number of days a customer has to pay invoices generated by this subscription. + * Number of days a customer has to pay invoices generated by this subscription. * Only valid for subscriptions where billing=send_invoice. */ days_until_due?: number; @@ -5753,8 +5753,8 @@ declare namespace Stripe { * @param customerId The ID of the customer whose cards will be retrieved * @param data Filtering options */ - listSource(customerId: string, data: customers.ICardSourceListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; - listSource(customerId: string, data: customers.ICardSourceListOptions, response?: IResponseFn>): Promise>; + listSources(customerId: string, data: customers.ICardSourceListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; + listSources(customerId: string, data: customers.ICardSourceListOptions, response?: IResponseFn>): Promise>; /** * You can see a list of the bank accounts belonging to a customer or recipient. Note that the 10 most recent * bank accounts are always available by default on the customer or recipient object. If you need more than @@ -5768,8 +5768,8 @@ declare namespace Stripe { * @param customerId The ID of the customer whose cards will be retrieved * @param data Filtering options */ - listSource(customerId: string, data: customers.IBankAccountSourceListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; - listSource(customerId: string, data: customers.IBankAccountSourceListOptions, response?: IResponseFn>): Promise>; + listSources(customerId: string, data: customers.IBankAccountSourceListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; + listSources(customerId: string, data: customers.IBankAccountSourceListOptions, response?: IResponseFn>): Promise>; /** * By default, you can see the 10 most recent cards/bank accounts stored on a customer or recipient directly on the customer or recipient object, but @@ -7104,10 +7104,10 @@ declare namespace Stripe { * Many objects contain the ID of a related object in their response properties. For example, a Charge may have an associated Customer ID. * Those objects can be expanded inline with the expand request parameter. Objects that can be expanded are noted in this documentation. * This parameter is available on all API requests, and applies to the response of that request only. - * + * * You can nest expand requests with the dot property. For example, requesting invoice.customer on a charge will expand the invoice property * into a full Invoice object, and will then expand the customer property on that invoice into a full Customer object. - * + * * You can expand multiple objects at once by identifying multiple items in the expand array. */ expand?: string[]; diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index e56a454108..91cfa0f50c 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -495,6 +495,25 @@ stripe.customers.listCards('cu_15fvyVEe31JkLCeQvr155iqc').then(function (cards) // asynchronously called }); +stripe.customers.listSources('cu_15fvyVEe31JkLCeQvr155iqc', null, function (err, cards) { + // asynchronously called +}); +stripe.customers.listSources('cu_15fvyVEe31JkLCeQvr155iqc', null).then(function (cards) { + // asynchronously called +}); +stripe.customers.listSources('cu_15fvyVEe31JkLCeQvr155iqc', { + object: "card", + limit: 100 +}).then(function (cards) { + // asynchronously called +}); +stripe.customers.listSources('cu_15fvyVEe31JkLCeQvr155iqc', { + object: "bank_account", + limit: 100 +}).then(function (cards) { + // asynchronously called +}); + stripe.customers.retrieveSubscription( "cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 6520b4eb66..7daf5f47dc 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for SuperAgent 3.5 +// Type definitions for SuperAgent 3.8 // Project: https://github.com/visionmedia/superagent // Definitions by: Nico Zelaya // Michael Ledin // Pap Lőrinc // Shrey Jain +// Alec Zopf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -131,7 +132,7 @@ declare namespace request { on(name: string, handler: (event: any) => void): this; parse(parser: Parser): this; part(): this; - pfx(cert: Buffer | string): this; + pfx(cert: Buffer | string | { pfx: Buffer, passphrase: string }): this; pipe(stream: NodeJS.WritableStream, options?: object): stream.Writable; query(val: object | string): this; redirects(n: number): this; diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 351e78b156..66046759f1 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -373,6 +373,16 @@ request .pfx(pfx) .end(callback); +// pfx with passphrase, from: https://github.com/visionmedia/superagent/pull/1230/commits/96af65ffc6256df633f893095d1dc828694bbfbc +const passpfx = fs.readFileSync('passcert.pfx'); +request + .post('/secure') + .pfx({ + pfx: passpfx, + passphrase: 'test' + }) + .end(callback); + // ok, from: https://github.com/visionmedia/superagent/commit/34533bbc29833889090847c45a82b0ea81b2f06d request .get('/404') diff --git a/types/tail/index.d.ts b/types/tail/index.d.ts new file mode 100644 index 0000000000..00f80ab079 --- /dev/null +++ b/types/tail/index.d.ts @@ -0,0 +1,40 @@ +// Type definitions for tail 1.2 +// Project: https://github.com/lucagrulla/node-tail +// Definitions by: Mike Linkovich +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +declare namespace Tail { + interface TailOptions { + separator?: string | RegExp; + fromBeginning?: boolean; + fsWatchOptions?: Record; + follow?: boolean; + logger?: any; + encoding?: string; + useWatchFile?: boolean; + } + + interface Tail { + /** Callback to listen for newlines appended to file */ + on(eventType: 'line', cb: (data: any) => void): void; + /** Error callback */ + on(eventType: 'error', cb: (error: any) => void): void; + /** Stop watching file */ + unwatch(): void; + /** Start watching file if previously stopped */ + watch(): void; + } + + interface TailConstructor { + /** Creates a new Tail object that starts watching the specified file immediately. */ + new(filename: string, options?: TailOptions): Tail; + } + + interface Static { + Tail: TailConstructor; + } +} + +declare const Tail: Tail.Static; +export = Tail; diff --git a/types/tail/tail-tests.ts b/types/tail/tail-tests.ts new file mode 100644 index 0000000000..aa212a5b78 --- /dev/null +++ b/types/tail/tail-tests.ts @@ -0,0 +1,26 @@ +import { Tail } from 'tail'; + +const tail = new Tail("test.txt"); + +tail.on("line", data => { + console.log(data); +}); + +tail.on("error", error => { + console.log('ERROR: ', error); +}); + +tail.unwatch(); + +tail.watch(); + +// With options object +const tail2 = new Tail("test2.txt", { + separator: /[\r]{0,1}\n/, + fromBeginning: false, + fsWatchOptions: {}, + follow: true, + logger: console, + useWatchFile: false, + encoding: 'utf-8' +}); diff --git a/types/tail/tsconfig.json b/types/tail/tsconfig.json new file mode 100644 index 0000000000..fbc4b5e0ff --- /dev/null +++ b/types/tail/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es2015", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [] + }, + "files": [ + "index.d.ts", + "tail-tests.ts" + ] +} diff --git a/types/tail/tslint.json b/types/tail/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/tail/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/tar-stream/index.d.ts b/types/tar-stream/index.d.ts new file mode 100644 index 0000000000..d6afd0af7a --- /dev/null +++ b/types/tar-stream/index.d.ts @@ -0,0 +1,42 @@ +// Type definitions for tar-stream 1.6 +// Project: https://github.com/mafintosh/tar-stream +// Definitions by: Guy Lichtman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/// + +import stream = require('stream'); + +export type Callback = (err?: Error | null) => any; + +// see https://github.com/mafintosh/tar-stream/blob/master/headers.js +export interface Headers { + name: string; + mode?: number; + uid?: number; + gid?: number; + size?: number; + mtime?: Date; + linkname?: string | null; + type?: 'file' | 'link' | 'symlink' | 'character-device' | 'block-device' | 'directory' | 'fifo' | + 'contiguous-file' | 'pax-header' | 'pax-global-header' | 'gnu-long-link-path' | 'gnu-long-path' | null; + uname?: string; + gname?: string; + devmajor?: number; + devminor?: number; +} + +export interface Pack extends stream.Readable { + entry(headers: Headers, buffer?: string | Buffer | Callback, callback?: Callback): stream.Writable; + finalize(): void; +} + +export interface Extract extends stream.Writable { + on(event: string, listener: (...args: any[]) => void): this; + on(event: "entry", listener: (headers: Headers, stream: stream.PassThrough, next: () => void) => void): this; +} + +export function extract(opts?: stream.WritableOptions): stream.Writable; + +export function pack(opts?: stream.ReadableOptions): Pack; diff --git a/types/tar-stream/tar-stream-tests.ts b/types/tar-stream/tar-stream-tests.ts new file mode 100644 index 0000000000..537c08bc0d --- /dev/null +++ b/types/tar-stream/tar-stream-tests.ts @@ -0,0 +1,44 @@ +import tar = require('tar-stream'); + +const pack = tar.pack(); + +// add a file called my-test.txt with the content "Hello World!" +pack.entry({ name: 'my-test1.txt' }, 'Hello World!'); + +// add a file called my-stream-test.txt from a stream +const entry = pack.entry({ name: 'my-test2.txt', size: 11 }, (err) => { + // the stream was added + // no more entries + pack.finalize(); +}); + +entry.write('hello'); +entry.write(' '); +entry.write('world'); +entry.end(); + +const extract = tar.extract(); + +const entries: any = {}; + +extract.on('entry', (header, stream, next) => { + // header is the tar header + // stream is the content body (might be an empty stream) + // call next when you are done with this entry + entries[header.name] = true; + stream.on('end', () => { + next(); + }); + + stream.resume(); // just auto drain the stream +}); + +extract.on('finish', () => { + // all entries read + console.assert(entries['my-test1.txt'], "missing entry"); + console.assert(entries['my-test2.txt'], "missing entry"); + console.log("Found all entries in extract"); +}); + +// pipe the pack stream +pack.pipe(extract); diff --git a/types/tar-stream/tsconfig.json b/types/tar-stream/tsconfig.json new file mode 100644 index 0000000000..efc9382e30 --- /dev/null +++ b/types/tar-stream/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "tar-stream-tests.ts" + ] +} diff --git a/types/tar-stream/tslint.json b/types/tar-stream/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/tar-stream/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index a7f7950a48..eb850ac390 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -873,7 +873,7 @@ export class BufferGeometry extends EventDispatcher { center(): BufferGeometry; setFromObject(object: Object3D): BufferGeometry; - setFromPoints(points: Vector3[]): BufferGeometry; + setFromPoints(points: Vector3[]|Vector2[]): BufferGeometry; updateFromObject(object: Object3D): void; fromGeometry(geometry: Geometry, settings?: any): BufferGeometry; @@ -1911,7 +1911,7 @@ export class Layers { } export class Font { - constructor(jsondata: string); + constructor(jsondata: any); data: string; @@ -2214,7 +2214,7 @@ export class FontLoader { manager: LoadingManager; load(url: string, onLoad?: (responseFont: Font) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(json: string): Font; + parse(json: any): Font; } /** diff --git a/types/vue-markdown/index.d.ts b/types/vue-markdown/index.d.ts new file mode 100644 index 0000000000..58482a0870 --- /dev/null +++ b/types/vue-markdown/index.d.ts @@ -0,0 +1,305 @@ +// Type definitions for vue-markdown 2.2 +// Project: https://github.com/miaolz123/vue-markdown#readme +// Definitions by: James Barton +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default vue_markdown; +export const vue_markdown: { + beforeMount: any; + computed: { + tocLastLevelComputed: any; + }; + data: any; + md: { + block: { + State: any; + parse: any; + ruler: { + after: any; + at: any; + before: any; + disable: any; + enable: any; + enableOnly: any; + getRules: any; + push: any; + }; + tokenize: any; + }; + configure: any; + core: { + State: any; + process: any; + ruler: { + after: any; + at: any; + before: any; + disable: any; + enable: any; + enableOnly: any; + getRules: any; + push: any; + }; + }; + disable: any; + enable: any; + helpers: { + parseLinkDestination: any; + parseLinkLabel: any; + parseLinkTitle: any; + }; + inline: { + State: any; + parse: any; + ruler: { + after: any; + at: any; + before: any; + disable: any; + enable: any; + enableOnly: any; + getRules: any; + push: any; + }; + ruler2: { + after: any; + at: any; + before: any; + disable: any; + enable: any; + enableOnly: any; + getRules: any; + push: any; + }; + skipToken: any; + tokenize: any; + }; + linkify: { + add: any; + match: any; + normalize: any; + pretest: any; + re: { + email_fuzzy: RegExp; + host_fuzzy_test: RegExp; + link_fuzzy: RegExp; + link_no_ip_fuzzy: RegExp; + pretest: RegExp; + schema_search: RegExp; + schema_test: RegExp; + src_Any: string; + src_Cc: string; + src_P: string; + src_Z: string; + src_ZCc: string; + src_ZPCc: string; + src_auth: string; + src_domain: string; + src_domain_root: string; + src_email_name: string; + src_host: string; + src_host_port_strict: string; + src_host_strict: string; + src_host_terminator: string; + src_ip4: string; + src_path: string; + src_port: string; + src_tlds: string; + src_xn: string; + tpl_email_fuzzy: string; + tpl_host_fuzzy: string; + tpl_host_fuzzy_strict: string; + tpl_host_fuzzy_test: string; + tpl_host_no_ip_fuzzy: string; + tpl_host_port_fuzzy_strict: string; + tpl_host_port_no_ip_fuzzy_strict: string; + tpl_link_fuzzy: string; + tpl_link_no_ip_fuzzy: string; + }; + set: any; + test: any; + testSchemaAt: any; + tlds: any; + }; + normalizeLink: any; + normalizeLinkText: any; + options: { + breaks: boolean; + highlight: any; + html: boolean; + langPrefix: string; + linkify: boolean; + maxNesting: number; + quotes: string; + typographer: boolean; + xhtmlOut: boolean; + }; + parse: any; + parseInline: any; + render: any; + renderInline: any; + renderer: { + render: any; + renderAttrs: any; + renderInline: any; + renderInlineAsText: any; + renderToken: any; + rules: { + code_block: any; + code_inline: any; + fence: any; + hardbreak: any; + html_block: any; + html_inline: any; + image: any; + softbreak: any; + text: any; + }; + }; + set: any; + use: any; + utils: { + arrayReplaceAt: any; + assign: any; + escapeHtml: any; + escapeRE: any; + fromCodePoint: any; + has: any; + isMdAsciiPunct: any; + isPunctChar: any; + isSpace: any; + isString: any; + isValidEntityCode: any; + isWhiteSpace: any; + lib: { + mdurl: { + decode: any; + encode: any; + format: any; + parse: any; + }; + ucmicro: { + Any: RegExp; + Cc: RegExp; + Cf: RegExp; + P: RegExp; + Z: RegExp; + }; + }; + normalizeReference: any; + unescapeAll: any; + unescapeMd: any; + }; + validateLink: any; + }; + props: { + anchorAttributes: { + default: any; + type: any; + }; + breaks: { + default: boolean; + type: any; + }; + emoji: { + default: boolean; + type: any; + }; + highlight: { + default: boolean; + type: any; + }; + html: { + default: boolean; + type: any; + }; + langPrefix: { + default: string; + type: any; + }; + linkify: { + default: boolean; + type: any; + }; + postrender: { + default: any; + type: any; + }; + prerender: { + default: any; + type: any; + }; + quotes: { + default: string; + type: any; + }; + show: { + default: boolean; + type: any; + }; + source: { + default: string; + type: any; + }; + tableClass: { + default: string; + type: any; + }; + taskLists: { + default: boolean; + type: any; + }; + toc: { + default: boolean; + type: any; + }; + tocAnchorClass: { + default: string; + type: any; + }; + tocAnchorLink: { + default: boolean; + type: any; + }; + tocAnchorLinkClass: { + default: string; + type: any; + }; + tocAnchorLinkSpace: { + default: boolean; + type: any; + }; + tocAnchorLinkSymbol: { + default: string; + type: any; + }; + tocClass: { + default: string; + type: any; + }; + tocFirstLevel: { + default: number; + type: any; + }; + tocId: { + type: any; + }; + tocLastLevel: { + type: any; + }; + typographer: { + default: boolean; + type: any; + }; + watches: { + default: any; + type: any; + }; + xhtmlOut: { + default: boolean; + type: any; + }; + }; + render: any; + template: string; +}; diff --git a/types/vue-markdown/package.json b/types/vue-markdown/package.json new file mode 100644 index 0000000000..20f817a6b3 --- /dev/null +++ b/types/vue-markdown/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "vue": "^2.5.16" + } +} diff --git a/types/vue-markdown/tsconfig.json b/types/vue-markdown/tsconfig.json new file mode 100644 index 0000000000..9b7defa032 --- /dev/null +++ b/types/vue-markdown/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "vue-markdown-tests.ts" + ] +} diff --git a/types/vue-markdown/tslint.json b/types/vue-markdown/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/vue-markdown/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vue-markdown/vue-markdown-tests.ts b/types/vue-markdown/vue-markdown-tests.ts new file mode 100644 index 0000000000..369e4c614c --- /dev/null +++ b/types/vue-markdown/vue-markdown-tests.ts @@ -0,0 +1,12 @@ +import Vue from 'vue'; +import VueMarkdown from 'vue-markdown'; + +new Vue({ + el: '#app', + components: { + VueMarkdown + }, + template: ` + # Test + ` +}); diff --git a/types/windows-script-host/index.d.ts b/types/windows-script-host/index.d.ts index 50f0c52216..47f11e4d39 100644 --- a/types/windows-script-host/index.d.ts +++ b/types/windows-script-host/index.d.ts @@ -4,437 +4,44 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// +/// -declare namespace IWshRuntimeLibrary { - type WindowStyle = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; - type ShortcutWindowStyle = 1 | 3 | 7; - - const enum ButtonType { - OK, - OKCancel, - AbortRetryIgnore, - YesNoCancel, - YesNo, - RetryCancel, - CancelTryagainContinue - } - - const enum EventType { - AuditFailure = 5, - AuditSuccess = 4, - Error = 1, - Information = 3, - Success = 0, - Warning = 2 - } - - const enum IconType { - Stop = 16, - QuestionMark = 32, - ExclamationMakr = 48, - InformationMark = 64, - } - - const enum PopupType { - SecondButtonDefault = 256, - ThirdButtonDefault = 512, - Modal = 4096, - RightJustified = 524288, - RTL = 1048576, - } - - const enum PopupSelection { - NoButton = -1, - OK = 1, - Cancel = 2, - Abort = 3, - Retry = 4, - Ignore = 5, - Yes = 6, - No = 7, - TryAgain = 10, - Continue = 11, - } - - const enum WshExecStatus { - WshFailed = 2, - WshFinished = 1, - WshRunning = 0, - } - - const enum WshWindowStyle { - WshHide = 0, - WshMaximizedFocus = 3, - WshMinimizedFocus = 2, - WshMinimizedNoFocus = 6, - WshNormalFocus = 1, - WshNormalNoFocus = 4, - } - - class TextStreamBase { - /** - * The column number of the current character position in an input stream. - */ - Column: number; - - /** - * The current line number in an input stream. - */ - Line: number; - - /** - * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If - * you close a standard stream, be aware that any other pointers to that standard stream become invalid. - */ - Close(): void; - } - - class TextStreamWriter extends TextStreamBase { - private 'IWshRuntimeLibrary.TextStreamWriter_typekey': TextStreamWriter; - private constructor(); - - /** - * Sends a string to an output stream. - */ - Write(s: string): void; - - /** - * Sends a specified number of blank lines (newline characters) to an output stream. - */ - WriteBlankLines(intLines: number): void; - - /** - * Sends a string followed by a newline character to an output stream. - */ - WriteLine(s: string): void; - } - - class TextStreamReader extends TextStreamBase { - private 'IWshRuntimeLibrary.TextStreamReader_typekey': TextStreamReader; - private constructor(); - - /** - * Returns a specified number of characters from an input stream, starting at the current pointer position. - * Does not return until the ENTER key is pressed. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - Read(characters: number): string; - - /** - * Returns all characters from an input stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadAll(): string; - - /** - * Returns an entire line from an input stream. - * Although this method extracts the newline character, it does not add it to the returned string. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadLine(): string; - - /** - * Skips a specified number of characters when reading from an input text stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) - */ - Skip(characters: number): void; - - /** - * Skips the next line when reading from an input text stream. - * Can only be used on a stream in reading mode, not writing or appending mode. - */ - SkipLine(): void; - - /** - * Indicates whether the stream pointer position is at the end of a line. - */ - AtEndOfLine: boolean; - - /** - * Indicates whether the stream pointer position is at the end of a stream. - */ - AtEndOfStream: boolean; - } - - /** Provides access to the entire collection of command-line parameters, in the order in which they were originally entered. */ - interface WshArguments { - Count(): number; - Item(index: number): string; - Length: number; - Named: WshNamed; - - /** - * When you run the **ShowUsage** method, a help screen (referred to as the usage) appears and displays details about the script's command line options. - * This information comes from the runtime section of the `*.WSF` file. Everything written between the `` and `` tags is pieced together - * to produce what is called a "usage statement." The usage statement tells the user how to use the script. - */ - ShowUsage(): void; - Unnamed: WshUnnamed; - (index: number): string; - } - - /** Generic Collection Object */ - interface WshCollection { - Count(): number; - Item(Index: any): any; - readonly length: number; - (Index: any): any; - } - - /** Environment Variables Collection Object */ - interface WshEnvironment { - Count(): number; - Item(Name: string): string; - readonly Length: number; - Remove(Name: string): void; - (Name: string): string; - } - - /** WSHExec object */ - class WshExec { - private 'IWshRuntimeLibrary.WshExec_typekey': WshExec; - private constructor(); - readonly ExitCode: number; - readonly ProcessID: number; - readonly Status: WshExecStatus; - readonly StdErr: TextStreamWriter; - readonly StdIn: TextStreamReader; - readonly StdOut: TextStreamWriter; - Terminate(): void; - } +/** Provides access to the entire collection of command-line parameters, in the order in which they were originally entered. */ +interface WshArguments { + Count(): number; + Item(index: number): string; + Length: number; + Named: WshNamed; /** - * Provides access to the named command-line arguments - * - * Note that enumerating over this object returns the **names** of the arguments, not the values + * When you run the **ShowUsage** method, a help screen (referred to as the usage) appears and displays details about the script's command line options. + * This information comes from the runtime section of the `*.WSF` file. Everything written between the `` and `` tags is pieced together + * to produce what is called a "usage statement." The usage statement tells the user how to use the script. */ - interface WshNamed { - Count(): number; - Exists(Key: string): boolean; - Item(name: string): string; - Length: number; - (name: string): string; - } + ShowUsage(): void; + Unnamed: WshUnnamed; + (index: number): string; +} - /** Network Object */ - class WshNetwork { - private 'IWshRuntimeLibrary.WshNetwork_typekey': WshNetwork; - private constructor(); +/** + * Provides access to the named command-line arguments + * + * Note that enumerating over this object returns the **names** of the arguments, not the values + */ +interface WshNamed { + Count(): number; + Exists(Key: string): boolean; + Item(name: string): string; + Length: number; + (name: string): string; +} - /** - * Adds a remote MS-DOS-based printer connection to your computer system. - * @param LocalName Local name to assign to the connected printer. - * @param RemoteName Name of the remote printer. - * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. - * - * If you are mapping a remote printer using the profile of someone other than current user, you can specify _UserName_ and _Password_. - */ - AddPrinterConnection(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; - - /** - * @param string Path to printer connection - * @param string [DriverName=''] - * @param string [Port='LPT1'] - * - * Unlike the **AddPrinterConnection** method, this method allows you to create a printer connection without directing it to a specific port, such as LPT1. - */ - AddWindowsPrinterConnection(PrinterName: string, DriverName?: string, Port?: string): void; - readonly ComputerName: string; - EnumNetworkDrives(): WshCollection; - EnumPrinterConnections(): WshCollection; - - /** - * Adds a remote MS-DOS-based printer connection to your computer system. - * @param LocalName Name by which the mapped drive will be known locally - * @param RemoteName Share's UNC name (\\xxx\yyy) - * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. - * - * If you are mapping a network drive using the profile of someone other than current user, you can specify _UserName_ and _Password_. - */ - MapNetworkDrive(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; - readonly Organization: string; - - /** - * Removes a shared network drive from your computer system - * @param Name Name of the mapped drive you want to remove. This will be the drive letter if the drive has a mapping between a local name (drive letter) and a remote name (UNC name); - * it will be the UNC path if there is no such mapping - * @param Force [false] Remove the connections even if the resource is in use - * @param UpdateProfile [false] Remove the mapping from the user's profile - */ - RemoveNetworkDrive(Name: string, Force?: boolean, UpdateProfile?: boolean): void; - - /** - * Removes a shared network printer connection from your computer system - * @param Name Name that identifies the printer. Can be a UNC name (in the form `\\xxx\yyy`) or a local name (such as `LPT1`) - * @param Force [false] Remove printer connection even if a user is still connected - * @param UpdateProfile [false] Remove the printer connection from the user's profile - * - * The **RemovePrinterConnection** method removes both Windows and MS-DOS based printer connections. If the printer was connected using the method **AddPrinterConnection**, - * _Name_ must be the printer's local name. If the printer was connected using the **AddWindowsPrinterConnection** method or was added manually (using the Add Printer wizard), - * then _Name_ must be the printer's UNC name. - */ - RemovePrinterConnection(Name: string, Force?: true, UpdateProfile?: true): void; - SetDefaultPrinter(Name: string): void; - readonly Site: string; - readonly UserDomain: string; - readonly UserName: string; - readonly UserProfile: string; - } - - /** Shell Object */ - class WshShell { - private 'IWshRuntimeLibrary.WshShell_typekey': WshShell; - private constructor(); - - /** - * Activates an application window - * @param App Title of application as it appears in the title bar, or the process ID - * @param Wait - * - * This method changes the focus to the named application or window. The window must be attached to the calling thread's message queue. It does not affect whether it is maximized or - * minimized. Focus moves from the activated application window when the user takes action to change the focus (or closes the window). - * - * In determining which application to activate, the specified title is compared to the title string of each running application. If no exact match exists, any application whose title - * string begins with title is activated. If an application still cannot be found, any application whose title string ends with title is activated. If more than one instance of the - * application named by title exists, one instance is arbitrarily activated. - * - * The method might return `false` under the following conditions: - * - * * The window is not brought to the foreground. - * * The window is brought to the foreground but is not given keyboard focus. - * * A Command Prompt window (`cmd.exe`) is brought to the foreground and is given keyboard focus. - */ - AppActivate(App: string | number, Wait?: any): boolean; - - /** - * Creates a shortcut - * @param PathLink Path where the shortcut should be created - * - * The shortcut object exists in memory until you save it to disk with the **Save** method. - */ - CreateShortcut(PathLink: string): WshShortcut | WshURLShortcut; - CurrentDirectory: string; - - /** - * Note that **Environment** doesn't actually return a callable object; the call is only usable in the context of the **Environment** property. The following: - * - * let env = new ActiveXObject('WScript.Shell').Environment; - * WScript.Echo(env('System')); - * - * will return an empty string, unless there is an environment variable named `System` - */ - Environment: WshEnvironment & ((Type: 'System' | 'User' | 'Process' | 'Volatile') => WshEnvironment); - Exec(Command: string): WshExec; - ExpandEnvironmentStrings(Src: string): string; - - /** @param string [Target=''] Name of the computer system where the event should be logged; default is the local computer system */ - LogEvent(Type: EventType, Message: string, Target?: string): boolean; - Popup(Text: string, SecondsToWait?: number, Title?: string, Type?: ButtonType | IconType | PopupType): PopupSelection; - RegDelete(Name: string): void; - - /** - * Returns the value of a key or value-name from the registry - * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) - * - * Returns one of the following, based on the registry value type: - * - * * **REG_SZ** -- a string - * * **REG_DWORD** -- a number - * * **REG_SBINARY** -- a binary value, as a COM SafeArray containing integers - * * **REG_EXPAND_SZ** -- an expandable string - * * **REG_MULTI_SZ** -- an array of srings, as a COM SafeArray - */ - RegRead(Name: string): string | number | SafeArray | SafeArray; - - /** - * Creates a new key, adds another value-name to an existing key and assigns it a value, or changes the value of an existing value-name - * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) - * @param Value Will be coerced to `string` or `integer` based on the value-name type: - * `REG_SZ | REG_EXPAND_SZ` will be converted to `string`; - * `REG_DWORD | REG_BINARY` will be converted to `integer` - * @param Type - */ - RegWrite(Name: string, Value: any, Type?: 'REG_SZ' | 'REG_DWORD' | 'REG_BINARY' | 'REG_EXPAND_SZ'): void; - - /** - * Runs a program in a new process. - * @param Command Command-line, including any parameters you want to pass to the executable file. - * @param WindowStyle Appearance of the program window. Not all programs make use of this information. - * @param WaitOnReturn Block script until program finishes executing. - * - * If `false` is passed into **WaitOnReturn**, the **Run** method will return 0 immediately. If `true` is passed in, **Run** will return the program's error code, if any. - * - * Environment variables will be expanded within the command line. - * - * Passing a registered file type will automatically open the program registered to the file type. - * - * Possible values for **WindowStyle**: - * - * * **0** -- Hides the window and activates another window. - * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag - * when displaying the window for the first time. - * * **2** -- Activates the window and displays it as a minimized window. - * * **3** -- Activates the window and displays it as a maximized window. - * * **4** -- Displays a window in its most recent size and position. The active window remains active. - * * **5** -- Activates the window and displays it in its current size and position. - * * **6** -- Minimizes the specified window and activates the next top-level window in the Z order. - * * **7** -- Displays the window as a minimized window. The active window remains active. - * * **8** -- Displays the window in its current state. The active window remains active. - * * **9** -- Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag - * when restoring a minimized window. - * * **10** -- Sets the show-state based on the state of the program that started the application. - */ - Run(Command: string, WindowStyle?: WindowStyle, WaitOnReturn?: boolean): number; - SendKeys(Keys: string, Wait?: boolean): void; - readonly SpecialFolders: WshCollection; - } - - /** Shortcut Object */ - class WshShortcut { - private 'IWshRuntimeLibrary.WshShortcut_typekey': WshShortcut; - private constructor(); - Arguments: string; - Description: string; - readonly FullName: string; - Hotkey: string; - IconLocation: string; - Load(PathLink: string): void; - readonly RelativePath: string; - Save(): void; - TargetPath: string; - - /** - * Possible values: - * - * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag - * when displaying the window for the first time. - * * **3** -- Activates the window and displays it as a maximized window. - * * **7** -- Displays the window as a minimized window. The active window remains active. - */ - WindowStyle: ShortcutWindowStyle; - WorkingDirectory: string; - } - - /** Provides access to the unnamed command-line arguments */ - interface WshUnnamed { - Count(): number; - Item(index: number): string; - Length: number; - (index: number): string; - } - - /** URLShortcut Object */ - class WshURLShortcut { - private 'IWshRuntimeLibrary.WshURLShortcut_typekey': WshURLShortcut; - private constructor(); - readonly FullName: string; - Load(PathLink: string): void; - Save(): void; - TargetPath: string; - } +/** Provides access to the unnamed command-line arguments */ +interface WshUnnamed { + Count(): number; + Item(index: number): string; + Length: number; + (index: number): string; } declare var WScript: { @@ -455,7 +62,7 @@ declare var WScript: { * Can be accessed only while using CScript.exe. */ StdOut: IWshRuntimeLibrary.TextStreamWriter; - Arguments: IWshRuntimeLibrary.WshArguments; + Arguments: WshArguments; /** * The full path of the currently running script. @@ -546,41 +153,3 @@ declare var WScript: { * WSH is an alias for WScript under Windows Script Host */ declare var WSH: typeof WScript; - -declare namespace WSHControllerLibrary { - class WSHController { - private 'WSHControllerLibrary.WSHController_typekey': WSHController; - private constructor(); - CreateScript(Command: string, Server?: any): any; - } -} - -declare namespace ScriptSigner { - class Signer { - private 'ScriptSigner.Signer_typekey': Signer; - private constructor(); - - /** @param Store [Store='my'] */ - Sign(FileExtension: string, Text: string, Certificate: string, Store?: string): string; - - /** @param Store [Store='my'] */ - SignFile(FileName: string, Certificate: string, Store?: string): void; - - /** @param ShowUI [ShowUI=false] */ - Verify(FileExtension: string, Text: string, ShowUI?: boolean): boolean; - - /** @param ShowUI [ShowUI=false] */ - VerifyFile(FileName: string, ShowUI?: boolean): boolean; - } -} - -interface ActiveXObjectNameMap { - 'WSHController': WSHControllerLibrary.WSHController; - 'Scripting.Signer': ScriptSigner.Signer; - 'WScript.Network': IWshRuntimeLibrary.WshNetwork; - 'WScript.Shell': IWshRuntimeLibrary.WshShell; -} - -interface ActiveXObject { - set(obj: IWshRuntimeLibrary.WshEnvironment, propertyName: 'Item', parameterTypes: [string], newValue: string): void; -} diff --git a/types/windows-script-host/windows-script-host-tests.ts b/types/windows-script-host/windows-script-host-tests.ts index c6b3449482..d4851f2626 100644 --- a/types/windows-script-host/windows-script-host-tests.ts +++ b/types/windows-script-host/windows-script-host-tests.ts @@ -28,53 +28,3 @@ WScript.Echo(`${WScript.Arguments.Named.Length} named arguments`); for (const key of collectionToArray(WScript.Arguments.Named)) { WScript.Echo(` ${key}=${WScript.Arguments.Named(key)}`); } - -const wshn = new ActiveXObject('WScript.Network'); - -// https://msdn.microsoft.com/en-us/library/s6wt333f(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/wck0hkd7(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/tte130y1(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/3fxhka75(v=vs.84).aspx -{ - WScript.Echo('Domain = ' + wshn.UserDomain); - WScript.Echo('Computer Name = ' + wshn.ComputerName); - WScript.Echo('User Name = ' + wshn.UserName); -} - -// https://msdn.microsoft.com/en-us/library/zsdh7hkb(v=vs.84).aspx -wshn.AddWindowsPrinterConnection('\\\\printserv\\DefaultPrinter'); - -// https://msdn.microsoft.com/en-us/library/kxsdca3c(v=vs.84).aspx -wshn.AddPrinterConnection("LPT1", "\\\\Server\\Print1"); - -// https://msdn.microsoft.com/en-us/library/t9zt39at(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/zhds6k80(v=vs.84).aspx -{ - const drives = wshn.EnumNetworkDrives(); - const printers = wshn.EnumPrinterConnections(); - WScript.Echo("Network drive mappings:"); - for (let i = 0; i < drives.length; i += 2) { - WScript.Echo(`Drive ${drives.Item(i)} = ${drives.Item(i + 1)}`); - } - WScript.Echo(''); - WScript.Echo("Network printer mappings:"); - for (let i = 0; i < printers.length; i += 2) { - WScript.Echo(`Port ${printers.Item(i)} = ${printers.Item(i + 1)}`); - } -} - -// https://msdn.microsoft.com/en-us/library/8kst88h6(v=vs.84).aspx -wshn.MapNetworkDrive('E:', '\\\\Server\\Public'); - -// https://msdn.microsoft.com/en-us/library/d16d7wbf(v=vs.84).aspx -wshn.RemoveNetworkDrive('E:'); - -// https://msdn.microsoft.com/en-us/library/tsbh2yy7(v=vs.84).aspx -wshn.RemovePrinterConnection('\\\\PRN-CORP1\\B41-4523-A', true, true); - -// https://msdn.microsoft.com/en-us/library/2ccwwdct(v=vs.84).aspx -{ - const printerPath = "\\\\research\\library1"; - wshn.AddWindowsPrinterConnection(printerPath); - wshn.SetDefaultPrinter(printerPath); -} diff --git a/types/wreck/index.d.ts b/types/wreck/index.d.ts index e695cf00a9..ff10218012 100644 --- a/types/wreck/index.d.ts +++ b/types/wreck/index.d.ts @@ -1,27 +1,70 @@ -// Type definitions for wreck 7.0.0 +// Type definitions for wreck 14.0.0 // Project: https://github.com/hapijs/wreck // Definitions by: Marcin Porębski +// Rodrigo Saboya // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 /// -import http = require('http'); -import stream = require('stream'); +import * as Boom from "boom"; +import * as events from "events"; +import * as http from "http"; +import * as stream from "stream"; +import * as Url from "url"; +interface RequestOptions { + baseUrl?: string; + socketPath? : string; + payload?: any; + headers?: { [key: string]: any }; + redirects?: number; + redirect303?: boolean; + beforeRedirect?: (redirectMethod: string, statusCode: number, location: string, resHeaders: { [key: string]: any }, redirectOptions: any, next: () => {}) => void; + redirected?: (statusCode: number, location: string, req: http.ClientRequest) => void; + timeout?: number; + maxBytes?: number; + rejectUnauthorized?: boolean; + downstreamRes?: any; + agent?: WreckObject["agents"] | false; + secureProtocol?: string; + ciphers?: string; + events?: boolean; +} + +interface ReadOptions { + timeout?: number; + json?: true | "strict" | "force"; + gunzip?: boolean | "force"; + maxBytes?: number; +} + +interface RequestResponse { + res: http.IncomingMessage, + payload: any, +} + +declare type RequestCallback = (uri: string, options: RequestOptions & { payload?: any }) => void; +declare type ResponseCallback = (err: Boom | undefined, details: { req: http.ClientRequest, res: http.IncomingMessage | undefined, start: number, url: Url.URL }) => void; + +declare class WreckEventEmitter extends events.EventEmitter { + on(event: "request", listener: RequestCallback): this; + on(event: "response", listener: ResponseCallback): this; +} interface WreckObject { - defaults: (options: any) => WreckObject; + defaults: (options: RequestOptions) => WreckObject; - request: (method: string, uri: string, options: any, callback?: (err: any, response: http.IncomingMessage) => void) => http.ClientRequest; + request: (method: string, uri: string, options: RequestOptions) => Promise & { req: http.ClientRequest }; - read: (response: http.IncomingMessage, options: any, callback: (err: any, payload: any) => void) => void; + read: (response: http.IncomingMessage, options: ReadOptions) => Promise; - get: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; - post: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; - patch: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; - put: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; - delete: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + get: (uri: string, options: RequestOptions & ReadOptions) => Promise; + post: (uri: string, options: RequestOptions & ReadOptions) => Promise; + patch: (uri: string, options: RequestOptions & ReadOptions) => Promise; + put: (uri: string, options: RequestOptions & ReadOptions) => Promise; + delete: (uri: string, options: RequestOptions & ReadOptions) => Promise; toReadableStream: (payload: any, encoding?: string) => stream.Readable; @@ -29,8 +72,11 @@ interface WreckObject { agents: { http: http.Agent, - https: http.Agent + https: http.Agent, + httpsAllowUnauthorized: http.Agent }; + + events?: WreckEventEmitter; } declare var wreck: WreckObject; diff --git a/types/wreck/v7/index.d.ts b/types/wreck/v7/index.d.ts new file mode 100644 index 0000000000..e695cf00a9 --- /dev/null +++ b/types/wreck/v7/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for wreck 7.0.0 +// Project: https://github.com/hapijs/wreck +// Definitions by: Marcin Porębski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + + +import http = require('http'); +import stream = require('stream'); + + +interface WreckObject { + defaults: (options: any) => WreckObject; + + request: (method: string, uri: string, options: any, callback?: (err: any, response: http.IncomingMessage) => void) => http.ClientRequest; + + read: (response: http.IncomingMessage, options: any, callback: (err: any, payload: any) => void) => void; + + get: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + post: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + patch: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + put: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + delete: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + + toReadableStream: (payload: any, encoding?: string) => stream.Readable; + + parseCacheControl: (field: string) => any; + + agents: { + http: http.Agent, + https: http.Agent + }; +} + +declare var wreck: WreckObject; + +export = wreck; diff --git a/types/wreck/v7/tsconfig.json b/types/wreck/v7/tsconfig.json new file mode 100644 index 0000000000..f67dc5c5fa --- /dev/null +++ b/types/wreck/v7/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "wreck": [ + "wreck/v7" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "wreck-tests.ts" + ] +} \ No newline at end of file diff --git a/types/wreck/v7/tslint.json b/types/wreck/v7/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/wreck/v7/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} diff --git a/types/wreck/v7/wreck-tests.ts b/types/wreck/v7/wreck-tests.ts new file mode 100644 index 0000000000..163f65ffa1 --- /dev/null +++ b/types/wreck/v7/wreck-tests.ts @@ -0,0 +1,38 @@ + +import Wreck = require('wreck'); + +Wreck.get('https://google.com/', {}, function (err: any, res: any, payload: any) { + /* do stuff */ +}); + + +var method = 'GET'; // GET, POST, PUT, DELETE +var uri = 'https://google.com/'; +var readableStream = Wreck.toReadableStream('foo=bar'); + +var wreck = Wreck.defaults({ + headers: { 'x-foo-bar': 123 } +}); + +// cascading example -- does not alter `wreck` +var wreckWithTimeout = wreck.defaults({ + timeout: 5 +}); + +// all attributes are optional +var options = { + maxBytes: 1048576, // 1 MB, default: unlimited + rejectUnauthorized: true +}; + +var optionalCallback = function (err: any, res: any) { + + /* handle err if it exists, in which case res will be undefined */ + + // buffer the response stream + Wreck.read(res, null, function (err: any, body: any) { + /* do stuff */ + }); +}; + +var req = wreck.request(method, uri, options, optionalCallback); diff --git a/types/wreck/wreck-tests.ts b/types/wreck/wreck-tests.ts index 163f65ffa1..1b3ff1820d 100644 --- a/types/wreck/wreck-tests.ts +++ b/types/wreck/wreck-tests.ts @@ -1,7 +1,7 @@ import Wreck = require('wreck'); -Wreck.get('https://google.com/', {}, function (err: any, res: any, payload: any) { +Wreck.get('https://google.com/', {}).then((response) => { /* do stuff */ }); @@ -30,9 +30,11 @@ var optionalCallback = function (err: any, res: any) { /* handle err if it exists, in which case res will be undefined */ // buffer the response stream - Wreck.read(res, null, function (err: any, body: any) { + Wreck.read(res, null).then((payload) => { /* do stuff */ }); }; -var req = wreck.request(method, uri, options, optionalCallback); +var req = wreck.request(method, uri, options).then((response) => { + /* do stuff */ +}); diff --git a/types/xmldoc/index.d.ts b/types/xmldoc/index.d.ts index d4e9f92ec6..87d3403ebb 100644 --- a/types/xmldoc/index.d.ts +++ b/types/xmldoc/index.d.ts @@ -6,31 +6,35 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped): // TypeScript Version: 2.1 export class XmlDocument extends XmlElement { - constructor(xmlString: string); + constructor(xml: string); doctype: string; } -export class XmlElement { - constructor(tag: XmlElement); +export type XmlNode = XmlElement | XmlTextNode | XmlCDataNode | XmlCommentNode; +export class XmlElement { + constructor(tag: XmlTag); + + type: 'element'; name: string; attr: XmlAttributes; val: string; - children: XmlElement[]; - firstChild: XmlElement; - lastChild: XmlElement; + children: XmlNode[]; + firstChild: XmlNode | null; + lastChild: XmlNode | null; line: number; column: number; position: number; startTagPosition: number; - eachChild(func: (child: XmlElement, index?: number, array?: XmlElement[]) => void): void; - childNamed(name: string): XmlElement; + eachChild(iterator: (child: XmlElement, index: number, array: XmlNode[]) => void): void; + eachChild(iterator: (this: T, child: XmlElement, index: number, array: XmlNode[]) => void, context: T): void; + childNamed(name: string): XmlElement | undefined; childrenNamed(name: string): XmlElement[]; - childWithAttribute(name: string, value?: string): XmlElement; - descendantWithPath(path: string): XmlElement; - valueWithPath(path: string): string; + childWithAttribute(name: string, value?: string | null): XmlElement | undefined; + descendantWithPath(path: string): XmlElement | undefined; + valueWithPath(path: string): string | undefined; toString(opts?: XmlOptions): string; toStringWithIndent(indent: string, opts?: XmlOptions): string; } @@ -38,6 +42,9 @@ export class XmlElement { export class XmlTextNode { constructor(text: string); + type: 'text'; + text: string; + toString(opts?: XmlOptions): string; toStringWithIndent(indent: string, opts?: XmlOptions): string; } @@ -45,6 +52,9 @@ export class XmlTextNode { export class XmlCDataNode { constructor(cdata: string); + type: 'cdata'; + cdata: string; + toString(opts?: XmlOptions): string; toStringWithIndent(indent: string, opts?: XmlOptions): string; } @@ -52,6 +62,9 @@ export class XmlCDataNode { export class XmlCommentNode { constructor(comment: string); + type: 'comment'; + comment: string; + toString(opts?: XmlOptions): string; toStringWithIndent(indent: string, opts?: XmlOptions): string; }
d(`・∀・)b @@ -53,8 +53,8 @@ export class ReactTooltipTest extends React.PureComponent { =( •̀д•́) - =( •̀д•́) - new Date().toISOString(), 1000]} /> + =( •̀д•́) + new Date(dateString).toISOString(), 1000]} /> d(`・∀・)b +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; + +export interface YouTubeEmbedProps { + id: string; + aspectRatio?: string; + prependSrc?: string; + appendSrc?: string; + width?: number; +} + +export default class YouTubeEmbed extends React.Component {} diff --git a/types/react-youtube-embed/react-youtube-embed-tests.tsx b/types/react-youtube-embed/react-youtube-embed-tests.tsx new file mode 100644 index 0000000000..f520c4646b --- /dev/null +++ b/types/react-youtube-embed/react-youtube-embed-tests.tsx @@ -0,0 +1,4 @@ +import * as React from "react"; +import YouTubeEmbed from "react-youtube-embed"; + +const YouTubeEmbedExample = () => ; diff --git a/types/react-youtube-embed/tsconfig.json b/types/react-youtube-embed/tsconfig.json new file mode 100644 index 0000000000..eb57aecf6c --- /dev/null +++ b/types/react-youtube-embed/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "react-youtube-embed-tests.tsx"] +} diff --git a/types/react-youtube-embed/tslint.json b/types/react-youtube-embed/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-youtube-embed/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/reactstrap/lib/Button.d.ts b/types/reactstrap/lib/Button.d.ts index 50f69b1fb1..bf75bcec8e 100644 --- a/types/reactstrap/lib/Button.d.ts +++ b/types/reactstrap/lib/Button.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface ButtonProps extends React.HTMLProps { @@ -7,7 +8,7 @@ export interface ButtonProps extends React.HTMLProps { color?: string; disabled?: boolean; tag?: React.ReactType; - innerRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: React.Ref; onClick?: React.MouseEventHandler; size?: any; @@ -17,5 +18,5 @@ export interface ButtonProps extends React.HTMLProps { cssModule?: CSSModule; } -declare const Button: React.StatelessComponent; +declare class Button extends React.Component {} export default Button; diff --git a/types/reactstrap/lib/CardLink.d.ts b/types/reactstrap/lib/CardLink.d.ts index 9425571de5..1a24b55658 100644 --- a/types/reactstrap/lib/CardLink.d.ts +++ b/types/reactstrap/lib/CardLink.d.ts @@ -2,7 +2,7 @@ import { CSSModule } from '../index'; export interface CardLinkProps extends React.HTMLAttributes { tag?: React.ReactType; - innerRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: React.Ref; className?: string; cssModule?: CSSModule; href?: string; diff --git a/types/reactstrap/lib/Carousel.d.ts b/types/reactstrap/lib/Carousel.d.ts index 1fc992ada2..1f21364cdf 100644 --- a/types/reactstrap/lib/Carousel.d.ts +++ b/types/reactstrap/lib/Carousel.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface CarouselProps extends React.HTMLProps { @@ -14,5 +15,5 @@ export interface CarouselProps extends React.HTMLProps { cssModule?: CSSModule } -declare const Carousel: React.StatelessComponent; +declare class Carousel extends React.Component {} export default Carousel; diff --git a/types/reactstrap/lib/CarouselItem.d.ts b/types/reactstrap/lib/CarouselItem.d.ts index 6be3c28d5e..88e93dfcf1 100644 --- a/types/reactstrap/lib/CarouselItem.d.ts +++ b/types/reactstrap/lib/CarouselItem.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface Transition { @@ -16,5 +17,5 @@ export interface CarouselItemProps extends React.HTMLProps, Transit slide?: boolean; } -declare const CarouselItem: React.StatelessComponent; +declare class CarouselItem extends React.Component {} export default CarouselItem; diff --git a/types/reactstrap/lib/Collapse.d.ts b/types/reactstrap/lib/Collapse.d.ts index 9fa6ebd4ad..d83ff45666 100644 --- a/types/reactstrap/lib/Collapse.d.ts +++ b/types/reactstrap/lib/Collapse.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface CollapseProps extends React.HTMLProps { @@ -19,5 +20,5 @@ export interface CollapseProps extends React.HTMLProps { onExited?: () => void; } -declare const Collapse: React.StatelessComponent; +declare class Collapse extends React.Component {} export default Collapse; diff --git a/types/reactstrap/lib/Dropdown.d.ts b/types/reactstrap/lib/Dropdown.d.ts index 52194dac65..4d892fff5c 100644 --- a/types/reactstrap/lib/Dropdown.d.ts +++ b/types/reactstrap/lib/Dropdown.d.ts @@ -1,6 +1,7 @@ +import * as React from 'react'; import { CSSModule } from '../index'; -export type Direction = +export type Direction = | "up" | "down" | "left" @@ -30,5 +31,5 @@ export interface DropdownProps extends Props { /* intentionally blank */ } -declare const Dropdown: React.StatelessComponent; +declare class Dropdown extends React.Component {} export default Dropdown; diff --git a/types/reactstrap/lib/DropdownItem.d.ts b/types/reactstrap/lib/DropdownItem.d.ts index 598c2fbfc8..723e4707d4 100644 --- a/types/reactstrap/lib/DropdownItem.d.ts +++ b/types/reactstrap/lib/DropdownItem.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface DropdownItemProps extends React.HTMLAttributes { @@ -13,5 +14,5 @@ export interface DropdownItemProps extends React.HTMLAttributes { active?: boolean; } -declare const DropdownItem: React.StatelessComponent; +declare class DropdownItem extends React.Component {} export default DropdownItem; diff --git a/types/reactstrap/lib/DropdownToggle.d.ts b/types/reactstrap/lib/DropdownToggle.d.ts index 5c27af11ad..d02edd50b2 100644 --- a/types/reactstrap/lib/DropdownToggle.d.ts +++ b/types/reactstrap/lib/DropdownToggle.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface DropdownToggleProps extends React.HTMLAttributes { @@ -16,5 +17,5 @@ export interface DropdownToggleProps extends React.HTMLAttributes { size?: string; } -declare const DropdownToggle: React.StatelessComponent; +declare class DropdownToggle extends React.Component {} export default DropdownToggle; diff --git a/types/reactstrap/lib/Form.d.ts b/types/reactstrap/lib/Form.d.ts index 997f4c4e5c..3b6f846d08 100644 --- a/types/reactstrap/lib/Form.d.ts +++ b/types/reactstrap/lib/Form.d.ts @@ -1,12 +1,13 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface FormProps extends React.HTMLProps { inline?: boolean; tag?: React.ReactType; - innerRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: React.Ref; className?: string; cssModule?: CSSModule; } -declare const Form: React.StatelessComponent; +declare class Form extends React.Component {} export default Form; diff --git a/types/reactstrap/lib/Input.d.ts b/types/reactstrap/lib/Input.d.ts index eddd8089be..9d160ec2c4 100644 --- a/types/reactstrap/lib/Input.d.ts +++ b/types/reactstrap/lib/Input.d.ts @@ -35,7 +35,7 @@ export interface InputProps extends React.InputHTMLAttributes valid?: boolean; invalid?: boolean; tag?: React.ReactType; - innerRef?: string | ((instance: HTMLInputElement) => any); + innerRef?: React.Ref; plaintext?: boolean; addon?: boolean; className?: string; diff --git a/types/reactstrap/lib/Modal.d.ts b/types/reactstrap/lib/Modal.d.ts index cead67c943..1049ec7918 100644 --- a/types/reactstrap/lib/Modal.d.ts +++ b/types/reactstrap/lib/Modal.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; import { FadeProps } from './Fade'; @@ -28,5 +29,5 @@ export interface ModalProps extends React.HTMLAttributes { role?: string; } -declare const Modal: React.StatelessComponent; +declare class Modal extends React.Component {} export default Modal; diff --git a/types/reactstrap/lib/NavLink.d.ts b/types/reactstrap/lib/NavLink.d.ts index 53640c65e1..0fdfdec641 100644 --- a/types/reactstrap/lib/NavLink.d.ts +++ b/types/reactstrap/lib/NavLink.d.ts @@ -1,8 +1,9 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface NavLinkProps extends React.HTMLProps { tag?: React.ReactType; - innerRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: React.Ref; disabled?: boolean; active?: boolean; className?: string; @@ -11,5 +12,5 @@ export interface NavLinkProps extends React.HTMLProps { href?: string; } -declare const NavLink: React.StatelessComponent; +declare class NavLink extends React.Component {} export default NavLink; diff --git a/types/reactstrap/lib/Popover.d.ts b/types/reactstrap/lib/Popover.d.ts index 3012b64485..e1ef254ee2 100644 --- a/types/reactstrap/lib/Popover.d.ts +++ b/types/reactstrap/lib/Popover.d.ts @@ -1,5 +1,4 @@ -/// - +import * as React from 'react'; import { CSSModule } from '../index'; import { Popper } from './Popper'; @@ -19,5 +18,5 @@ export interface PopoverProps extends React.HTMLAttributes { cssModule?: CSSModule; } -declare const Popover: React.StatelessComponent; +declare class Popover extends React.Component {} export default Popover; diff --git a/types/reactstrap/lib/TabContent.d.ts b/types/reactstrap/lib/TabContent.d.ts index 0a180cf3c4..46bf48d079 100644 --- a/types/reactstrap/lib/TabContent.d.ts +++ b/types/reactstrap/lib/TabContent.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface TabContentProps extends React.HTMLAttributes { @@ -7,5 +8,5 @@ export interface TabContentProps extends React.HTMLAttributes { cssModule?: CSSModule; } -declare const TabContent: React.StatelessComponent; +declare class TabContent extends React.Component {} export default TabContent; diff --git a/types/reactstrap/lib/Tooltip.d.ts b/types/reactstrap/lib/Tooltip.d.ts index bf472477c6..9c79c8a6d3 100644 --- a/types/reactstrap/lib/Tooltip.d.ts +++ b/types/reactstrap/lib/Tooltip.d.ts @@ -1,5 +1,4 @@ -/// - +import * as React from 'react'; import { CSSModule } from '../index'; import {Popper} from './Popper'; @@ -23,5 +22,5 @@ export interface TooltipProps extends UncontrolledTooltipProps { isOpen?: boolean; } -declare const Tooltip: React.StatelessComponent; +declare class Tooltip extends React.Component {} export default Tooltip; diff --git a/types/reactstrap/lib/Uncontrolled.d.ts b/types/reactstrap/lib/Uncontrolled.d.ts index d241477adb..d7aed3962f 100644 --- a/types/reactstrap/lib/Uncontrolled.d.ts +++ b/types/reactstrap/lib/Uncontrolled.d.ts @@ -1,12 +1,14 @@ +import * as React from 'react'; + import { UncontrolledAlertProps } from './Alert'; import { UncontrolledButtonDropdownProps } from './ButtonDropdown'; import { UncontrolledDropdownProps } from './Dropdown'; import { UncontrolledTooltipProps } from './Tooltip'; -export const UncontrolledAlert: React.StatelessComponent; -export const UncontrolledButtonDropdown: React.StatelessComponent; -export const UncontrolledDropdown: React.StatelessComponent; -export const UncontrolledTooltip: React.StatelessComponent; +export class UncontrolledAlert extends React.Component {} +export class UncontrolledButtonDropdown extends React.Component {} +export class UncontrolledDropdown extends React.Component {} +export class UncontrolledTooltip extends React.Component {} export { UncontrolledAlertProps } from './Alert'; export { UncontrolledButtonDropdownProps } from './ButtonDropdown'; diff --git a/types/reactstrap/reactstrap-tests.tsx b/types/reactstrap/reactstrap-tests.tsx index 9215bc7ba9..959ac2658b 100644 --- a/types/reactstrap/reactstrap-tests.tsx +++ b/types/reactstrap/reactstrap-tests.tsx @@ -3336,7 +3336,7 @@ const CSSModuleExample = (props: any) => { }; class Example107 extends React.Component { - private input: HTMLInputElement; + private input: HTMLInputElement | null; render() { return { this.input = input; }} />; @@ -3691,8 +3691,34 @@ const Example116 = (props: any) => { ); }; -class Example117 extends React.Component { - render() { - return { console.log(e); }}/>; - } +function Example117() { + const ref = (e: any) => {}; + +