macです。
vscodeでコマンド+シフト+Pでタスクランナーの構成を出してもその項目に
「TypeScript - tsconfig.json TypeScriptプロジェクトをコンパイル」
が出てこず、tsからjsが作れません(>_<)
解決策を知ってる方、教えてください!
一番下のjsonの名前が「tsconfig.json」です。
html
1<!DOCTYPE html> 2<html lang="en"> 3 4<head> 5 <meta charset="UTF-8"> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7 <meta http-equiv="X-UA-Compatible" content="ie=edge"> 8 <title>Document</title> 9 10 <style> 11 body { 12 padding: 30px; 13 } 14 </style> 15 16</head> 17 18<body> 19 20 <script type="text/javascript" src="jscode.js"></script> 21 22</body> 23 24</html>
typescript
1class Dog{ 2 name: string; 3 4 constructor(name:string){ 5 this.name = name; 6 } 7 8 sayHello(){ 9 return this.name+"だワン"; 10 } 11} 12 13let shiro = new Dog("白太郎"); 14 15document.body.innerHTML = shiro.sayHello();
json
1{ "compilerOptions": { "outFile": "jscode.js" } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。