Elio	Struyf
Waldek Mastykarz
October	26th,	2017
TypeScript	for	SharePoint	
Developers
What	is	TypeScript?
It’s	a	strongly-typed	superset	
of	JavaScript
Benefits	of	using	TypeScript
• Allows	for	large-scale	JavaScript	applications
• Follows	ECMAScript	future	proposal
• Supports	plain-old	JavaScript
• Not	excluding	any	JavaScript	feature
• Improved	consistency
• IDE	support	(e.g.	Intellisense)
• Compile-time	type	checking
Benefits	of	using	TypeScript
Hey,	show	us	some	code!
How	to	use	TypeScript	in	SharePoint	projects
Where	to	use	it?
• SharePoint	Framework
• JSLink
• Display	templates
• CEWP	/	SEWP
• Custom	actions
• Single	Page	Application
• Add-ins
Prerequisites
VSCode
• Node.js
• npm
• TypeScript	compiler
Visual	Studio
• TypeScript	add-in	for	VS
• NuGet
• MSBuild targets	configuration
When	to	use	what?
VSCode
• SharePoint	Framework
• JSLink
• Display	templates
• CEWP	/	SEWP
• Custom	actions
• Single	Page	Application
Visual	Studio
• SharePoint	Framework
• Add-ins
Using	TypeScript	in	VSCode
- Install:	npm install	-g	typescript
- Create	a	TS	file
- Run:	tsc index.ts --target	ES5
- Use	the	JS	file
Steps	to	start	
writing
Tip:	use	a	tsconfig.json	file	to	
simplify	things
But,	how	do	you	get	
intellisense?
By	declaration	/	definition	
files:	*.d.ts
npm install	@types/<module>	--save-dev
Display	
Templates
Demo
Using	TypeScript	in	Visual	
Studio
But,	how	do	you	get	
intellisense?
Use	NuGet to	install	
definitions
Add-inDemo
Questions?

SPUnite17 TypeScript for SharePoint Developers