From 4d72e931727279599785092908799706031c3f37 Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Tue, 30 Aug 2022 00:08:31 +0300 Subject: [PATCH] chore(deps-dev): typescript@4.8.2 - add several generic constrains per new ts generics behavior - disable lib check until socket.io is fixed https://github.com/socketio/socket.io/issues/4459 - regenerate lock file --- package.json | 2 +- packages/core/src/com/communication.ts | 2 +- packages/core/src/com/types.ts | 2 +- packages/core/src/entities/service.ts | 10 +++++++--- packages/engineer/src/cli-commands.ts | 5 +++-- tsconfig.base.json | 2 +- yarn.lock | 8 ++++---- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 7a0a656bc..7b9ad8ad2 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "sinon": "^14.0.0", "sinon-chai": "^3.7.0", "source-map-loader": "^4.0.0", - "typescript": "~4.7.4", + "typescript": "~4.8.2", "util": "^0.12.4", "webpack": "^5.74.0" }, diff --git a/packages/core/src/com/communication.ts b/packages/core/src/com/communication.ts index 809ae6f35..3583fb463 100644 --- a/packages/core/src/com/communication.ts +++ b/packages/core/src/com/communication.ts @@ -150,7 +150,7 @@ export class Communication { /** * Creates a Proxy for a remote service api. */ - public apiProxy( + public apiProxy( instanceToken: EnvironmentInstanceToken | Promise, { id: api }: IDTag, serviceComConfig: ServiceComConfig = {} diff --git a/packages/core/src/com/types.ts b/packages/core/src/com/types.ts index b8f57fa91..0dbdb8b58 100644 --- a/packages/core/src/com/types.ts +++ b/packages/core/src/com/types.ts @@ -42,7 +42,7 @@ export interface EnvironmentRecord { export type UnknownFunction = (...args: unknown[]) => unknown; -export type AsyncApi = { +export type AsyncApi = { [P in keyof T]: P extends keyof ServiceConfig ? MultiTanentProxyFunction : T[P] extends (...args: any[]) => PromiseLike diff --git a/packages/core/src/entities/service.ts b/packages/core/src/entities/service.ts index fbffa3bfd..151318f65 100644 --- a/packages/core/src/entities/service.ts +++ b/packages/core/src/entities/service.ts @@ -6,7 +6,11 @@ import type { EnvVisibility } from '../types'; import { AllEnvironments, Environment, normEnvVisibility, Universal } from './env'; import { FeatureOutput } from './output'; -export type ServiceRuntime = ProvidedFrom extends Environment +export type ServiceRuntime = ProvidedFrom extends Environment< + string, + EnvironmentTypes, + 'single' +> ? AsyncApi : ProvidedFrom extends Environment ? { @@ -15,13 +19,13 @@ export type ServiceRuntime = ProvidedFrom extends Environment; export class Service< - T, + T extends object, PT, ProvidedFrom extends EnvVisibility, VisibleAt extends EnvVisibility, RemoteAccess extends boolean > extends FeatureOutput { - public static withType() { + public static withType() { return { defineEntity(providedFrom: E_ENV) { return new Service(providedFrom, providedFrom, false); diff --git a/packages/engineer/src/cli-commands.ts b/packages/engineer/src/cli-commands.ts index 069a2cfa9..75b09412b 100644 --- a/packages/engineer/src/cli-commands.ts +++ b/packages/engineer/src/cli-commands.ts @@ -13,6 +13,7 @@ import fs from '@file-services/node'; import { Application } from '@wixc3/engine-scripts'; import { startDevServer } from './utils'; import { parseCliArguments } from '@wixc3/engine-runtime-node'; +import type { ServerListeningHandler } from './feature/dev-server.feature'; const parseBoolean = (value: string) => value === 'true'; const collectMultiple = (val: string, prev: string[]) => [...prev, val]; @@ -123,12 +124,12 @@ export const startCommand: CliCommand = (program) => log, }); - const { port } = await new Promise((resolve) => { + const { port } = await new Promise((resolve: ServerListeningHandler) => { devServerFeature.serverListeningHandlerSlot.register(resolve); }); if (!process.send && featureName && configName && openBrowser === 'true') { - await open(`http://localhost:${port as string}/main.html`); + await open(`http://localhost:${port}/main.html`); } } catch (e) { printErrorAndExit(e); diff --git a/tsconfig.base.json b/tsconfig.base.json index 6c9ff9d7e..b50be36ce 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -70,7 +70,7 @@ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ /* Advanced Options */ - // "skipLibCheck": true, /* Skip type checking of declaration files. */ + "skipLibCheck": true, /* Skip type checking of declaration files. */ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ } } diff --git a/yarn.lock b/yarn.lock index 3d21c862c..c5e0eeb21 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7954,10 +7954,10 @@ typescript-type-utils@^0.1.0: resolved "https://registry.yarnpkg.com/typescript-type-utils/-/typescript-type-utils-0.1.0.tgz#8ea40e5ceb41297184d36a2ef928932ad0f1e407" integrity sha512-UXvYaUWfkUuTf287zYi+AE9pRkdHVcDHXk1N02a/ZmonLH2xpJL8EGzNozT/HNkAF+POlR6Lcx1wgg0ljMLcrw== -typescript@~4.7.4: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== +typescript@~4.8.2: + version "4.8.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790" + integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw== uglify-js@^3.1.4: version "3.17.0"