mike-works / sql-fundamentals

Mike North's SQL Fundamentals and Professional SQL Courses
https://frontendmasters.com/courses/sql-fundamentals/
BSD 3-Clause "New" or "Revised" License
169 stars 108 forks source link

Typescript errors #43

Closed gpspake closed 5 years ago

gpspake commented 6 years ago

Using OS X If I run yarn watch I get a bunch of typescript errors but the app runs successfully and I can access it at http://localhost:3000 If I run yarn watch:debug the app blows up with the same errors. I'm going to continue with the course using yarn watch but I'd like to clear these up if possible :)

This happens regardless of the db I use or whether I use npm run vs yarn

npm run watch (app runs with errors)

─(sc-gspake-osx)-(01:09 PM Sat May 12)->
└(~/Code/sql-fundamentals)--> npm run watch

> mikeworks-sql@0.0.0 watch /Users/sc-gspake-osx/Code/sql-fundamentals
> scripty

Executing "/Users/sc-gspake-osx/Code/sql-fundamentals/scripts/watch.sh":

> #!/usr/bin/env sh
> ./node_modules/.bin/nodemon -x "npm run build; npm start"
> 

[nodemon] 1.17.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Users/sc-gspake-osx/Code/sql-fundamentals/src/**/* /Users/sc-gspake-osx/Code/sql-fundamentals/views/**/* /Users/sc-gspake-osx/Code/sql-fundamentals/public/**/*
[nodemon] starting `npm run build; npm start`

> mikeworks-sql@0.0.0 build /Users/sc-gspake-osx/Code/sql-fundamentals
> scripty

Executing "/Users/sc-gspake-osx/Code/sql-fundamentals/scripts/build.sh":

> #!/usr/bin/env sh
> ./node_modules/.bin/tsc

node_modules/@types/handlebars/index.d.ts(28,9): error TS2687: All declarations of 'data' must have identical modifiers.
src/db/postgres-db.ts(77,27): error TS2345: Argument of type 'PoolClient' is not assignable to parameter of type 'Client'.
src/db/postgres-db.ts(101,30): error TS2339: Property 'release' does not exist on type 'Client'.
src/db/postgres-pubsub.ts(6,3): error TS2322: Type 'PoolClient' is not assignable to type 'Client'.
  Property 'end' is missing in type 'PoolClient'.
src/types/handlebars.d.ts(13,5): error TS2717: Subsequent property declarations must have the same type.  Property 'hash' must be of type 'any', but here has type '{ [key: string]: any; }'.
src/types/handlebars.d.ts(14,5): error TS2717: Subsequent property declarations must have the same type.  Property 'fn' must be of type 'TemplateDelegate<any>', but here has type '(ctxt: any) => {}'.
src/types/handlebars.d.ts(15,5): error TS2687: All declarations of 'data' must have identical modifiers.
src/types/handlebars.d.ts(15,5): error TS2717: Subsequent property declarations must have the same type.  Property 'data' must be of type 'any', but here has type '{ exphbs: ExpHbsState; root: { settings: any; request: Request; }; }'.
src/ws.ts(54,19): error TS2345: Argument of type '(this: WebSocket) => void' is not assignable to parameter of type '(this: WebSocket, ...args: any[]) => void'.
  The 'this' types of each signature are incompatible.
    Type 'WebSocket' is not assignable to type 'WebSocket'. Two different types with this name exist, but they are unrelated.
      Property 'isAlive' is missing in type 'WebSocket'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mikeworks-sql@0.0.0 build: `scripty`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the mikeworks-sql@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sc-gspake-osx/.npm/_logs/2018-05-12T18_22_26_892Z-debug.log

> mikeworks-sql@0.0.0 start /Users/sc-gspake-osx/Code/sql-fundamentals
> scripty

Executing "/Users/sc-gspake-osx/Code/sql-fundamentals/scripts/start.sh":

