From 259f29720bf431502e4a5ab857e7384d40d303f7 Mon Sep 17 00:00:00 2001 From: Maxime Kjaer Date: Wed, 24 Mar 2021 23:12:22 +0100 Subject: [PATCH] docs(examples): remove unnecessary type annotations (#3855) Typed events in Socket.IO 4.0 remove the need for writing type annotations in callbacks of reserved events. --- examples/angular-todomvc/server.ts | 4 ++-- examples/typescript/server.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/angular-todomvc/server.ts b/examples/angular-todomvc/server.ts index 94bc414ba5..0f3301b370 100644 --- a/examples/angular-todomvc/server.ts +++ b/examples/angular-todomvc/server.ts @@ -1,4 +1,4 @@ -import { Server, Socket } from "socket.io"; +import { Server } from "socket.io"; const io = new Server(8080, { cors: { @@ -15,7 +15,7 @@ interface Todo { let todos: Array = []; -io.on("connect", (socket: Socket) => { +io.on("connect", (socket) => { socket.emit("todos", todos); // note: we could also create a CRUD (create/read/update/delete) service for the todo list diff --git a/examples/typescript/server.ts b/examples/typescript/server.ts index 63793a785e..5f968c1ab5 100644 --- a/examples/typescript/server.ts +++ b/examples/typescript/server.ts @@ -1,8 +1,8 @@ -import { Server, Socket } from "socket.io"; +import { Server } from "socket.io"; const io = new Server(8080); -io.on("connect", (socket: Socket) => { +io.on("connect", (socket) => { console.log(`connect ${socket.id}`); socket.on("ping", (cb) => {