Skip to content

Commit 8c867ea

Browse files
committed
Fix build for ts-node
1 parent 71bd990 commit 8c867ea

File tree

7 files changed

+59
-89
lines changed

7 files changed

+59
-89
lines changed

backend/index.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const generateUniqueName = () => {
4141
return name;
4242
};
4343

44+
type PartialPick<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
45+
4446
io.on("connection", (socket) => {
4547
const id = uuid.v4();
4648
const name = generateUniqueName();
@@ -148,16 +150,19 @@ const createRetroSession = (sessionId: string) => {
148150
}
149151
});
150152

151-
socket.on("create-note", (event: Note) => {
152-
const newNote = notes.createNote({
153-
ownedBy: user.id,
154-
content: `crap\n // ${name} `,
155-
secret: true,
156-
...event,
157-
});
158-
socket.broadcast.emit("update-note", newNote);
159-
socket.emit("create-note", newNote);
160-
});
153+
socket.on(
154+
"create-note",
155+
(event: PartialPick<Note, "ownedBy" | "content" | "secret">) => {
156+
const newNote = notes.createNote({
157+
ownedBy: user.id,
158+
content: `crap\n // ${name} `,
159+
secret: true,
160+
...event,
161+
});
162+
socket.broadcast.emit("update-note", newNote);
163+
socket.emit("create-note", newNote);
164+
}
165+
);
161166

