TypeScript-Node-Starter icon indicating copy to clipboard operation
TypeScript-Node-Starter copied to clipboard

Added "strict" to project.

Open CarlosSolrac opened this issue 6 years ago • 0 comments
trafficstars

Instead of using process.env.VARIABLE, export uppercase variables. process.env.VARIABLE is interpreted as "string | undefined" causing compiler errors.

.env.example

  • change the SESSION_SECRET to pass "code spell checker"
  • add NODE_ENV
  • add SENDGRID
  • add TZ to set timezone to UTC
  • change MONGODB_URI to MONGODB_URI_PROD to distinguish it from MONGODB_URI_LOCAL

tsconfig.json

  • add strict to the entire project

src/app.ts

  • specify param types
  • check for possible undefined

src/config/passport.ts

  • stop using process.env
  • check for possible undefined
  • Set type for user parameter
  • Remove "any" from serializeUser definition

src/controller/api.ts

  • test for nullable token

src/controller/contact.ts

  • stop using process.env

src/controller/user.ts

  • stop using process.env
  • check for possible undefined

src/model/user.ts

  • fix bcrypt params
  • fix comparePasswordFunction params

src/util/logger.ts

  • stop using process.env

src/util/secrets.ts

  • stop using process.env

CarlosSolrac avatar Oct 13 '19 23:10 CarlosSolrac