> #!/usr/bin/env sh
> node dist/index.js

info: Database Type: SQLite
info: Server listening on http://localhost:3000

npm run watch:debug (app blows up)

┌─(sc-gspake-osx)-(01:06 PM Sat May 12)->
└(~/Code/sql-fundamentals)--> npm run watch:debug

> mikeworks-sql@0.0.0 watch:debug /Users/sc-gspake-osx/Code/sql-fundamentals
> scripty

Executing "/Users/sc-gspake-osx/Code/sql-fundamentals/scripts/watch/debug.sh":

> #!/usr/bin/env sh
> ./node_modules/.bin/nodemon -w src -e ts -x npm run bump
> 

[nodemon] 1.17.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Users/sc-gspake-osx/Code/sql-fundamentals/src/**/*
[nodemon] starting `npm run bump`

> mikeworks-sql@0.0.0 bump /Users/sc-gspake-osx/Code/sql-fundamentals
> npm run build && npm start

> mikeworks-sql@0.0.0 build /Users/sc-gspake-osx/Code/sql-fundamentals
> scripty

Executing "/Users/sc-gspake-osx/Code/sql-fundamentals/scripts/build.sh":

> #!/usr/bin/env sh
> ./node_modules/.bin/tsc

node_modules/@types/handlebars/index.d.ts(28,9): error TS2687: All declarations of 'data' must have identical modifiers.
src/db/postgres-db.ts(77,27): error TS2345: Argument of type 'PoolClient' is not assignable to parameter of type 'Client'.
src/db/postgres-db.ts(101,30): error TS2339: Property 'release' does not exist on type 'Client'.
src/db/postgres-pubsub.ts(6,3): error TS2322: Type 'PoolClient' is not assignable to type 'Client'.
  Property 'end' is missing in type 'PoolClient'.
src/types/handlebars.d.ts(13,5): error TS2717: Subsequent property declarations must have the same type.  Property 'hash' must be of type 'any', but here has type '{ [key: string]: any; }'.
src/types/handlebars.d.ts(14,5): error TS2717: Subsequent property declarations must have the same type.  Property 'fn' must be of type 'TemplateDelegate<any>', but here has type '(ctxt: any) => {}'.
src/types/handlebars.d.ts(15,5): error TS2687: All declarations of 'data' must have identical modifiers.
src/types/handlebars.d.ts(15,5): error TS2717: Subsequent property declarations must have the same type.  Property 'data' must be of type 'any', but here has type '{ exphbs: ExpHbsState; root: { settings: any; request: Request; }; }'.
src/ws.ts(54,19): error TS2345: Argument of type '(this: WebSocket) => void' is not assignable to parameter of type '(this: WebSocket, ...args: any[]) => void'.
  The 'this' types of each signature are incompatible.
    Type 'WebSocket' is not assignable to type 'WebSocket'. Two different types with this name exist, but they are unrelated.
      Property 'isAlive' is missing in type 'WebSocket'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mikeworks-sql@0.0.0 build: `scripty`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the mikeworks-sql@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sc-gspake-osx/.npm/_logs/2018-05-12T18_09_03_670Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mikeworks-sql@0.0.0 bump: `npm run build && npm start`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the mikeworks-sql@0.0.0 bump script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sc-gspake-osx/.npm/_logs/2018-05-12T18_09_03_696Z-debug.log
[nodemon] process failed, unhandled exit code (2)
[nodemon] Error
    at Bus.utils.bus.on (/Users/sc-gspake-osx/Code/sql-fundamentals/node_modules/nodemon/lib/nodemon.js:148:25)
    at emitOne (events.js:121:20)
    at Bus.emit (events.js:211:7)
    at ChildProcess.<anonymous> (/Users/sc-gspake-osx/Code/sql-fundamentals/node_modules/nodemon/lib/monitor/run.js:164:11)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)

using postgres

