Skip to content

error TS2748: Cannot access ambient const enums when 'isolatedModules' is enabled #1

@aspenflow

Description

@aspenflow

In MacOS Monterey when attempting to build WebCord:

> webcord@4.4.0 build
> tsc
sources/code/main/modules/socket.ts:43:14 - error TS2748: Cannot access ambient const enums when 'isolatedModules' is enabled.
43       return WebSocketClose.TryAgainLater;
                ~~~~~~~~~~~~~~

sources/code/main/modules/socket.ts:91:29 - error TS2748: Cannot access ambient const enums when 'isolatedModules' is enabled.
91       return Promise.reject(WebSocketClose.TryAgainLater);
                               ~~~~~~~~~~~~~~

Found 2 errors in the same file, starting at: sources/code/main/modules/socket.ts:43

Error looks similar to this: vitejs/vite#5814

but forking and setting preserveConstEnums to false as suggested in the referenced issue results in the following output:

> webcord@4.4.0 build
> tsc

sources/code/main/modules/socket.ts:2:51 - error TS2307: Cannot find module '@hainesdata/disconnection' or its corresponding type declarations.
2 import { WebSocket, HookFn, WebSocketClose } from "@hainesdata/disconnection";
                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                    
sources/code/main/modules/socket.ts:38:29 - error TS7006: Parameter 'details' implicitly has an 'any' type.
38   void server.details?.then(details => server.log(l10n.client.log.listenPort.replace("%s",kolor.underline(kolor.blueBright("%s"))), details.port));
                               ~~~~~~~

sources/code/main/modules/socket.ts:39:79 - error TS7006: Parameter 'parsedData' implicitly has an 'any' type.
39   const hookDialog: HookFn<"GUILD_TEMPLATE_BROWSER"|"INVITE_BROWSER"> = async(parsedData, origin) => {
                                                                                 ~~~~~~~~~~

sources/code/main/modules/socket.ts:39:91 - error TS7006: Parameter 'origin' implicitly has an 'any' type.
39   const hookDialog: HookFn<"GUILD_TEMPLATE_BROWSER"|"INVITE_BROWSER"> = async(parsedData, origin) => {
                                                                                             ~~~~~~

sources/code/main/modules/socket.ts:81:40 - error TS7006: Parameter 'parsedData' implicitly has an 'any' type.
81   server.addHook("DEEP_LINK_CHANNEL", (parsedData) => {
                                          ~~~~~~~~~~
                                          
Found 5 errors in the same file, starting at: sources/code/main/modules/socket.ts:2

Metadata

Metadata

Assignees

Labels

info:confirmedThis behavior was reproduced by collaboratortype:bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions