Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failed using npm run build on typescript projects #3891

Closed
darwin-morocho opened this issue Apr 21, 2021 · 9 comments
Closed

Build failed using npm run build on typescript projects #3891

darwin-morocho opened this issue Apr 21, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@darwin-morocho
Copy link

Describe the bug
I have a backend with express and typescript that use npm as a package manager and I run the next command to build the project npm run build that command run the next script tsc -p . to build the project.

But I have the next errors

node_modules/socket.io/dist/broadcast-operator.d.ts:1:13 - error TS1005: '=' expected.

1 import type { BroadcastFlags, Room, SocketId } from "socket.io-adapter";
              ~

node_modules/socket.io/dist/broadcast-operator.d.ts:1:53 - error TS1005: ';' expected.

1 import type { BroadcastFlags, Room, SocketId } from "socket.io-adapter";
                                                      ~~~~~~~~~~~~~~~~~~~

node_modules/socket.io/dist/broadcast-operator.d.ts:3:13 - error TS1005: '=' expected.

3 import type { Adapter } from "socket.io-adapter";
              ~

node_modules/socket.io/dist/broadcast-operator.d.ts:3:30 - error TS1005: ';' expected.

3 import type { Adapter } from "socket.io-adapter";
                               ~~~~~~~~~~~~~~~~~~~

node_modules/socket.io/dist/broadcast-operator.d.ts:4:13 - error TS1005: '=' expected.

4 import type { EventParams, EventNames, EventsMap, TypedEventBroadcaster } from "./typed-events";
              ~

node_modules/socket.io/dist/broadcast-operator.d.ts:4:80 - error TS1005: ';' expected.

4 import type { EventParams, EventNames, EventsMap, TypedEventBroadcaster } from "./typed-events";
                                                                                 ~~~~~~~~~~~~~~~~

node_modules/socket.io/dist/index.d.ts:6:13 - error TS1005: '=' expected.

6 import type { Encoder } from "socket.io-parser";
              ~

node_modules/socket.io/dist/index.d.ts:6:30 - error TS1005: ';' expected.

6 import type { Encoder } from "socket.io-parser";
                               ~~~~~~~~~~~~~~~~~~

node_modules/socket.io/dist/index.d.ts:8:13 - error TS1005: '=' expected.

8 import type { CookieSerializeOptions } from "cookie";
              ~

node_modules/socket.io/dist/index.d.ts:8:45 - error TS1005: ';' expected.

8 import type { CookieSerializeOptions } from "cookie";
                                              ~~~~~~~~

node_modules/socket.io/dist/index.d.ts:9:13 - error TS1005: '=' expected.

9 import type { CorsOptions } from "cors";
              ~

node_modules/socket.io/dist/index.d.ts:9:34 - error TS1005: ';' expected.

9 import type { CorsOptions } from "cors";
                                   ~~~~~~

node_modules/socket.io/dist/index.d.ts:10:13 - error TS1005: '=' expected.

10 import type { BroadcastOperator, RemoteSocket } from "./broadcast-operator";
               ~

node_modules/socket.io/dist/index.d.ts:10:54 - error TS1005: ';' expected.

10 import type { BroadcastOperator, RemoteSocket } from "./broadcast-operator";
                                                        ~~~~~~~~~~~~~~~~~~~~~~

node_modules/socket.io/dist/namespace.d.ts:2:13 - error TS1005: '=' expected.

2 import type { Server } from "./index";
              ~

node_modules/socket.io/dist/namespace.d.ts:2:29 - error TS1005: ';' expected.

2 import type { Server } from "./index";
                              ~~~~~~~~~

node_modules/socket.io/dist/namespace.d.ts:4:13 - error TS1005: '=' expected.

4 import type { Client } from "./client";
              ~

node_modules/socket.io/dist/namespace.d.ts:4:29 - error TS1005: ';' expected.

4 import type { Client } from "./client";
                              ~~~~~~~~~~

