From 892bc67f321c1db486862bb29a73bc9af4565b2f Mon Sep 17 00:00:00 2001 From: clownwilleatme Date: Tue, 7 Feb 2017 17:08:22 +1100 Subject: [PATCH] Modifying the unit test to fix errors Modify the unit test to set the string variables which are used for calls to attribute.setSubmitMode and attribute.setRequiredLevel to use const strings as strings declared as var or let fail. This is by design for string union types in TypeScript - see: https://github.com/Microsoft/TypeScript/issues/9489 --- xrm/xrm-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xrm/xrm-tests.ts b/xrm/xrm-tests.ts index fd371c94de..1242236f36 100644 --- a/xrm/xrm-tests.ts +++ b/xrm/xrm-tests.ts @@ -124,15 +124,15 @@ Xrm.Page.ui.setFormNotification("Test", level, "uniqueId"); /// Demonstrate Requirement Level and Submit Mode both via string parameters and String Literal Types let requirementLevel: Xrm.Page.RequirementLevel = "none"; -let requirementLevelString = "none"; +const requirementLevelString = "none"; let submitMode: Xrm.Page.SubmitMode = "always"; -let submitModeString = "always"; +const submitModeString = "always"; let attribute = Xrm.Page.getAttribute("customerid"); attribute.setSubmitMode(submitMode); -attribute.setSubmitMode(submitMode); +attribute.setSubmitMode(submitModeString); // Works if the string is a const attribute.setRequiredLevel(requirementLevel); -attribute.setRequiredLevel(requirementLevelString); +attribute.setRequiredLevel(requirementLevelString); // Works if the string is a const /// Demonstrate v8 AutoComplete