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

Fails on nuxt typecheck #85

Closed
Jeet-Metapercept opened this issue Dec 23, 2023 · 4 comments · Fixed by #86
Closed

Fails on nuxt typecheck #85

Jeet-Metapercept opened this issue Dec 23, 2023 · 4 comments · Fixed by #86

Comments

@Jeet-Metapercept
Copy link

I have a pipeline checks, getting this error on nuxt typecheck

node_modules/.pnpm/nuxt-umami@2.5.6_vue@3.3.8/node_modules/nuxt-umami/internal/utils.ts:32:7 - error TS2339: Property 'host' does not exist on type 'unknown'.

32       host: _host = '',
         ~~~~

node_modules/.pnpm/nuxt-umami@2.5.6_vue@3.3.8/node_modules/nuxt-umami/internal/utils.ts:33:7 - error TS2339: Property 'id' does not exist on type 'unknown'.

33       id = '',
         ~~

node_modules/.pnpm/nuxt-umami@2.5.6_vue@3.3.8/node_modules/nuxt-umami/internal/utils.ts:34:7 - error TS2339: Property 'domains' does not exist on type 'unknown'.

34       domains = undefined,
         ~~~~~~~

node_modules/.pnpm/nuxt-umami@2.5.6_vue@3.3.8/node_modules/nuxt-umami/internal/utils.ts:35:7 - error TS2339: Property 'ignoreDnt' does not exist on type 'unknown'.

35       ignoreDnt = true,
         ~~~~~~~~~

node_modules/.pnpm/nuxt-umami@2.5.6_vue@3.3.8/node_modules/nuxt-umami/internal/utils.ts:36:7 - error TS2339: Property 'ignoreLocalhost' does not exist on type 'unknown'.

36       ignoreLocalhost: ignoreLocal = false,
         ~~~~~~~~~~~~~~~

node_modules/.pnpm/nuxt-umami@2.5.6_vue@3.3.8/node_modules/nuxt-umami/internal/utils.ts:37:7 - error TS2339: Property 'autoTrack' does not exist on type 'unknown'.

37       autoTrack = true,
         ~~~~~~~~~

node_modules/.pnpm/nuxt-umami@2.5.6_vue@3.3.8/node_modules/nuxt-umami/internal/utils.ts:38:7 - error TS2339: Property 'customEndpoint' does not exist on type 'unknown'.

38       customEndpoint: _customEP = undefined,
         ~~~~~~~~~~~~~~

node_modules/.pnpm/nuxt-umami@2.5.6_vue@3.3.8/node_modules/nuxt-umami/internal/utils.ts:39:7 - error TS2339: Property 'version' does not exist on type 'unknown'.

39       version: _ver = 1,
         ~~~~~~~

node_modules/.pnpm/nuxt-umami@2.5.6_vue@3.3.8/node_modules/nuxt-umami/internal/utils.ts:40:7 - error TS2339: Property 'useDirective' does not exist on type 'unknown'.

40       useDirective = false,
         ~~~~~~~~~~~~

node_modules/.pnpm/nuxt-umami@2.5.6_vue@3.3.8/node_modules/nuxt-umami/internal/utils.ts:41:7 - error TS2339: Property 'debug' does not exist on type 'unknown'.

41       debug = false,
         ~~~~~


Found 10 errors in the same file, starting at: node_modules/.pnpm/nuxt-umami@2.5.6_vue@3.3.8/node_modules/nuxt-umami/internal/utils.ts:32


[1:55:25 PM]  ERROR  Command failed with exit code 2: npx -p vue-tsc -p typescript vue-tsc --noEmit

  at makeError (node_modules/.pnpm/nuxi@3.10.0/node_modules/nuxi/dist/chunks/index3.mjs:625:11)
  at handlePromise (node_modules/.pnpm/nuxi@3.10.0/node_modules/nuxi/dist/chunks/index3.mjs:1821:26)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async Object.run (node_modules/.pnpm/nuxi@3.10.0/node_modules/nuxi/dist/chunks/typecheck.mjs:82:7)
  at async runCommand$1 (node_modules/.pnpm/nuxi@3.10.0/node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1648:16)
  at async runCommand$1 (node_modules/.pnpm/nuxi@3.10.0/node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1639:11)
  at async runMain$1 (node_modules/.pnpm/nuxi@3.10.0/node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1773:7) 



[1:55:25 PM]  ERROR  Command failed with exit code 2: npx -p vue-tsc -p typescript vue-tsc --noEmit

Package manager: pnpm v8.6.5

I tried to adjust tsconfig.json but it didn't help. The only solution I found was to manually apply type casting.

  const {
    umami: {
      host: _host = '',
      id = '',
      domains = undefined,
      ignoreDnt = true,
      ignoreLocalhost: ignoreLocal = false,
      autoTrack = true,
      customEndpoint: _customEP = undefined,
      version: _ver = 1,
      useDirective = false,
      debug = false,
    } = {} as any,     <<<==== typecast as any
  } = useAppConfig();
@ijkml
Copy link
Owner

ijkml commented Dec 23, 2023

Hello, @Jeet-Metapercept.

Sorry about that. If you have a minute, can you please set up a minimal repro?

@Jeet-Metapercept
Copy link
Author

Hi, @ijkml

Here's the repository for a quick reproduction.
https://github.com/Jeet-Metapercept/nuxt-umami-tsc

  1. pnpm install
  2. pnpm check or pnpm typecheck (nuxt typecheck)

@Jeet-Metapercept
Copy link
Author

Jeet-Metapercept commented Dec 24, 2023

Upon further investigation, it seems that the issue is related to how dependencies are managed by the pnpm package manager.

Installing dependencies with with --shamefully-hoist flag (pnpm --shamefully-hoist)
or
by adding .npmrc file with shamefully-hoist=true would resolve the issue.

// root/.npmrc

shamefully-hoist=true

It might be helpful to include this information in the README for others who may encounter a similar issue.

related to nuxt/nuxt#14146

@ijkml
Copy link
Owner

ijkml commented Dec 24, 2023

Thank you very much, @Jeet-Metapercept!

I'll take a look and add it to the [growing] list of quirks 😅. Many thanks!

@ijkml ijkml linked a pull request Jan 1, 2024 that will close this issue
@ijkml ijkml closed this as completed in #86 Jan 1, 2024
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

Successfully merging a pull request may close this issue.

2 participants