Last active
July 17, 2018 14:24
-
-
Save ryasmi/a74db64a2944d850b11488f6953988af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as lodash from 'lodash'; | |
import * as moment from 'moment'; | |
// tslint:disable-next-line:no-class | |
class A { | |
public constructor() { return; } | |
} | |
interface B { | |
readonly c: number; | |
} | |
lodash.defaultTo(10, undefined); | |
enum UserRole { | |
basicbitch, | |
benbetts = 'admin', | |
} | |
interface User { | |
readonly name: string; | |
readonly email?: string; | |
readonly role: UserRole; | |
} | |
const dan: User = { | |
name: 'DJ Fresh', | |
role: UserRole.benbetts, | |
}; | |
type C = number | string; | |
interface Dictionary<Value> { | |
readonly [key: string]: Value; | |
} | |
enum PeteEnum { | |
here = 'redux_action_1', | |
there = 'redux_action_2', | |
} | |
const numberDictionary: Dictionary<Number> = { dan: 10, 'dj khaled': -10 }; | |
const x = 10; | |
const y = 'hello'; | |
const z = false; | |
const a: any = {}; | |
const b: number[] = [1, 2, 3]; | |
const c: A = new A(); | |
const d: B = { c: 10 }; | |
const e: C = 'hello'; | |
const f: C = 10; | |
const g: ReadonlyArray<number> = [10]; | |
const add = async (number1: number, number2: number) => { | |
return number1 + number2; | |
}; | |
const today = moment(); | |
const identity = <T>(thing: T) => { | |
return thing; | |
}; | |
const realthing = identity<number>(1); | |
type Adder = ReturnType<typeof add>; | |
// tslint:disable-next-line:no-console | |
console.log(`DJ Fresh > DJ Khaled by ${add(10, 12)}% at ${today}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment