current working directory (linux)
current full path (linux)
/** TS-Module w/ Declarations (Part 1/4) | |
* http://TGRstack.com/#ts-module_articles_part-1 | |
* ./src/index.ts (Section 2. Figure 03.) | |
**/ | |
import {default as HelloWorld} from './HelloWorld' | |
const FirstPart: string = "Hi" | |
const LastPart: string = "Earth" | |
console.log(HelloWorld(FirstPart, LastPart)) |
/** TS-Module w/ Declarations (Part 1/4) | |
* http://TGRstack.com/#ts-module_articles_part-1 | |
* ./src/HelloWorld.ts (Section 2. Figure 02.) | |
**/ | |
function HelloWorldMaker(first: string, second: string): string { | |
return `${first} ${second}` | |
} | |
export default HelloWorldMaker |
### TS-Module w/ Declarations (Part 1/4) | |
# http://TGRstack.com/#ts-module_articles_part-1 | |
# Init HelloWorld.ts (Section 2. Figure 01.) | |
### | |
falieson:./ts-module/$ mkdir src | |
falieson:./ts-module/$ touch src/index.ts src/HelloWorld.ts |
/** TS-Module w/ Declarations (Part 1/4) | |
* http://TGRstack.com/#ts-module_articles_part-1 | |
* example of ENUM w/ Redux ./tsconfig.json (Section 1. Figure 04.) | |
**/ | |
interface ISomeObject { | |
firstKey: string; | |
secondKey: string; | |
thirdKey: string; | |
[key: string]: string; | |
} |
/** TS-Module w/ Declarations (Part 1/4) | |
* http://TGRstack.com/#ts-module_articles_part-1 | |
* example of ENUM w/ Redux ./tsconfig.json (Section 1. Figure 03.) | |
**/ | |
const ACTION_NAME = 'ACTION_NAME' // <== this is the ENUM | |
const actions = { | |
doAction: function (someArgs) { | |
return { | |
type: ACTION_NAME, | |
payload: someArgs |
/** TS-Module w/ Declarations (Part 1/4) | |
* http://TGRstack.com/#ts-module_articles_part-1 | |
* description of ./tsconfig.json (Section 1. Figure 02.) | |
* complete file: https://github.com/Falieson/2018-typescript-module/blob/master/tsconfig.json | |
**/ | |
{ | |
"exclude": [ // regexes to exclude from the compiler | |
"dist", // don't compile previous iterations of the output | |
"**/*.spec|test.ts" // don't compile testes |
### TS-Module w/ Declarations (Part 1/4) | |
# http://TGRstack.com/#ts-module_articles_part-1 | |
# Project Initialization (Section 1. Figure 01.) | |
### | |
falieson:~/$ mkdir -p ~/Code/Templates/ts-module/ && cd ~/Code/Templates/ts-module | |
falieson:./ts-module/$ npm i -g typescript # global install (i'm using version 2.8.3) | |
falieson:./ts-module/$ tsc -init |
// data/models/Passport.ts | |
import * as mongoose from 'mongoose' | |
import * as passport from 'passport' | |
import * as passportLocalMongoose from 'passport-local-mongoose' | |
import Model from './mongoose' | |
(mongoose as any).Promise = global.Promise | |
const ObjectIdType = mongoose.Schema.Types.ObjectId |
// db/postgres.config.js | |
module.exports = { | |
client: 'pg', | |
connection: 'postgres://postgres@localhost:5432/ult1706', | |
migrations: { | |
directory: __dirname + "/migrations", | |
tableName: 'migrations', | |
}, | |
seeds: { | |
directory: __dirname + "/seeds", |