🅰️
JavaScript / TypeScript Basic
  • Home
  • JavaScript
    • Basic JavaScript基本構文
    • JavaScript Snippets
    • filter find
  • Vue.js
    • Vue Basic
  • typescript
    • init typescript
    • target / module
    • declaration / 型宣言ファイル
    • JavaScript file include TS & build
    • Build Mode オプション
    • TS基本 関数
    • TS基本 Class
Powered by GitBook
On this page
  • Getting Start
  • install typescript
  • test

Was this helpful?

  1. typescript

init typescript

Getting Start

install typescript

//  if yet
$ npm i -g typescript


// create tsconfig.json
$ tsc --init

tsconfig.json Clean

// Delete Comment Out Line 
$ ^.*    // .*$(\r\n|\r|\n)?
 
$ ^    /*/.*$(\r\n|\r|\n)?

tsconfig.json Basic

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  }
}

test

// create test.ts
export function test(){
  return "test"
}

// command run
$ tsc

// auto create JavaScript => test.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.test = void 0;
function test() {
    return "test";
}
exports.test = test;

PreviousVue BasicNexttarget / module

Last updated 3 years ago

Was this helpful?