TypeScript Syntax Reference Docs (not recommended for actual use but published)
Need to give instructions for configuring a MacBook to run TypeScript and Node before releasing this story as safe.
Really everything below are just personal notes from diving into TypeScript. While I plan to publish an actual TypeScript Syntax Reference Documentation of sorts in the future, this one is still in development.
tsc index.ts
Will compile your ts file into a js file so it is readable as JavaScript.
node index.js
will print your object etc. whatever you had compiled in your ts file in JavaScript
ts-node index.ts
will run tsc index.ts and node index.js all at once
interface Todo {
id: number;
title: sting;
completed: boolean;
}
Why do we care about types? Answer: They give the TypeScript compiler information to analyze our code for errors
In TypeScript, what has a type? Answer: any value
What is a type? Answer: A shortcut to refer to the different properties and functions(methods) a value has
INTERFACES:
The goal of an interface is to: Answer: Define a new type
npm install -g parcel-bundler
tool to help us run TypeScript in the browser
parcel index.html
Will compile ts to js
npm install faker
Within directory you are working in will create dependencies necessary to run everything faker has to offer
import faker from ‘faker’
Will be necessary at the top of your file to use faker in that specific file
npm install @types/faker
One instance of a type definition file
grabbing a google api key: you will create a new project with an api key and enable maps JavaScript API, then place it in a script tag
<script src=”https://maps.googleapis.com/maps/api/js?key="></script>
https://maps.googleapis.com/maps/api/js?key=
npm install @types/googlemaps
type definition file within the directory you are working in for google
command + shift + P
fold level 2 in vscode