tsc
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import util from "util";
|
||||
import Koa from "koa";
|
||||
import Koa, { Context, Next } from "koa";
|
||||
import Router from "koa-router";
|
||||
import send from "koa-send";
|
||||
import serve from "koa-static";
|
||||
@@ -22,8 +22,7 @@ const koa = new Koa();
|
||||
const router = new Router();
|
||||
const readFile = util.promisify(fs.readFile);
|
||||
|
||||
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'ctx' implicitly has an 'any' type.
|
||||
const readIndexFile = async (ctx) => {
|
||||
const readIndexFile = async (ctx: Context): Promise<Buffer> => {
|
||||
if (isProduction) {
|
||||
return readFile(path.join(__dirname, "../../app/index.html"));
|
||||
}
|
||||
@@ -37,8 +36,7 @@ const readIndexFile = async (ctx) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
middleware.fileSystem.readFile(
|
||||
`${ctx.webpackConfig.output.path}/index.html`,
|
||||
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'err' implicitly has an 'any' type.
|
||||
(err, result) => {
|
||||
(err: Error, result: Buffer) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
@@ -49,8 +47,7 @@ const readIndexFile = async (ctx) => {
|
||||
});
|
||||
};
|
||||
|
||||
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'ctx' implicitly has an 'any' type.
|
||||
const renderApp = async (ctx, next, title = "Outline") => {
|
||||
const renderApp = async (ctx: Context, next: Next, title = "Outline") => {
|
||||
if (ctx.request.path === "/realtime/") {
|
||||
return next();
|
||||
}
|
||||
@@ -59,7 +56,6 @@ const renderApp = async (ctx, next, title = "Outline") => {
|
||||
const environment = `
|
||||
window.env = ${JSON.stringify(presentEnv(env))};
|
||||
`;
|
||||
// @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
|
||||
ctx.body = page
|
||||
.toString()
|
||||
.replace(/\/\/inject-env\/\//g, environment)
|
||||
@@ -68,8 +64,7 @@ const renderApp = async (ctx, next, title = "Outline") => {
|
||||
.replace(/\/\/inject-slack-app-id\/\//g, process.env.SLACK_APP_ID || "");
|
||||
};
|
||||
|
||||
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'ctx' implicitly has an 'any' type.
|
||||
const renderShare = async (ctx, next) => {
|
||||
const renderShare = async (ctx: Context, next: Next) => {
|
||||
const { shareId } = ctx.params;
|
||||
// Find the share record if publicly published so that the document title
|
||||
// can be be returned in the server-rendered HTML. This allows it to appear in
|
||||
|
||||
@@ -29,8 +29,12 @@ export default function init(app: Koa, server: http.Server) {
|
||||
const listeners = server.listeners("upgrade");
|
||||
const ioHandleUpgrade = listeners.pop();
|
||||
|
||||
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Function | undefined' is not ass... Remove this comment to see the full error message
|
||||
server.removeListener("upgrade", ioHandleUpgrade);
|
||||
if (ioHandleUpgrade) {
|
||||
server.removeListener(
|
||||
"upgrade",
|
||||
ioHandleUpgrade as (...args: any[]) => void
|
||||
);
|
||||
}
|
||||
|
||||
server.on("upgrade", function (req, socket, head) {
|
||||
if (req.url && req.url.indexOf(path) > -1) {
|
||||
|
||||
Reference in New Issue
Block a user