Skip to content

Instantly share code, notes, and snippets.

@RebeccaBakels
Last active February 28, 2023 17:03
Show Gist options
  • Save RebeccaBakels/5ee702ef2fffc4114939f1ee9a9b3c4a to your computer and use it in GitHub Desktop.
Save RebeccaBakels/5ee702ef2fffc4114939f1ee9a9b3c4a to your computer and use it in GitHub Desktop.
from root directory:
mkdir 'name-app'
cd into 'name-app'
npm init -y
npm install lite-server --save-dev
npm install -g typescript -OR- npm install typescript --save-dev
npm i
npx tsc --init
code .
package.json:
"start": "lite-server"
tsconfig.json:
"target": "es5"
uncomment and add:
"outDir": "./build",
"rootDir": "./src",
create index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="./build/index.js"></script>
</body>
</html>
add new folder called 'src' and 'build'
within 'src' make a new file called 'index.ts'
console.log('Hello TS')
npm start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment