nestia icon indicating copy to clipboard operation
nestia copied to clipboard

[Bug] WebSocketRoute method cannot be called connection

Open SonderRill opened this issue 5 months ago • 1 comments

Bug Report

I spent a lot of time on this strange bug :)))

WebSocketRoute method cannot be called connection. if you change the name to any other the error disappears

@WebSocketRoute('events/connect') public async connection(

SDK genratad

export async function connection(
  connection: IConnection<connection.Header>,
  provider: connection.Provider,
): Promise<connection.Output> {
  const connector: WebSocketConnector<
    connection.Header,
    connection.Provider,
    connection.Listener
  > = new WebSocketConnector(connection.headers ?? ({} as any), provider);
  await connector.connect(
    `${connection.host.endsWith("/") ? connection.host.substring(0, connection.host.length - 1) : connection.host}${connection.path()}`,
  );

error ../../nestia-api/functional/calculate/events/connect/index.ts:28:128 - error TS2339: Property 'path' does not exist on type 'IConnection'.

28 ${connection.host.endsWith("/") ? connection.host.substring(0, connection.host.length - 1) : connection.host}${connection.path()}, ~~~~

Found 1 error in ../../nestia-api/functional/calculate/events/connect/index.ts:28

SonderRill avatar Sep 02 '25 13:09 SonderRill

This is due to connection: IConnection parameter.

If there's a function named connection, I'll rename the connection parameter to be _connection

samchon avatar Sep 22 '25 01:09 samchon