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

typescript error when including @solid-devtools/debugger outside of vite #293

Open
Alloyed opened this issue Mar 19, 2024 · 1 comment
Open

Comments

@Alloyed
Copy link
Contributor

Alloyed commented Mar 19, 2024

Here's a minimal repro. In a private repository we're using esbuild for bundling and typescript independently for verification, and we're seeing the same issues there.

https://github.com/Alloyed/solid-sandbox/tree/TS2846

install with pnpm install, test with pnpm run typescript

The error seems to be in compiled/code-generated output, so it may be a problem with an upstream build tool. As a workaround, for now, we're directly modifying the affected files in node_modules and checking the results in.

full error log:

node_modules/.pnpm/@solid-devtools+debugger@0.23.3_solid-js@1.8.11/node_modules/@solid-devtools/debugger/dist/index-9809b963.d.ts:6:50 - error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file 'solid-js/store/types/store.js' instead?

6 import * as solid_js_store_types_store_d_ts from 'solid-js/store/types/store.d.ts';
                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@solid-devtools+debugger@0.23.3_solid-js@1.8.11/node_modules/@solid-devtools/debugger/dist/index-9809b963.d.ts:9:54 - error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file 'solid-js/types/reactive/signal.js' instead?

9 import * as solid_js_types_reactive_signal_d_ts from 'solid-js/types/reactive/signal.d.ts';
                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@solid-devtools+debugger@0.23.3_solid-js@1.8.11/node_modules/@solid-devtools/debugger/dist/index.d.ts:5:54 - error TS2846: A declaration file cannot 
be imported without 'import type'. Did you mean to import an implementation file 'solid-js/types/reactive/signal.js' instead?

5 import * as solid_js_types_reactive_signal_d_ts from 'solid-js/types/reactive/signal.d.ts';
                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@solid-devtools+debugger@0.23.3_solid-js@1.8.11/node_modules/@solid-devtools/debugger/dist/setup.d.ts:2:50 - error TS2846: A declaration file cannot 
be imported without 'import type'. Did you mean to import an implementation file 'solid-js/store/types/store.js' instead?

2 import * as solid_js_store_types_store_d_ts from 'solid-js/store/types/store.d.ts';
                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@solid-devtools+debugger@0.23.3_solid-js@1.8.11/node_modules/@solid-devtools/debugger/dist/setup.d.ts:5:54 - error TS2846: A declaration file cannot 
be imported without 'import type'. Did you mean to import an implementation file 'solid-js/types/reactive/signal.js' instead?

5 import * as solid_js_types_reactive_signal_d_ts from 'solid-js/types/reactive/signal.d.ts';
                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@solid-devtools+debugger@0.23.3_solid-js@1.8.11/node_modules/@solid-devtools/debugger/dist/setup.d.ts:40:9 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'SolidDevtools$$' must be of type '{ readonly Solid: typeof import("E:/code/solid-sandbox/node_modules/.pnpm/solid-js@1.8.11/node_modules/solid-js/types/index"); readonly Store: typeof import("E:/code/solid-sandbox/node_modules/.pnpm/solid-js@1.8.11/node_modules/solid-js/store/types/index"); ... 13 more ...; readonly getOwnerLocation: (owner: Owner) ...', but here has type '{ readonly Solid: typeof import("E:/code/solid-sandbox/node_modules/.pnpm/solid-js@1.8.11/node_modules/solid-js/types/index"); readonly Store: typeof import("E:/code/solid-sandbox/node_modules/.pnpm/solid-js@1.8.11/node_modules/solid-js/store/types/index"); ... 13 more ...; readonly getOwnerLocation: (owner: Owner) ...'.

40     var SolidDevtools$$: {
           ~~~~~~~~~~~~~~~

  node_modules/.pnpm/@solid-devtools+debugger@0.23.3_solid-js@1.8.11/node_modules/@solid-devtools/debugger/dist/index-9809b963.d.ts:164:9
    164     var SolidDevtools$$: {
                ~~~~~~~~~~~~~~~
    'SolidDevtools$$' was also declared here.

node_modules/.pnpm/@solid-devtools+debugger@0.23.3_solid-js@1.8.11/node_modules/@solid-devtools/debugger/dist/setup.d.ts:100:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'sdtType' must be of type 'NodeType | undefined', but here has type 'NodeType | undefined'.

100         sdtType?: NodeType;
            ~~~~~~~

  node_modules/.pnpm/@solid-devtools+debugger@0.23.3_solid-js@1.8.11/node_modules/@solid-devtools/debugger/dist/index-9809b963.d.ts:228:9
    228         sdtType?: NodeType;
                ~~~~~~~
    'sdtType' was also declared here.

node_modules/.pnpm/@solid-primitives+utils@6.2.2_solid-js@1.8.11/node_modules/@solid-primitives/utils/dist/index/index.d.ts:6:54 - error TS2307: Cannot find module '../node_modules/solid-js/types/reactive/signal.js' or its corresponding type declarations.

6 export { ResolvedChildren, ResolvedJSXElement } from '../node_modules/solid-js/types/reactive/signal.js';
                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@thetarnav
Copy link
Owner

So tried to run this with updated deps to latest

And I got a different error:

npm run typescript

> vite-template-solid@0.0.0 typescript
> tsc

node_modules/@solid-devtools/debugger/dist/locator/types.d.ts:1:43 - error TS2307: Cannot find module '@solid-devtools/shared/utils' or its corresponding type declarations.
  There are types at '/home/thetarnav/solid-sandbox/node_modules/@solid-devtools/debugger/node_modules/@solid-devtools/shared/dist/utils.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

1 import type { ToDyscriminatedUnion } from '@solid-devtools/shared/utils';
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/@solid-devtools/debugger/dist/locator/types.d.ts:1

Then I tried to add "type": "module" to package.json and "moduleResolution": "Bundler" and "module": "ESNext" to tsconfig.json and all the errors went away.

Adding "skipLibCheck": true silences them as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants