Giter Site home page Giter Site logo

Comments (3)

tserkov avatar tserkov commented on June 18, 2024

Hi @tonythomson, I'm sorry to hear that!

According to the Vue documentation and Typescript documentation:

  1. You can’t declare new top-level declarations in the augmentation β€” just patches to existing declarations.

This also how other plugins implement typings: example 1 example 2

So I'm not entirely sure how this is technically possible. Would you be able to provide a minimal example that reproduces the issue?

Thanks!

from vue-plugin-load-script.

tonythomson avatar tonythomson commented on June 18, 2024

Thanks for the links, @tserkov ! They gave me some examples with which to regress. Neither of those libraries, when imported into my project, causes the same error. I believe I've tracked down the difference.

In the typings file for vue-plugin-load-script, we are missing the import statement for Vue, listed by the Vue docs linked above as necessary. If I put the import at the top into the module's typings file, my compilation errors disappear.

Not a TS expert, but I believe that what is happening is that without the import, my local type defs are defined on the Vue object, then when the module's types are loaded, if the import is present, the types are applied to augment the already-augmented Vue instance. Without the import statement, the type definitions is applied to the original Vue object, losing any interim type definitions. Regardless of reason, restoring the import fixes things. I'll open a PR for your consideration.

from vue-plugin-load-script.

tserkov avatar tserkov commented on June 18, 2024

πŸ€¦πŸ»β€β™‚οΈ oof, such a rookie mistake! Thanks for catching that, I'm looking at the PR now. :)

from vue-plugin-load-script.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.