Skip to content

Commit 00c661e

Browse files
authored
docs(examples): remove unnecessary type annotations (socketio#3855)
Typed events in Socket.IO 4.0 remove the need for writing type annotations in callbacks of reserved events.
1 parent fe19a14 commit 00c661e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

examples/angular-todomvc/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Server, Socket } from "socket.io";
1+
import { Server } from "socket.io";
22

33
const io = new Server(8080, {
44
cors: {
@@ -15,7 +15,7 @@ interface Todo {
1515

1616
let todos: Array<Todo> = [];
1717

18-
io.on("connect", (socket: Socket) => {
18+
io.on("connect", (socket) => {
1919
socket.emit("todos", todos);
2020

2121
// note: we could also create a CRUD (create/read/update/delete) service for the todo list

examples/typescript/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Server, Socket } from "socket.io";
1+
import { Server } from "socket.io";
22

33
const io = new Server(8080);
44

5-
io.on("connect", (socket: Socket) => {
5+
io.on("connect", (socket) => {
66
console.log(`connect ${socket.id}`);
77

88
socket.on("ping", (cb) => {

0 commit comments

Comments
 (0)