Skip to content

Cyclic TS errors with hub:db after nuxt prepare (db types and path aliases) #796

@Yizack

Description

@Yizack

Describe the bug
Hello,

After installing @nuxthub/core 0.10.5 there's a confusing cycle of TypeScript errors that keeps alternating between two different problems depending on which command you run.

Steps to reproduce
Steps to reproduce the behavior:

  1. Clone: https://github.com/Yizack/nuxthub-reproduction
  2. Fresh install, run pnpm i (which runs prepare) → vue-tsc -b --noEmit
    • db auto-import has no types
    • ❌ Non-relative path errors in .nuxt/tsconfig.app.json and .nuxt/tsconfig.shared.json:
  3. Run pnpm dev wait, stop it, then run vue-tsc -b --noEmit again
    • db is now typed correctly
    • ❌ Non-relative path errors still present
  4. Run pnpm postinstall (which runs prepare) again → vue-tsc -b --noEmit
    • db loses its types again
    • ✅ Non-relative path errors disappear

Edit: I just saw a similar issue #792 I wonder if it fixed the issue with this commit #795 but just opening this issue to check

Example of Logs

Step 2
npx vue-tsc -b --noEmit
.nuxt/tsconfig.app.json:101:9 - error TS5090: Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?

101         "@nuxthub/db"
 you forget a leading './'?

116         "@nuxthub/db/schema"
            ~~~~~~~~~~~~~~~~~~~~

server/api/users.get.ts:4:21 - error TS7006: Parameter 'user' implicitly has an 'any' type.

4   return users.map((user) => ({
                      ~~~~

.nuxt/tsconfig.shared.json:101:9 - error TS5090: Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?       

101         "@nuxthub/db"
            ~~~~~~~~~~~~~

.nuxt/tsconfig.shared.json:116:9 - error TS5090: Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?       

116         "@nuxthub/db/schema"
            ~~~~~~~~~~~~~~~~~~~~


Found 5 errors.
Step 3
npx vue-tsc -b --noEmit
.nuxt/tsconfig.app.json:101:9 - error TS5090: Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?

101         "@nuxthub/db"
            ~~~~~~~~~~~~~

.nuxt/tsconfig.app.json:116:9 - error TS5090: Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?

116         "@nuxthub/db/schema"
            ~~~~~~~~~~~~~~~~~~~~

.nuxt/tsconfig.shared.json:101:9 - error TS5090: Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?

101         "@nuxthub/db"
            ~~~~~~~~~~~~~

.nuxt/tsconfig.shared.json:116:9 - error TS5090: Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?

116         "@nuxthub/db/schema"
            ~~~~~~~~~~~~~~~~~~~~


Found 4 errors.
Step 4
npx vue-tsc -b --noEmit
server/api/users.get.ts:4:21 - error TS7006: Parameter 'user' implicitly has an 'any' type.

4   return users.map((user) => ({
                      ~~~~

server/api/users.get.ts:4:21 - error TS7006: Parameter 'user' implicitly has an 'any' type.

4   return users.map((user) => ({
                      ~~~~


Found 2 errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions