Skip to content

Dev server gives strange typescript error #5111

@Shayan-To

Description

@Shayan-To

Package version

7.3.3

Describe the bug

I'm trying to add a method to VineString or Vine, and it works in the IDE, tsc gives no errors, but the dev server gives a strange error.

For a small repro, I added a few lines to the bottom of adonisrc.ts, and here's the dev server output that's actually showing the few lines I added!

The error:

ℹ TypeError: vine.testFn is not a function

 ⁃ at <anonymous> (D:/Shayan/MyDocuments/Coding/Projects/DrDr/adonis-ts-exec-test/adonisrc.ts:127:6)

   118 ┃
   119 ┃  declare module "@vinejs/vine" {
   120 ┃    interface Vine {
   121 ┃      testProp: number
   122 ┃      testFn(): this;
   123 ┃    }
   124 ┃  }
   125 ┃
   126 ┃  vine.testProp = 4
 ❯ 127 ┃  vine.testFn()
   128 ┃

 ⁃ at ModuleJob.run (node:internal/modules/esm/module_job:377:25)
 ⁃ at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:671:26)
 ⁃ at async RcFileManager.process (.../adonis-ts-exec-test/node_modules/@adonisjs/application/build/application-BwkPOl3k.js:441:25)
 ⁃ at async Application.init (.../adonis-ts-exec-test/node_modules/@adonisjs/application/build/application-BwkPOl3k.js:761:3)
 ⁃ at async AceProcess.handle (.../adonis-ts-exec-test/node_modules/@adonisjs/core/build/main-lRY4g_D8.js:57:3)

(And for some reason, it does not have a problem with testProp.)

This problem happens when the extension method is used in adonisrc or a provider, or in some file that a provider imports. There is no problem elsewhere.

Reproduction repo

https://github.com/Shayan-To/adonis-ts-exec-test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions