diff --git a/notNeededPackages.json b/notNeededPackages.json index 677f96f5b61188..94eea83afb10c8 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -540,6 +540,10 @@ "libraryName": "browserslist", "asOfVersion": "4.15.0" }, + "bs58": { + "libraryName": "bs58", + "asOfVersion": "5.0.0" + }, "bson": { "libraryName": "bson", "asOfVersion": "4.2.0" @@ -6927,6 +6931,10 @@ "libraryName": "survey-knockout", "asOfVersion": "0.10.0" }, + "survicate__react-native-survicate": { + "libraryName": "@survicate/react-native-survicate", + "asOfVersion": "4.0.0" + }, "svg-pan-zoom": { "libraryName": "svg-pan-zoom", "asOfVersion": "3.4.0" @@ -7119,6 +7127,10 @@ "libraryName": "tiny-secp256k1", "asOfVersion": "2.0.0" }, + "title": { + "libraryName": "title", + "asOfVersion": "4.0.0" + }, "title-case": { "libraryName": "title-case", "asOfVersion": "1.1.2" diff --git a/types/bs58/.npmignore b/types/bs58/.npmignore deleted file mode 100644 index 54c4a06d9989eb..00000000000000 --- a/types/bs58/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts -/v3/ diff --git a/types/bs58/bs58-tests.ts b/types/bs58/bs58-tests.ts deleted file mode 100644 index 0a10d38c0656e8..00000000000000 --- a/types/bs58/bs58-tests.ts +++ /dev/null @@ -1,8 +0,0 @@ -import bs58 = require("bs58"); - -const bytes = Buffer.from("003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187", "hex"); -const address = bs58.encode(bytes); -address; // $ExpectType string - -bs58.decode(address); // $ExpectType Buffer || Buffer -bs58.decodeUnsafe(address); // $ExpectType Buffer | undefined || Buffer | undefined diff --git a/types/bs58/index.d.ts b/types/bs58/index.d.ts deleted file mode 100644 index 5c454e84281b67..00000000000000 --- a/types/bs58/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// - -import { BaseConverter } from "base-x"; - -declare const base58: BaseConverter; - -export = base58; diff --git a/types/bs58/package.json b/types/bs58/package.json deleted file mode 100644 index 709e748ca65800..00000000000000 --- a/types/bs58/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "private": true, - "name": "@types/bs58", - "version": "4.0.9999", - "projects": [ - "https://github.com/cryptocoinjs/bs58" - ], - "dependencies": { - "@types/node": "*", - "base-x": "^3.0.6" - }, - "devDependencies": { - "@types/bs58": "workspace:." - }, - "owners": [ - { - "name": "Ilya Mochalov", - "githubUsername": "chrootsu" - }, - { - "name": "BendingBender", - "githubUsername": "BendingBender" - } - ] -} diff --git a/types/bs58/tsconfig.json b/types/bs58/tsconfig.json deleted file mode 100644 index 32566044ab579a..00000000000000 --- a/types/bs58/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "bs58-tests.ts" - ] -} diff --git a/types/bs58/v3/.npmignore b/types/bs58/v3/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/bs58/v3/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/bs58/v3/bs58-tests.ts b/types/bs58/v3/bs58-tests.ts deleted file mode 100644 index ba7ad004b71bbe..00000000000000 --- a/types/bs58/v3/bs58-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import * as bs58 from "bs58"; - -{ - let encoded: string; - - encoded = bs58.encode([255]); - encoded = bs58.encode({ 0: 255, length: 1 }); -} - -const decoded: number[] = bs58.decode("5Q"); diff --git a/types/bs58/v3/index.d.ts b/types/bs58/v3/index.d.ts deleted file mode 100644 index 8155104be8ada6..00000000000000 --- a/types/bs58/v3/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as BaseX from "base-x"; - -declare namespace base58 {} - -declare let base58: BaseX.BaseConverter; - -export = base58; diff --git a/types/bs58/v3/package.json b/types/bs58/v3/package.json deleted file mode 100644 index fa8ae04ff48fc5..00000000000000 --- a/types/bs58/v3/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "private": true, - "name": "@types/bs58", - "version": "3.0.9999", - "projects": [ - "https://github.com/cryptocoinjs/bs58" - ], - "dependencies": { - "@types/base-x": "^1.0.30" - }, - "devDependencies": { - "@types/bs58": "workspace:." - }, - "owners": [ - { - "name": "Ilya Mochalov", - "githubUsername": "chrootsu" - } - ] -} diff --git a/types/bs58/v3/tsconfig.json b/types/bs58/v3/tsconfig.json deleted file mode 100644 index 32566044ab579a..00000000000000 --- a/types/bs58/v3/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "bs58-tests.ts" - ] -} diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index c66096b76b89ac..86fe6d38839f89 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -12844,6 +12844,21 @@ declare namespace Office { interface AttachmentDetailsCompose { /** * Gets a value that indicates the attachment's type. + * + * @remarks + * + * **Important**: + * + * - In Outlook on the web and new Outlook on Windows, a message or appointment that's locally saved then attached using + * drag-and-drop or the **Attach Item** option is of type `Office.MailboxEnums.AttachmentType.File`. The file name extension is + * returned in the `name` property. However, a message or appointment that's attached using the **Forward as Attachment** option + * is of type `Office.MailboxEnums.AttachmentType.Item`. In this case, an extension isn't returned in the `name` property. + * + * - In classic Outlook on Windows, a message or appointment that's attached using drag-and-drop, **Attach File**, or + * **Forward as Attachment** is of type `Office.MailboxEnums.AttachmentType.Item`. A file name extension isn't returned in the `name` property. + * + * - In Outlook on Mac, a message or appointment that's attached using drag-and-drop, **Attach Item**, or **Forward as Attachment** is of type + * `Office.MailboxEnums.AttachmentType.File`. The file name extension is returned in the `name` property. */ attachmentType: MailboxEnums.AttachmentType | string; /** @@ -12857,8 +12872,22 @@ declare namespace Office { /** * Gets the name of the attachment. * - * **Important**: For message or appointment items that were attached by drag-and-drop or "Attach Item", - * `name` includes a file extension in Outlook on Mac, but excludes the extension on the web or on Windows. + * @remarks + * + * **Important**: + * + * - An attachment of type `Office.MailboxEnums.AttachmentType.Item` doesn't return a file name extension in the `name` property. + * + * - In Outlook on the web and new Outlook on Windows, a message or appointment that's locally saved then attached using + * drag-and-drop or the **Attach Item** option is of type `Office.MailboxEnums.AttachmentType.File`. The file name extension is + * returned in the `name` property. However, a message or appointment that's attached using the **Forward as Attachment** option + * is of type `Office.MailboxEnums.AttachmentType.Item`. In this case, an extension isn't returned in the `name` property. + * + * - In classic Outlook on Windows, a message or appointment that's attached using drag-and-drop, **Attach File**, or + * **Forward as Attachment** is of type `Office.MailboxEnums.AttachmentType.Item`. A file name extension isn't returned in the `name` property. + * + * - In Outlook on Mac, a message or appointment that's attached using drag-and-drop, **Attach Item**, or **Forward as Attachment** is of type + * `Office.MailboxEnums.AttachmentType.File`. The file name extension is returned in the `name` property. */ name: string; /** @@ -12909,8 +12938,9 @@ declare namespace Office { /** * Gets the name of the attachment. * - * **Important**: For message or appointment items that were attached by drag-and-drop or "Attach Item", - * `name` includes a file extension in Outlook on Mac, but excludes the extension on the web or on Windows. + * @remarks + * + * **Important**: An attachment of type `Office.MailboxEnums.AttachmentType.Item` doesn't return a file name extension in the `name` property. */ name: string; /** @@ -21499,6 +21529,10 @@ declare namespace Office { * * - To retrieve the JSON data, call `Office.context.mailboxitem.getInitializationContextAsync`. If you create a JSON string using * `JSON.stringify()` and assign it to the `contextData` property, you must parse the string using `JSON.parse()` once you retrieve it. + * + * - To prevent the task pane of a notification message from relaunching if it's already open, implement a handler for the `Office.EventType.InitializationContextChanged` event. + * You can then pass the {@link https://learn.microsoft.com/javascript/api/outlook/office.initializationcontextchangedeventargs?view=outlook-js-1.15&preserve-view=true | event arguments} + * to the `contextData` property. */ contextData: any; } @@ -23644,6 +23678,10 @@ declare namespace Office { * * - When you configure a button in the Smart Alerts dialog to run a function, a button for the function is also added to the ribbon or action bar of the Outlook client. * Use the `contextData` option to distinguish when a user runs the function from the Smart Alerts dialog. + * + * - To prevent the task pane of a Smart Alerts add-in from relaunching if it's already open, implement a handler for the `Office.EventType.InitializationContextChanged` event. + * You can then pass the {@link https://learn.microsoft.com/javascript/api/outlook/office.initializationcontextchangedeventargs?view=outlook-js-1.15&preserve-view=true | event arguments} + * to the `contextData` property. */ contextData?: any; /** @@ -23823,6 +23861,10 @@ declare namespace Office { * * - If you implement a task pane to open after a reported message is processed, when the `event.completed` call occurs, any task pane that's open or pinned is closed. * + * - To prevent the task pane of a spam-reporting add-in from relaunching if it's already open, implement a handler for the `Office.EventType.InitializationContextChanged` event. + * You can then pass the {@link https://learn.microsoft.com/javascript/api/outlook/office.initializationcontextchangedeventargs?view=outlook-js-1.15&preserve-view=true | event arguments} + * to the `contextData` property. + * * - To retrieve the value of the `contextData` property, you must call `Office.context.mailbox.item.getInitializationContextAsync` in the JavaScript implementation * of your task pane. If you create a JSON string using `JSON.stringify()` and assign it to the `contextData` property, you must parse the string using * `JSON.parse()` once you retrieve it. diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 6e35732cbdf82e..c4ad7c38e14064 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -12757,6 +12757,21 @@ declare namespace Office { interface AttachmentDetailsCompose { /** * Gets a value that indicates the attachment's type. + * + * @remarks + * + * **Important**: + * + * - In Outlook on the web and new Outlook on Windows, a message or appointment that's locally saved then attached using + * drag-and-drop or the **Attach Item** option is of type `Office.MailboxEnums.AttachmentType.File`. The file name extension is + * returned in the `name` property. However, a message or appointment that's attached using the **Forward as Attachment** option + * is of type `Office.MailboxEnums.AttachmentType.Item`. In this case, an extension isn't returned in the `name` property. + * + * - In classic Outlook on Windows, a message or appointment that's attached using drag-and-drop, **Attach File**, or + * **Forward as Attachment** is of type `Office.MailboxEnums.AttachmentType.Item`. A file name extension isn't returned in the `name` property. + * + * - In Outlook on Mac, a message or appointment that's attached using drag-and-drop, **Attach Item**, or **Forward as Attachment** is of type + * `Office.MailboxEnums.AttachmentType.File`. The file name extension is returned in the `name` property. */ attachmentType: MailboxEnums.AttachmentType | string; /** @@ -12770,8 +12785,23 @@ declare namespace Office { /** * Gets the name of the attachment. * - * **Important**: For message or appointment items that were attached by drag-and-drop or "Attach Item", - * `name` includes a file extension in Outlook on Mac, but excludes the extension on the web or on Windows. + * @remarks + * + * **Important**: + * + * - An attachment of type `Office.MailboxEnums.AttachmentType.Item` doesn't return a file name extension in the `name` property. + * + * - In Outlook on the web and new Outlook on Windows, a message or appointment that's locally saved then attached using + * drag-and-drop or the **Attach Item** option is of type `Office.MailboxEnums.AttachmentType.File`. The file name extension is + * returned in the `name` property. However, a message or appointment that's attached using the **Forward as Attachment** option + * is of type `Office.MailboxEnums.AttachmentType.Item`. In this case, an extension isn't returned in the `name` property. + * + * - In classic Outlook on Windows, a message or appointment that's attached using drag-and-drop, **Attach Item**, or + * **Forward as Attachment** is of type `Office.MailboxEnums.AttachmentType.Item`. A file name extension isn't returned in the `name` property. + * A calendar item that's attached + * + * - In Outlook on Mac, a message or appointment that's attached using drag-and-drop, **Attach Item**, or **Forward as Attachment** is of type + * `Office.MailboxEnums.AttachmentType.File`. The file name extension is returned in the `name` property. */ name: string; /** @@ -12822,8 +12852,9 @@ declare namespace Office { /** * Gets the name of the attachment. * - * **Important**: For message or appointment items that were attached by drag-and-drop or "Attach Item", - * `name` includes a file extension in Outlook on Mac, but excludes the extension on the web or on Windows. + * @remarks + * + * **Important**: An attachment of type `Office.MailboxEnums.AttachmentType.Item` doesn't return a file name extension in the `name` property. */ name: string; /** @@ -21033,6 +21064,10 @@ declare namespace Office { * * - To retrieve the JSON data, call `Office.context.mailboxitem.getInitializationContextAsync`. If you create a JSON string using * `JSON.stringify()` and assign it to the `contextData` property, you must parse the string using `JSON.parse()` once you retrieve it. + * + * - To prevent the task pane of a notification message from relaunching if it's already open, implement a handler for the `Office.EventType.InitializationContextChanged` event. + * You can then pass the {@link https://learn.microsoft.com/javascript/api/outlook/office.initializationcontextchangedeventargs?view=outlook-js-1.15&preserve-view=true | event arguments} + * to the `contextData` property. */ contextData: any; } @@ -23119,6 +23154,10 @@ declare namespace Office { * * - When you configure a button in the Smart Alerts dialog to run a function, a button for the function is also added to the ribbon or action bar of the Outlook client. * Use the `contextData` option to distinguish when a user runs the function from the Smart Alerts dialog. + * + * - To prevent the task pane of a Smart Alerts add-in from relaunching if it's already open, implement a handler for the `Office.EventType.InitializationContextChanged` event. + * You can then pass the {@link https://learn.microsoft.com/javascript/api/outlook/office.initializationcontextchangedeventargs?view=outlook-js-1.15&preserve-view=true | event arguments} + * to the `contextData` property. */ contextData?: any; /** @@ -23298,6 +23337,10 @@ declare namespace Office { * * - If you implement a task pane to open after a reported message is processed, when the `event.completed` call occurs, any task pane that's open or pinned is closed. * + * - To prevent the task pane of a spam-reporting add-in from relaunching if it's already open, implement a handler for the `Office.EventType.InitializationContextChanged` event. + * You can then pass the {@link https://learn.microsoft.com/javascript/api/outlook/office.initializationcontextchangedeventargs?view=outlook-js-1.15&preserve-view=true | event arguments} + * to the `contextData` property. + * * - To retrieve the value of the `contextData` property, you must call `Office.context.mailbox.item.getInitializationContextAsync` in the JavaScript implementation * of your task pane. If you create a JSON string using `JSON.stringify()` and assign it to the `contextData` property, you must parse the string using * `JSON.parse()` once you retrieve it. diff --git a/types/survicate__react-native-survicate/.npmignore b/types/survicate__react-native-survicate/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/survicate__react-native-survicate/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/survicate__react-native-survicate/index.d.ts b/types/survicate__react-native-survicate/index.d.ts deleted file mode 100644 index 91428cc67b819c..00000000000000 --- a/types/survicate__react-native-survicate/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -declare namespace Survicate { - /** - * @deprecated Use `initializeSdk` instead. This method will be removed in version 4.0. - */ - function initialize(): void; - function initializeSdk(): void; - function invokeEvent(eventName: string): void; - function enterScreen(screenName: string): void; - function leaveScreen(screenName: string): void; - function setUserId(screenName: string): void; - function setUserTrait(traitName: string, traitValue: string): void; - function reset(): void; -} - -export default Survicate; diff --git a/types/survicate__react-native-survicate/package.json b/types/survicate__react-native-survicate/package.json deleted file mode 100644 index 6dd98196d1e326..00000000000000 --- a/types/survicate__react-native-survicate/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "private": true, - "name": "@types/survicate__react-native-survicate", - "version": "1.1.9999", - "projects": [ - "https://github.com/Survicate/react-native-survicate#readme" - ], - "devDependencies": { - "@types/survicate__react-native-survicate": "workspace:." - }, - "owners": [ - { - "name": "Ian Mobley", - "githubUsername": "iMobs" - }, - { - "name": "Pawel", - "githubUsername": "SurvicatePawelGodlewski" - } - ] -} diff --git a/types/survicate__react-native-survicate/survicate__react-native-survicate-tests.ts b/types/survicate__react-native-survicate/survicate__react-native-survicate-tests.ts deleted file mode 100644 index 9e9652f148bd4f..00000000000000 --- a/types/survicate__react-native-survicate/survicate__react-native-survicate-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Survicate from "@survicate/react-native-survicate"; - -Survicate.initialize(); -Survicate.initializeSdk(); -Survicate.invokeEvent("test"); -Survicate.enterScreen("test"); -Survicate.leaveScreen("test"); -Survicate.setUserId("test"); -Survicate.setUserTrait("test", "value"); -Survicate.reset(); diff --git a/types/survicate__react-native-survicate/tsconfig.json b/types/survicate__react-native-survicate/tsconfig.json deleted file mode 100644 index ff73273e6bfeb7..00000000000000 --- a/types/survicate__react-native-survicate/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "survicate__react-native-survicate-tests.ts" - ] -} diff --git a/types/title/.npmignore b/types/title/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/title/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/title/index.d.ts b/types/title/index.d.ts deleted file mode 100644 index 57dddfd198632e..00000000000000 --- a/types/title/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This package correctly capitalizes your titles as per The Chicago Manual of Style. - * Furthermore, all of Vercel's product names are capitalized properly as well. - */ -declare function title(string: string, options?: title.Options): string; - -declare namespace title { - interface Options { - /** - * @default undefined - */ - special?: string[] | undefined; - } -} - -export = title; diff --git a/types/title/package.json b/types/title/package.json deleted file mode 100644 index c7c39dd7cc2244..00000000000000 --- a/types/title/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "private": true, - "name": "@types/title", - "version": "3.4.9999", - "projects": [ - "https://github.com/vercel/title#readme" - ], - "devDependencies": { - "@types/title": "workspace:." - }, - "owners": [ - { - "name": "Fahad", - "githubUsername": "fa7ad" - }, - { - "name": "Piotr Błażejewicz", - "githubUsername": "peterblazejewicz" - } - ] -} diff --git a/types/title/title-tests.ts b/types/title/title-tests.ts deleted file mode 100644 index e5d8b2cd658988..00000000000000 --- a/types/title/title-tests.ts +++ /dev/null @@ -1,8 +0,0 @@ -import title = require("title"); - -title("tHe cHicaGo maNual oF StyLe"); // $ExpectType string -title("TypeSCRipt is great", {}); // $ExpectType string -// $ExpectType string -title("TypeSCRipt is great", { - special: ["TypeScript"], -}); diff --git a/types/title/tsconfig.json b/types/title/tsconfig.json deleted file mode 100644 index e5c6679db7b57e..00000000000000 --- a/types/title/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "title-tests.ts" - ] -} diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 21c6fa5bb1e6b1..e89eee0f61e0d3 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -1169,7 +1169,18 @@ declare namespace Xrm { */ getAttribute( delegateFunction?: Collection.MatchingDelegate, - ): Collection.ItemCollection | null; + ): Attributes.Attribute[]; + + /** + * Gets a collection of attributes using a delegate function or gets all attributes if delegateFunction is not provided. + * @param T An Attribute type. + * @param delegateFunction A matching delegate function + * @returns An collection of attributes. + * @see {@link https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + getAttribute( + delegateFunction?: Collection.MatchingDelegate, + ): T[]; /** * Gets a control by name or index. @@ -1194,7 +1205,18 @@ declare namespace Xrm { */ getControl( delegateFunction?: Collection.MatchingDelegate, - ): Collection.ItemCollection | null; + ): Controls.Control[]; + + /** + * Gets a collection of controls using a delegate function or gets all controls if delegateFunction is not provided. + * @param T A Control type. There is no guarentee that all control types will match. + * @param delegateFunction A matching delegate function. + * @returns An collection of controls. + * @see {@link https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/collections External Link: Collections (Client API reference)} + */ + getControl( + delegateFunction?: Collection.MatchingDelegate, + ): T[]; } /** @@ -1859,7 +1881,7 @@ declare namespace Xrm { * @param delegate A matching delegate function * @returns A T[] whose members have been validated by delegate or a entire array of T[] */ - get(delegate?: MatchingDelegate): T[] | null; + get(delegate?: MatchingDelegate): T[]; /** * Gets the length of the collection. diff --git a/types/xrm/xrm-tests.ts b/types/xrm/xrm-tests.ts index 131723fb6946c4..a04a5648da3ce0 100644 --- a/types/xrm/xrm-tests.ts +++ b/types/xrm/xrm-tests.ts @@ -723,3 +723,38 @@ function ActionOnPostsave(context: Xrm.Events.PostSaveEventContext) { console.log(args.getSaveErrorInfo()); } } + +// Demonstrate non-index/name getAttribute/getControl returns non-null array + +function GetAll(context: Xrm.FormContext) { + const allAttributes: Xrm.Attributes.Attribute[] = context.getAttribute(); + const allAttributesTyped: Xrm.Attributes.StringAttribute[] = context.getAttribute(); + const noAttributes: Xrm.Attributes.Attribute[] = context.getAttribute(() => false); + const noAttributesTyped: Xrm.Attributes.StringAttribute[] = context.getAttribute( + () => false, + ); + if ( + allAttributes === null + || allAttributesTyped === null + || noAttributes === null + || noAttributesTyped === null + ) { + throw new Error("Will return an empty array if no attributes are present."); + } + + const allControls: Xrm.Controls.Control[] = context.getControl(); + const allControlsTyped: Xrm.Controls.StringControl[] = context.getControl(); + const itemCollection: Xrm.Controls.Control[] = (context.getControl("mySection") as unknown as Xrm.Controls.Section) + .controls.get(); + const noControls: Xrm.Controls.Control[] = context.getControl(() => false); + const noControlsTyped: Xrm.Controls.StringControl[] = context.getControl(() => false); + if ( + allControls === null + || allControlsTyped === null + || itemCollection === null + || noControls === null + || noControlsTyped === null + ) { + throw new Error("Will return an empty array if no controls are present."); + } +}