My confusion lies in understanding how TypeScript interfaces function effectively. Here's what I currently have:
import type { Socket, Handshake } from 'socket.io';
import type { Session } from './session';
export interface SessionHandshake extends Handshake {
session: Session;
}
export interface SessionSocket extends Socket {
handshake: SessionHandshake;
id: string;
}
The intention behind this code snippet is to enhance the existing "Socket" interface provided by socket.io by introducing an "id" property and extending the "handshake" property. However, TypeScript seems to be raising an issue. It claims that "SessionHandshake is missing x, y, z properties from type Handshake." This doesn't make sense to me because I clearly specified that SessionHandshake extends the Handshake interface. So why does TS insist it lacks some of Handshake's properties?
This scenario is specifically with TS version 4.1.3.