fix types

This commit is contained in:
undefined committed 2024-01-06 13:39:27 +08:00
1 parent 91179ebe66
commit 98c917ed4a
7 files changed
+11 -18

No files matched your search

-4
View File
@@ -8,8 +8,6 @@ if (process.env.npm_execpath?.includes('yarn')) {
} }
} }
const dir = path.dirname(path.dirname(require.resolve('@types/node/package.json')));
const types = fs.readdirSync(dir).filter((i) => !['sharedworker', 'serviceworker'].includes(i));
const withoutTypes = (data) => ({ const withoutTypes = (data) => ({
...data, ...data,
compilerOptions: Object.fromEntries(Object.entries(data.compilerOptions).filter(([k]) => k !== 'types')), compilerOptions: Object.fromEntries(Object.entries(data.compilerOptions).filter(([k]) => k !== 'types')),
@@ -29,7 +27,6 @@ const compilerOptionsBase = {
experimentalDecorators: true, experimentalDecorators: true,
// emitDecoratorMetadata: true, // emitDecoratorMetadata: true,
incremental: true, incremental: true,
types,
}; };
const baseOutDir = path.resolve(__dirname, '../.cache/ts-out'); const baseOutDir = path.resolve(__dirname, '../.cache/ts-out');
const config = { const config = {
@@ -95,7 +92,6 @@ const UIConfig = {
baseUrl: '.', baseUrl: '.',
outDir: path.join(baseOutDir, 'ui'), outDir: path.join(baseOutDir, 'ui'),
moduleResolution: 'node', moduleResolution: 'node',
types,
paths: { paths: {
'vj/*': [ 'vj/*': [
'./packages/ui-default/*', './packages/ui-default/*',
-1
View File
@@ -38,7 +38,6 @@
"@types/cross-spawn": "^6.0.6", "@types/cross-spawn": "^6.0.6",
"@types/node": "^20.10.6", "@types/node": "^20.10.6",
"@types/semver": "^7.5.6", "@types/semver": "^7.5.6",
"@types/supertest": "^6.0.2",
"autocannon": "^7.14.0", "autocannon": "^7.14.0",
"cac": "^6.7.14", "cac": "^6.7.14",
"chai": "^4.3.10", "chai": "^4.3.10",
-1
View File
@@ -243,7 +243,6 @@ async function handle(ctx: KoaContext, HandlerClass, checker) {
args, request, response, user, domain, UiContext, args, request, response, user, domain, UiContext,
} = ctx.HydroContext; } = ctx.HydroContext;
Object.assign(args, ctx.params); Object.assign(args, ctx.params);
console.log(ctx.HydroContext);
const h = new HandlerClass(ctx, args, request, response, user, domain, UiContext); const h = new HandlerClass(ctx, args, request, response, user, domain, UiContext);
ctx.handler = h; ctx.handler = h;
try { try {
@@ -1,9 +1,9 @@
/* eslint-disable no-restricted-globals */ /* eslint-disable no-restricted-globals */
/// <reference no-default-lib="true" /> /// <reference no-default-lib="true" />
/// <reference lib="ES2015" /> /// <reference lib="webworker" />
/// <reference types="@types/sharedworker" />
import ReconnectingWebsocket from 'reconnecting-websocket'; import ReconnectingWebsocket from 'reconnecting-websocket';
import { FLAG_INFO } from 'vj/constant/message'; import { FLAG_INFO } from 'vj/constant/message';
declare const self: SharedWorkerGlobalScope;
console.log('SharedWorker init'); console.log('SharedWorker init');
@@ -75,7 +75,7 @@ function initConn(path: string, port: MessagePort, cookie: any) {
}; };
} }
onconnect = function (e) { // eslint-disable-line no-undef self.onconnect = function (e) { // eslint-disable-line no-undef
const port = e.ports[0]; const port = e.ports[0];
port.addEventListener('message', (msg: { data: RequestPayload }) => { port.addEventListener('message', (msg: { data: RequestPayload }) => {
-2
View File
@@ -37,8 +37,6 @@
"@types/react": "^18.2.46", "@types/react": "^18.2.46",
"@types/react-dom": "^18.2.18", "@types/react-dom": "^18.2.18",
"@types/redux-logger": "^3.0.12", "@types/redux-logger": "^3.0.12",
"@types/serviceworker": "^0.0.82",
"@types/sharedworker": "^0.0.111",
"@types/webpack-env": "^1.18.4", "@types/webpack-env": "^1.18.4",
"@vscode/codicons": "^0.0.35", "@vscode/codicons": "^0.0.35",
"ajv": "^8.12.0", "ajv": "^8.12.0",
+7 -6
View File
@@ -1,8 +1,9 @@
/// <reference no-default-lib="true"/>
/// <reference lib="ES2015" />
/// <reference types="@types/serviceworker" />
/* global clients */
/* eslint-disable no-restricted-globals */ /* eslint-disable no-restricted-globals */
/// <reference no-default-lib="true" />
/// <reference lib="webworker" />
export { }; // make it a module so that declare self works
declare const self: ServiceWorkerGlobalScope;
const map = new Map(); const map = new Map();
function createStream(port) { function createStream(port) {
@@ -78,11 +79,11 @@ self.addEventListener('notificationclick', (event) => {
console.log('On notification click: ', event.notification.tag); console.log('On notification click: ', event.notification.tag);
event.notification.close(); event.notification.close();
if (!event.notification.tag.startsWith('message-')) return; if (!event.notification.tag.startsWith('message-')) return;
event.waitUntil(clients.matchAll({ type: 'window' }).then((clientList) => { event.waitUntil(self.clients.matchAll({ type: 'window' }).then((clientList) => {
for (const client of clientList) { for (const client of clientList) {
if (client.url === '/home/messages' && 'focus' in client) return client.focus(); if (client.url === '/home/messages' && 'focus' in client) return client.focus();
} }
if (clients.openWindow) clients.openWindow('/home/messages'); if (self.clients.openWindow) self.clients.openWindow('/home/messages');
return null; return null;
})); }));
}); });
+1 -1
View File
@@ -13,7 +13,7 @@ const Root = {
}; };
describe('App', () => { describe('App', () => {
let agent: supertest.SuperAgentTest; let agent;
before(async () => { before(async () => {
const init = Date.now(); const init = Date.now();
await new Promise((resolve) => { await new Promise((resolve) => {