Coder Social home page Coder Social logo

Comments (2)

benmccann avatar benmccann commented on May 24, 2024

I think we're getting the same issue for @sveltejs/kit. It's unclear to me if we're actually doing something wrong. If so, it would be helpful if the error message could also suggest some possible fixes as I'm not sure in what other way we should write the types.

from arethetypeswrong.github.io.

andrewbranch avatar andrewbranch commented on May 24, 2024

Ambient module declarations should only be used to type imports that do not invoke a file-to-file module resolution algorithm at runtime/bundle-time, i.e., environmental built-ins like "fs" or things that a bundler/compiler will strip away no matter the location of the importing file on disk. They should not be used to type imports that will resolve (at runtime/bundle-time) by walking up node_modules. They are not a way to bundle the types for multiple runtime modules into one file like https://github.com/Rich-Harris/dts-buddy tries to do.

arethetypeswrong has a bug here and it will report the wrong (and more severe) kind of problem, but there are so few instances where it’s correct to use an ambient module declaration that it feels likely that SvelteKit is misusing them. When I fix this, I’ll write accompanying docs about the consequences of misusing ambient module declarations.

from arethetypeswrong.github.io.

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.