┌─(sc-gspake-osx)-(01:23 PM Sat May 12)->
└(~/Code/sql-fundamentals)--> DB_TYPE=pg npm run watch

> mikeworks-sql@0.0.0 watch /Users/sc-gspake-osx/Code/sql-fundamentals
> scripty

Executing "/Users/sc-gspake-osx/Code/sql-fundamentals/scripts/watch.sh":

> #!/usr/bin/env sh
> ./node_modules/.bin/nodemon -x "npm run build; npm start"
> 

[nodemon] 1.17.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Users/sc-gspake-osx/Code/sql-fundamentals/src/**/* /Users/sc-gspake-osx/Code/sql-fundamentals/views/**/* /Users/sc-gspake-osx/Code/sql-fundamentals/public/**/*
[nodemon] starting `npm run build; npm start`

> mikeworks-sql@0.0.0 build /Users/sc-gspake-osx/Code/sql-fundamentals
> scripty

Executing "/Users/sc-gspake-osx/Code/sql-fundamentals/scripts/build.sh":

> #!/usr/bin/env sh
> ./node_modules/.bin/tsc

node_modules/@types/handlebars/index.d.ts(28,9): error TS2687: All declarations of 'data' must have identical modifiers.
src/db/postgres-db.ts(77,27): error TS2345: Argument of type 'PoolClient' is not assignable to parameter of type 'Client'.
src/db/postgres-db.ts(101,30): error TS2339: Property 'release' does not exist on type 'Client'.
src/db/postgres-pubsub.ts(6,3): error TS2322: Type 'PoolClient' is not assignable to type 'Client'.
  Property 'end' is missing in type 'PoolClient'.
src/types/handlebars.d.ts(13,5): error TS2717: Subsequent property declarations must have the same type.  Property 'hash' must be of type 'any', but here has type '{ [key: string]: any; }'.
src/types/handlebars.d.ts(14,5): error TS2717: Subsequent property declarations must have the same type.  Property 'fn' must be of type 'TemplateDelegate<any>', but here has type '(ctxt: any) => {}'.
src/types/handlebars.d.ts(15,5): error TS2687: All declarations of 'data' must have identical modifiers.
src/types/handlebars.d.ts(15,5): error TS2717: Subsequent property declarations must have the same type.  Property 'data' must be of type 'any', but here has type '{ exphbs: ExpHbsState; root: { settings: any; request: Request; }; }'.
src/ws.ts(54,19): error TS2345: Argument of type '(this: WebSocket) => void' is not assignable to parameter of type '(this: WebSocket, ...args: any[]) => void'.
  The 'this' types of each signature are incompatible.
    Type 'WebSocket' is not assignable to type 'WebSocket'. Two different types with this name exist, but they are unrelated.
      Property 'isAlive' is missing in type 'WebSocket'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mikeworks-sql@0.0.0 build: `scripty`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the mikeworks-sql@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sc-gspake-osx/.npm/_logs/2018-05-12T18_24_05_825Z-debug.log

> mikeworks-sql@0.0.0 start /Users/sc-gspake-osx/Code/sql-fundamentals
> scripty

Executing "/Users/sc-gspake-osx/Code/sql-fundamentals/scripts/start.sh":

> #!/usr/bin/env sh
> node dist/index.js

info: Database Type: PostgreSQL
info: Server listening on http://localhost:3000
bessfernandez commented 6 years ago

I am also running into the same issue. :(

bessfernandez commented 6 years ago

@mike-north - any ideas? I imagine there are some dependencies out of date that are causing issues but haven't been able to track down which need updating.

bessfernandez commented 6 years ago

Pretty sure this is the culprit: https://github.com/db-migrate/plugin-typescript/issues

janagamap commented 6 years ago

https://github.com/winstonjs/winston/issues/1101 npm i winston@next --save DB_TYPE=pg npm run watch The issue is resovled after updating the winston.

mike-north commented 5 years ago

Latest release should have no typescript errors