Use explicit types

This commit is contained in:
JaniAnttonen
2022-04-05 15:04:24 +03:00
parent 1c66c9e572
commit 8430c9b553
2 changed files with 6 additions and 4 deletions

View File

@@ -124,6 +124,7 @@ const HooksEditor = () => {
setMarkers(monacoRef.current);
}
}, [snap.active]);
return (
<Box
css={{
@@ -165,7 +166,8 @@ const HooksEditor = () => {
mimetypes: ["text/plain"],
});
MonacoServices.install(monaco);
const webSocket = createWebSocket(
const webSocket: ReconnectingWebSocket = createWebSocket(
process.env.NEXT_PUBLIC_LANGUAGE_SERVER_API_ENDPOINT || ""
);
subscriptionRef.current = webSocket;

View File

@@ -1,5 +1,5 @@
import { MessageConnection } from "@codingame/monaco-jsonrpc";
import { MonacoLanguageClient, ErrorAction, CloseAction, createConnection } from "@codingame/monaco-languageclient";
import { CloseAction, createConnection, ErrorAction, MonacoLanguageClient } from "@codingame/monaco-languageclient";
import Router from "next/router";
import normalizeUrl from "normalize-url";
import ReconnectingWebSocket from "reconnecting-websocket";
@@ -37,7 +37,7 @@ export function createUrl(path: string): string {
return normalizeUrl(`${protocol}://${location.host}${location.pathname}${path}`);
}
export function createWebSocket(url: string) {
export function createWebSocket(url: string): ReconnectingWebSocket {
const socketOptions = {
maxReconnectionDelay: 10000,
minReconnectionDelay: 1000,
@@ -47,4 +47,4 @@ export function createWebSocket(url: string) {
debug: false
};
return new ReconnectingWebSocket(url, [], socketOptions);
}
}