Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Using TypeScript and npm

Lesson 2.2

Overview
Description:
Learn the foundations for TypeScript and npm development

What you will learn:


• Why use TypeScript?
• What is TypeScript’s tsc command line tool?
• How to install npm modules and what they are used for
• The different between input and output files

Lesson Notes
• Create a new CDS environment for this course. You will not need to install the Dynamics 365
Apps.
o You could create a trial in an existing tenant - https://docs.microsoft.com/en-
us/power-platform/admin/trial-environments#create-a-trial-environment-without-
dynamics-365-apps
o You could also create a brand new tenant for your trial -
https://docs.microsoft.com/en-us/powerapps/maker/signup-for-powerapps#get-a-
license-from-scratch
o If you have an existing tenant with capacity you can use the admin center to create a
new environment - https://docs.microsoft.com/en-us/power-platform/admin/create-
environment
• You can grab the PCF Tester Entity Solution from /Module 2 Code/ProPCF_1_0_0_0.zip
• Simple TypeScript quick start - https://bit.ly/TypeScriptQuickStart
• Tsconfig reference - https://bit.ly/tsconfiginfo
• Information on ES6 vs ES5 - https://bit.ly/es6vses5
• Installing the XRM Typescript type definitions
npm install --save @types/xrm
npm install --save cryptr
npm install --save-dev @types/cryptr

• Simple TypeScript:
import Cryptr from 'cryptr';
export async function foo(){
const c = new Cryptr("foo bar");
return await Xrm.WebApi.retrieveRecord("account","123");

Professional PCF Controls for Model Driven Apps © Develop 1 Ltd 2020 Page 1
}

• Running build watch in vscode: Ctrl-Shift-B -> tsc:watch


• Add .gitignore file at root of project: https://git-scm.com/docs/gitignore

Test your Knowledge


1. What is the most common form of JavaScript supported by all browsers?
a. ES5
b. JScript
c. VBScript
d. TypeScript
2. What is a difference between TypeScript compared to ES5
a. Support for asynchronous async/await programming
b. Requires transpilation to run in all browsers
c. Supports modules
d. Requires pollyfills and bundling to run in all browser
e. All of the above
3. What command must be run to download and install the npm modules for the current project
a. npm install
b. npm install -g
c. npm init -g
d. npm init

Professional PCF Controls for Model Driven Apps © Develop 1 Ltd 2020 Page 2

You might also like