Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[extended] convert server/ to TypeScript (#1232)
* npm i typescript * npm install typescript --save-dev * add tsconfig.json * configure tsconfig, add build script, ignore dist dir * add license in packaged.json * npm i --save-dev @types/node * convert config.ts to typescript * add npm run type:check:watch command * convert log.ts with inferred types * npm i --save-dev @types/underscore * Revert "npm i --save-dev @types/underscore" This reverts commit 0ef521b. * npm i --save-dev @types/underscore * fix errors in log.ts * add type declaration for google-cloud__translate * declare module 'boolean'; * convert comments * Revert "convert comments" This reverts commit c7f7e87. * rename comment.js --> comment.ts * convert comment * common.js -> common.ts * type utils/common * constants.js -> constants.ts * cookies.js -> cookies.ts * type cookies * metered.js -> metered.ts * type metered.ts * first pass type parameter.ts * senders.js -> senders.ts * convert email/senders * password.js --> password.ts * convert auth/password * create-user.js -> create-user.ts * convert auth/create-user * sql.js --> sql.ts * pg-query.js -> pg-query.ts * prefer ts-ignore * prettier format remaining js files with vscode prettier plugin * npm i --save-dev prettier * add prettier npm scripts and config * check formatting in npm run test script * session.js --> session.ts * type session * user.js --> user.ts * add default export for log * sort imports for user * 0 ts errors for user * conversation.js --> conversation.ts * first pass at types for conversation. convert exports for user and conversation to ES2020 * server.js -> server.ts * infer all types from usage for server * use intermediate variable with type string[] to ensure that filename is in fact always a string and only a string * server down to 355 ts errors * down to 230 errors in server.ts * fix object is possibly undefined errors. 218 ts errors in server.ts * 143 errors in server.ts * 132 errors, fix string | undefined errors * 132 errors, fix deleted property must be optional errors * 129 errors, fix Type 'undefined' cannot be used as an index type * use intermediate variables to clean up referrer decoding * first refParts, then resultRef * add missing METRICS_IN_RAM import * fix Argument of type 'string | any[]'... errors * fix type mismatch in fb auth function * fix new expression which lacks context types error * widen User type * fix expected number of arguments errors * fix Object is possibly null errors * fix Cannot find name err errors * fix does not exist on type string errors * untangle User and Conversation, fix collision between types and non-stander PascalCase imports * fix property does not exist on error * add Demo type * fix possibly undefined * add Vote type * add Assignment type * 20 errors in server * 9 errors in server.ts * 0 errors in server.ts * app.js -> app.ts * install missing types for bluebird and express libraries * add @ts-nocheck and comment about refactoring for app.ts * convert all module.exports and requires to import, export syntax. back up to 186 typescript errors * add types for fb * ignore new expression whose target lacks a construct signature errors for now * down to 111 typescript errors * fix argument of type typescript errors * label object is of type unknown errors * 0 typescript errors * npm i typescript * npm install typescript --save-dev * add tsconfig.json * configure tsconfig, add build script, ignore dist dir * add license in packaged.json * npm i --save-dev @types/node * convert config.ts to typescript * add npm run type:check:watch command * convert log.ts with inferred types * npm i --save-dev @types/underscore * Revert "npm i --save-dev @types/underscore" This reverts commit 0ef521b. * npm i --save-dev @types/underscore * fix errors in log.ts * add type declaration for google-cloud__translate * declare module 'boolean'; * convert comments * Revert "convert comments" This reverts commit c7f7e87. * rename comment.js --> comment.ts * convert comment * common.js -> common.ts * type utils/common * constants.js -> constants.ts * cookies.js -> cookies.ts * type cookies * metered.js -> metered.ts * type metered.ts * first pass type parameter.ts * senders.js -> senders.ts * convert email/senders * password.js --> password.ts * convert auth/password * create-user.js -> create-user.ts * convert auth/create-user * sql.js --> sql.ts * pg-query.js -> pg-query.ts * prefer ts-ignore * prettier format remaining js files with vscode prettier plugin * npm i --save-dev prettier * add prettier npm scripts and config * check formatting in npm run test script * session.js --> session.ts * type session * user.js --> user.ts * add default export for log * sort imports for user * 0 ts errors for user * conversation.js --> conversation.ts * first pass at types for conversation. convert exports for user and conversation to ES2020 * server.js -> server.ts * infer all types from usage for server * use intermediate variable with type string[] to ensure that filename is in fact always a string and only a string * server down to 355 ts errors * down to 230 errors in server.ts * fix object is possibly undefined errors. 218 ts errors in server.ts * 143 errors in server.ts * 132 errors, fix string | undefined errors * 132 errors, fix deleted property must be optional errors * 129 errors, fix Type 'undefined' cannot be used as an index type * use intermediate variables to clean up referrer decoding * first refParts, then resultRef * add missing METRICS_IN_RAM import * fix Argument of type 'string | any[]'... errors * fix type mismatch in fb auth function * fix new expression which lacks context types error * widen User type * fix expected number of arguments errors * fix Object is possibly null errors * fix Cannot find name err errors * fix does not exist on type string errors * untangle User and Conversation, fix collision between types and non-stander PascalCase imports * fix property does not exist on error * add Demo type * fix possibly undefined * add Vote type * add Assignment type * 20 errors in server * 9 errors in server.ts * 0 errors in server.ts * app.js -> app.ts * install missing types for bluebird and express libraries * add @ts-nocheck and comment about refactoring for app.ts * convert all module.exports and requires to import, export syntax. back up to 186 typescript errors * add types for fb * ignore new expression whose target lacks a construct signature errors for now * down to 111 typescript errors * fix argument of type typescript errors * label object is of type unknown errors * 0 typescript errors * update Procfile to include build step and dist dir * update pg-connection-string from v2.0.0 to v2.5.0 * fix pgConnectionString arg undefined bug * disambiguate pg postgress library and dbPgQuery custom wrapper * add npm run start script for server * update to intercom-client@2.11.2 * add build:watch script * add additional check that process.env.INTERCOM_ACCESS_TOKEN is defined before trying to create a new Intercom client * run build as part of start script, add new run:dev script * add npm install to start command * run:dev --> serve:dev * fix makefile and dockerfile, remove xip.io, run build and use dist dir * rename serve:dev serve * call npm run serve in dockerfile * fix typescript config * fix usage of npm run serve in start command * move build command to later in server dockerfile * switch back to CommonJS bundle type * use outDir instead of outFile since CommonJS doesn't support outFile * adding types * dockerfile additions to ensure install * add nodemon * adding moderation types * first try connecting vscode debug to node inside docker config * auto generated vscode * move inspect into command * 9229 * expose port, build command in docker * 9229 again * successful debug attach * Added non-default export to pg-query.ts to allow function to be loaded in server.js. * Bugfix: Don't type iterator in for loop, as it compiled to void(0) aka undefined. * Bugfix: Loaded DEV_MODE envvar using prior get() func. Co-authored-by: micahstubbs <micah.stubbs@gmail.com> Co-authored-by: Colin Megill <colinmegill@gmail.com>
- Loading branch information
As mentioned below, this should really be in the
docker-compose.dev.yml
overlay. Resolving this on fc95762.See #555 for issue tracking this.