samnoh / ts-blockchain

TypeScript + Blockchain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScript Blockchian

Install

npm install -g typescript
npm install --save-dev typescript tsc-watch
  • package.json
"start": "tsc-watch --onSuccess \"node build/index.js\"",
"build": "tsc"

TIL

tsconfig.json

  • Typescript Compile Option
{
    "compilerOptions": {
        "module": "commonjs",
        "target": "ES2015",
        "sourceMap": false,
        "removeComments": true,
        "outDir": "./build"
    },
    "include": ["src/*"],
    "exclude": ["node_modules", "build"]
}

Types

  • private, public, protected, readonly
  • ?: optional
class Book {
    private index: number;
    readonly name: string;
    public desc: string;

    constructor(index: number, name: string, desc?: string) {
        this.index = index;
        this.name = name;
    }
}
  • Array
const numbers: number[] = [1, 2, 3];
  • Return type
const print = (num: number): string => `${num}`;

About

TypeScript + Blockchain


Languages

Language:TypeScript 100.0%