Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidystephenson/1b5089cadb8f1c6a4f7c781d607fb756 to your computer and use it in GitHub Desktop.
Save davidystephenson/1b5089cadb8f1c6a4f7c781d607fb756 to your computer and use it in GitHub Desktop.
const x = 'hello!!!'
console.log(x)
const y = 42
type List = [first: string, second: string, third: number]
const list: List = ['a', 'b', 3]
function describe <T> (value?: T) {
console.log('The value is:', value)
}
describe()
describe()
function square (x: number) {
return x * x
}
interface Car {
model: string
distance: number
speed: number
licenseHistory: List
}
const car: Car = {
model: 'Prius',
distance: 100,
speed: 50,
licenseHistory: ['a', 'b', 1]
}
class Airplane {
engineCount: number
maker: string
constructor (engineCount: number, maker: string) {
this.engineCount = engineCount
this.maker = maker
}
}
console.log(Airplane)
const airplane = new Airplane(2, 'Cessna') // Object
console.log(airplane.engineCount)
const squaredEngineCount = square(airplane.engineCount)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment