This repository was archived by the owner on Mar 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtypescript.txt
29 lines (18 loc) · 1.53 KB
/
typescript.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
TypeScript
==========
It is possible to use FullCalendar and [Scheduler](/scheduler) with **TypeScript**, a type-aware superset of the JavaScript language that compiles down to JavaScript. TypeScript is great for the maintainability of large JavaScript projects, however, it is probably overkill for smaller projects. [Learn more about TypeScript »](https://www.typescriptlang.org/)
As of FullCalendar version `3.8.2` and Scheduler version `1.9.2`, the TypeScript definition files come bundled when you `npm install` these libs. However, jQuery, which is unfortunately still a dependency of FullCalendar, does **not** come bundled with TypeScript definitions, so you must install them like this:
$ npm install --save-dev @types/jquery
You will then need to set up some sort of build system that compiles TypeScript to JavaScript. You can use the `tsc` compiler directly or you can use a more sophisticated system like [Webpack](https://webpack.js.org/).
- [View the **FullCalendar + TypeScript + Webpack** example repo »](https://github.com/fullcalendar/typescript-example)
- [View the **FullCalendar Scheduler + TypeScript + Webpack** example repo »](https://github.com/fullcalendar/scheduler-typescript-example)
Once you have your build system set up, you can begin to write type-aware code like this:
**example.ts**:
import * as $ from 'jquery';
import 'fullcalendar';
$(function() {
let containerEl: JQuery = $('#calendar');
containerEl.fullCalendar({
// options here
});
});