162167
socket.on("move-note", ({ id, x, y }: Note) => {
163168
const newNote = notes.updateNote(id, { x, y });

backend/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
"version": "1.0.0",
44
"main": "index.js",
55
"license": "MIT",
6-
"type": "module",
76
"scripts": {
87
"start": "ts-node-dev index.ts"
98
},
109
"dependencies": {
11-
"@types/lodash": "4.14.158",
1210
"adjective-adjective-animal": "^1.3.3",
1311
"lodash": "^4.17.19",
1412
"socket.io": "^2.3.0",
1513
"uuid": "^8.3.0"
1614
},
1715
"devDependencies": {
16+
"@types/lodash": "4.14.158",
1817
"@types/socket.io": "^2.1.4",
1918
"@types/uuid": "^7.0.0",
20-
"ts-node-dev": "^1.0.0-pre.56",
21-
"typescript": "^3.8.3"
19+
"ts-node-dev": "^1.0.0-pre.60",
20+
"ts-node": "^9.0.0",
21+
"typescript": "^4.0.2"
2222
}
2323
}

backend/tsconfig.json

Lines changed: 16 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,20 @@
11
{
22
"compilerOptions": {
3-
/* Basic Options */
4-
// "incremental": true, /* Enable incremental compilation */
5-
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
6-
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
7-
// "lib": [], /* Specify library files to be included in the compilation. */
8-
// "allowJs": true, /* Allow javascript files to be compiled. */
9-
// "checkJs": true, /* Report errors in .js files. */
10-
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
11-
// "declaration": true, /* Generates corresponding '.d.ts' file. */
12-
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
13-
// "sourceMap": true, /* Generates corresponding '.map' file. */
14-
// "outFile": "./", /* Concatenate and emit output to single file. */
15-
// "outDir": "./", /* Redirect output structure to the directory. */
16-
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
17-
// "composite": true, /* Enable project compilation */
18-
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
19-
// "removeComments": true, /* Do not emit comments to output. */
20-
// "noEmit": true, /* Do not emit outputs. */
21-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
22-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
23-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
24-
25-
/* Strict Type-Checking Options */
26-
"strict": true, /* Enable all strict type-checking options. */
27-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
28-
// "strictNullChecks": true, /* Enable strict null checks. */
29-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
30-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
31-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
32-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
33-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
34-
35-
/* Additional Checks */
36-
// "noUnusedLocals": true, /* Report errors on unused locals. */
37-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
38-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
39-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
40-
41-
/* Module Resolution Options */
42-
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
43-
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
44-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
45-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
46-
// "typeRoots": [], /* List of folders to include type definitions from. */
47-
// "types": [], /* Type declaration files to be included in compilation. */
48-
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
49-
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
50-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
51-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
52-
53-
/* Source Map Options */
54-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
55-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
56-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
57-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
58-
59-
/* Experimental Options */
60-
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
61-
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62-
63-
/* Advanced Options */
64-
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
3+
"target": "es2019",
4+
"module": "commonjs",
5+
"lib": [
6+
"es2019",
7+
"es2020.promise",
8+
"es2020.bigint",
9+
"es2020.string"
10+
],
11+
"strict": true,
12+
"typeRoots": [
13+
"./node_modules/@types",
14+
"./types"
15+
],
16+
"esModuleInterop": true,
17+
"skipLibCheck": true,
18+
"forceConsistentCasingInFileNames": true
6519
}
6620
}
File renamed without changes.

backend/yarn.lock

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -963,10 +963,10 @@ trim-newlines@^1.0.0:
963963
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"
964964
integrity sha1-WIeWa7WCpFA6QetST301ARgVphM=
965965

966-
ts-node-dev@^1.0.0-pre.56:
967-
version "1.0.0-pre.56"
968-
resolved "https://registry.yarnpkg.com/ts-node-dev/-/ts-node-dev-1.0.0-pre.56.tgz#b74c0d1db2d98f005ad73f9eaa0a3c0a231f14da"
969-
integrity sha512-+2a3FAShOja+W5X6ZxKgf1PG3kOOkHCiYzSu6s3lwhLVxeMBusJudcv7W6cZKOTp7+L7hPkKW97t1CGw7bCDaA==
966+
ts-node-dev@^1.0.0-pre.60:
967+
version "1.0.0-pre.60"
968+
resolved "https://registry.yarnpkg.com/ts-node-dev/-/ts-node-dev-1.0.0-pre.60.tgz#428b051264d9b2b3e58a8a4a02a5d36692436e20"
969+
integrity sha512-S1X/2dMH2cxzFEiOWo5r/DTD0oElKbEpG8lnWoEA1LrwxXMFCJs71vIMaXPu6p8ud3MHMI2Ans3syDQ8mkjEUg==
970970
dependencies:
971971
chokidar "^3.4.0"
972972
dateformat "~1.0.4-1.2.3"
@@ -991,6 +991,17 @@ ts-node@^8.10.2:
991991
source-map-support "^0.5.17"
992992
yn "3.1.1"
993993

994+
ts-node@^9.0.0:
995+
version "9.0.0"
996+
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.0.0.tgz#e7699d2a110cc8c0d3b831715e417688683460b3"
997+
integrity sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==
998+
dependencies:
999+
arg "^4.1.0"
1000+
diff "^4.0.1"
1001+
make-error "^1.1.1"
1002+
source-map-support "^0.5.17"
1003+
yn "3.1.1"
1004+
9941005
tsconfig@^7.0.0:
9951006
version "7.0.0"
9961007
resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-7.0.0.tgz#84538875a4dc216e5c4a5432b3a4dec3d54e91b7"
@@ -1001,10 +1012,10 @@ tsconfig@^7.0.0:
10011012
strip-bom "^3.0.0"
10021013
strip-json-comments "^2.0.0"
10031014

1004-
typescript@^3.8.3:
1005-
version "3.8.3"
1006-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
1007-
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==
1015+
typescript@^4.0.2:
1016+
version "4.0.2"
1017+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.2.tgz#7ea7c88777c723c681e33bf7988be5d008d05ac2"
1018+
integrity sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==
10081019

10091020
upper-case-first@^1.1.0:
10101021
version "1.1.2"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"socket.io-client": "^2.3.0",
2929
"styled-components": "^5.1.1",
3030
"tinycolor2": "^1.4.1",
31-
"typescript": "3.8.3",
31+
"typescript": "4.0.2",
3232
"uuid": "^7.0.2",
3333
"xstate": "4.8.0"
3434
},

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11063,10 +11063,10 @@ typedarray@^0.0.6:
1106311063
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
1106411064
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
1106511065

11066-
typescript@3.8.3:
11067-
version "3.8.3"
11068-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
11069-
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==
11066+
typescript@4.0.2:
11067+
version "4.0.2"
11068+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.2.tgz#7ea7c88777c723c681e33bf7988be5d008d05ac2"
11069+
integrity sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==
1107011070

1107111071
unicode-canonical-property-names-ecmascript@^1.0.4:
1107211072
version "1.0.4"

0 commit comments

Comments
 (0)