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.
This commit is contained in:
Maxime Kjaer
2021-03-24 23:12:22 +01:00
committed by GitHub
parent b4ae8d2e19
commit 259f29720b
2 changed files with 4 additions and 4 deletions

View File

@@ -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<Todo> = [];
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

View File

@@ -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) => {