node_modules/socket.io/dist/namespace.d.ts:5:13 - error TS1005: '=' expected.

5 import type { Adapter, Room, SocketId } from "socket.io-adapter";
              ~

node_modules/socket.io/dist/namespace.d.ts:5:46 - error TS1005: ';' expected.

5 import type { Adapter, Room, SocketId } from "socket.io-adapter";
                                               ~~~~~~~~~~~~~~~~~~~

node_modules/socket.io/dist/socket.d.ts:4:13 - error TS1005: '=' expected.

4 import type { Client } from "./client";
              ~

node_modules/socket.io/dist/socket.d.ts:4:29 - error TS1005: ';' expected.

4 import type { Client } from "./client";
                              ~~~~~~~~~~

node_modules/socket.io/dist/socket.d.ts:5:13 - error TS1005: '=' expected.

5 import type { Namespace } from "./namespace";
              ~

node_modules/socket.io/dist/socket.d.ts:5:32 - error TS1005: ';' expected.

5 import type { Namespace } from "./namespace";
                                 ~~~~~~~~~~~~~

node_modules/socket.io/dist/socket.d.ts:6:13 - error TS1005: '=' expected.

6 import type { IncomingMessage, IncomingHttpHeaders } from "http";
              ~

node_modules/socket.io/dist/socket.d.ts:6:59 - error TS1005: ';' expected.

6 import type { IncomingMessage, IncomingHttpHeaders } from "http";
                                                            ~~~~~~

node_modules/socket.io/dist/socket.d.ts:7:13 - error TS1005: '=' expected.

7 import type { Room, SocketId } from "socket.io-adapter";
              ~

node_modules/socket.io/dist/socket.d.ts:7:37 - error TS1005: ';' expected.

7 import type { Room, SocketId } from "socket.io-adapter";
                                      ~~~~~~~~~~~~~~~~~~~

node_modules/socket.io/dist/socket.d.ts:8:13 - error TS1005: '=' expected.

8 import type { ParsedUrlQuery } from "querystring";
              ~

node_modules/socket.io/dist/socket.d.ts:8:37 - error TS1005: ';' expected.

8 import type { ParsedUrlQuery } from "querystring";

Versions used

   "socket.io": "^4.0.1",
    "socket.io-redis": "^6.1.0",
@darwin-morocho darwin-morocho added the bug Something isn't working label Apr 21, 2021
@darwin-morocho
Copy link
Author

Fixed after update my typescript version

@darrachequesne
Copy link
Member

Hi! That's a good point, I think we should add this somewhere in the documentation 👍 (import type syntax was added in TypeScript 3.8)

@saptarshi007
Copy link

saptarshi007 commented Sep 6, 2021

I have the same issue, but even after updating curret typescript version, still facing same errors as mentioned here. Could you please help me?

@darrachequesne
Copy link
Member

@saptarshi007 that's weird. Could you please check your typescript version with npm ls typescript?

@ithustle
Copy link

ithustle commented Feb 5, 2022

@darrachequesne I'm facing the same issue. I'm using typescript version 4.5.5

@bernardarhia
Copy link

@darrachequesne I'm facing the same issue. I'm using typescript version 4.5.5

Have you been able to fix it? I'm also having the same issue with typescript v4.2.3

darrachequesne added a commit to socketio/socket.io-adapter that referenced this issue Feb 22, 2024
@darrachequesne
Copy link
Member

@bernardarhia which version of socket.io-adapter are you using?

If it's 2.5.3, this should be fixed by socketio/socket.io-adapter@ca397f3, included in version 2.5.4. Could you please check?

@bernardarhia
Copy link

I've found a work around it. I had to install a specific version of socket.io which comes with the socket-adapter.

@darrachequesne
Copy link
Member

@bernardarhia great 👍

For future readers, there was an unsupported syntax (import { type ... }) introduced in [email protected], which is only supported starting with [email protected] and which was removed in [email protected].

darrachequesne added a commit that referenced this issue Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants