Jhernandez has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373722 )

Change subject: Chore: apply typing convention
......................................................................


Chore: apply typing convention

Note: @types/assets-webpack-plugin is still imported by the page
template and required for compilation.

Change-Id: I69c7cdfcf1c11c0d78aee6839dd9bd917c885e81
---
M src/server/index.ts
M src/server/templates/page.ts
2 files changed, 6 insertions(+), 11 deletions(-)

Approvals:
  Jhernandez: Verified; Looks good to me, approved



diff --git a/src/server/index.ts b/src/server/index.ts
index c7f7c69..bd9d8b1 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -2,7 +2,6 @@
 import "ignore-styles";
 
 import * as express from "express";
-import { Assets } from "assets-webpack-plugin";
 import app from "../common/components/app";
 import page from "./templates/page";
 import { render } from "preact-render-to-string";
@@ -11,7 +10,7 @@
 
 // The asset manifest built or the webpack-dev-server URL (which has no
 // manifest).
-const assets: Assets | string = isProd
+const assets = isProd
   ? require("../../dist/public/assets-manifest.json")
   : "http://localhost:8080";;
 
@@ -20,11 +19,11 @@
 
 server.use(express.static("dist/public"));
 
-server.get("/", (_req: express.Request, res: express.Response) => {
+server.get("/", (_req, res) => {
   res.status(200).send(page({ title: "", body: render(app()), assets }));
 });
 
-server.get("*", (_req: express.Request, res: express.Response) => {
+server.get("*", (_req, res) => {
   res.status(404).send("Not found");
 });
 
diff --git a/src/server/templates/page.ts b/src/server/templates/page.ts
index 70985ec..7f3e8c2 100644
--- a/src/server/templates/page.ts
+++ b/src/server/templates/page.ts
@@ -14,18 +14,14 @@
  *                   (e.g., index.js); either a URL (development) or a
  *                   filesystem path (production).
  */
-const asset = (
-  assets: Assets | string,
-  entry: string,
-  extension: string
-): string =>
+const asset = (assets: Assets | string, entry: string, extension: string) =>
   typeof assets === "string"
     ? `${assets}/${entry}.${extension}`
     : assets[entry][extension];
 
 export default function page({ title, body = "", assets }: PageParams): string 
{
-  const script: string = asset(assets, "index", "js");
-  const style: string = asset(assets, "index", "css");
+  const script = asset(assets, "index", "js");
+  const style = asset(assets, "index", "css");
   return `
 <!DOCTYPE html>
 <html lang="en">

-- 
To view, visit https://gerrit.wikimedia.org/r/373722
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I69c7cdfcf1c11c0d78aee6839dd9bd917c885e81
Gerrit-PatchSet: 2
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: Sniedzielski <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to