{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Jyve TypeScript\n", "[TypeScript](https://www.typescriptlang.org/) is a typed language that compiles to JavaScript. It is also the language in which JupyterLab (and Jyve) are mostly written.\n", "\n", "> ## NOTE\n", "> Due to its typed nature, TypeScript is pretty adamant about redeclarations, etc. Better support for this is pending, but for now, you'll probably want to:\n", "- do any definitions up front\n", "- restart often" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "export interface IAnimal {\n", " sound: string;\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "class Snake implements IAnimal {\n", " private _sound = 'hiss';\n", " get sound(){ return this._sound; }\n", " set sound(sound){ this._sound = sound; }\n", "}\n", "let snake = new Snake()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "snake.sound" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "var x = this.display.display({\n", " \"text/markdown\": \"# hello\"\n", "});" ] } ], "metadata": { "kernelspec": { "display_name": "TypeScript (unsafe) — Jyve", "language": "typescript", "name": "jyve-kyrnel-typescript-unsafe" }, "language_info": { "codemirror_mode": { "name": "typescript" }, "file_extension": ".ts", "mimetype": "application/x-typescript", "name": "typescript", "nbconvert_exporter": "typescript", "pygments_lexer": "typescript", "version": "2.2.1" } }, "nbformat": 4, "nbformat_minor": 2 }