From 3bd6e5adb4804fe39c5f9f11caacfee9254e9675 Mon Sep 17 00:00:00 2001 From: Max Bischof <106820326+bischofmax@users.noreply.github.com> Date: Fri, 30 Aug 2024 13:07:19 +0200 Subject: [PATCH] BC-7807 Adjust tsconfig (#12) --- nest-cli.json | 4 ++-- src/infra/metrics/metrics.service.ts | 3 ++- src/infra/storage/storage.service.ts | 2 ++ src/modules/server/api/websocket.gateway.ts | 1 + src/modules/worker/worker.service.ts | 1 + tsconfig.json | 14 ++++++++------ 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/nest-cli.json b/nest-cli.json index 7ee8d882..96c94f45 100644 --- a/nest-cli.json +++ b/nest-cli.json @@ -8,7 +8,7 @@ "projects": { "server": { "type": "application", - "root": "apps/server", + "root": ".", "entryFile": "apps/tldraw-server.js", "sourceRoot": "src", "compilerOptions": { @@ -17,7 +17,7 @@ }, "worker": { "type": "application", - "root": "apps/worker", + "root": ".", "entryFile": "apps/tldraw-worker.js", "sourceRoot": "src", "compilerOptions": { diff --git a/src/infra/metrics/metrics.service.ts b/src/infra/metrics/metrics.service.ts index f90a4201..ebb0be16 100644 --- a/src/infra/metrics/metrics.service.ts +++ b/src/infra/metrics/metrics.service.ts @@ -1,4 +1,5 @@ import { Injectable } from '@nestjs/common'; +// @ts-expect-error - @y/redis is only having jsdoc types import { Api } from '@y/redis'; import { Gauge, Histogram, register } from 'prom-client'; @@ -25,7 +26,7 @@ const methodDurationHistogram = new Histogram({ const originalGetDoc = Api.prototype.getDoc; -Api.prototype.getDoc = async function (room, docId) { +Api.prototype.getDoc = async function (room: string, docId: string) { const end = methodDurationHistogram.startTimer(); const result = await originalGetDoc.call(this, room, docId); diff --git a/src/infra/storage/storage.service.ts b/src/infra/storage/storage.service.ts index 0b1bc531..3208e214 100644 --- a/src/infra/storage/storage.service.ts +++ b/src/infra/storage/storage.service.ts @@ -19,6 +19,7 @@ export class StorageService { if (s3Endpoint) { this.logger.log('using s3 store'); + // @ts-expect-error - @y/redis is only having jsdoc types const { createS3Storage } = await import('@y/redis/storage/s3'); store = createS3Storage(bucketName); @@ -28,6 +29,7 @@ export class StorageService { } catch (e) {} } else { this.logger.log('ATTENTION! using in-memory store'); + // @ts-expect-error - @y/redis is only having jsdoc types const { createMemoryStorage } = await import('@y/redis/storage/memory'); store = createMemoryStorage(); } diff --git a/src/modules/server/api/websocket.gateway.ts b/src/modules/server/api/websocket.gateway.ts index 5d928fef..4299f4cb 100644 --- a/src/modules/server/api/websocket.gateway.ts +++ b/src/modules/server/api/websocket.gateway.ts @@ -1,5 +1,6 @@ import { Inject, Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; +// @ts-expect-error - @y/redis is only having jsdoc types import { registerYWebsocketServer } from '@y/redis'; import { TemplatedApp } from 'uws'; import { AuthorizationService } from '../../../infra/authorization/authorization.service.js'; diff --git a/src/modules/worker/worker.service.ts b/src/modules/worker/worker.service.ts index 37e8d6c6..f146d223 100644 --- a/src/modules/worker/worker.service.ts +++ b/src/modules/worker/worker.service.ts @@ -1,5 +1,6 @@ import { Injectable, OnModuleInit } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; +// @ts-expect-error - @y/redis is only having jsdoc types import { createWorker } from '@y/redis'; import { RedisService } from '../../infra/redis/redis.service.js'; import { StorageService } from '../../infra/storage/storage.service.js'; diff --git a/tsconfig.json b/tsconfig.json index 3b9bea95..c394b33e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,12 +11,14 @@ "allowSyntheticDefaultImports": true, "sourceMap": true, "outDir": "./dist", - "baseUrl": "./", + "baseUrl": "./src", "incremental": true, - "strictNullChecks": false, - "noImplicitAny": false, - "strictBindCallApply": false, - "forceConsistentCasingInFileNames": false, - "noFallthroughCasesInSwitch": false, + "strictNullChecks": true, + "noImplicitAny": true, + "strictBindCallApply": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "strictFunctionTypes": true, + "strictPropertyInitialization": true, } }