GithubHelp home page GithubHelp logo

Comments (5)

JonasKruckenberg avatar JonasKruckenberg commented on August 26, 2024 8

As I'm using typescript for all of my projects, I am very aware of this issue. A type declaration of images would have to look something like this

declare module "*.jpg?*"
declare module "*.webp?*"
// etc.

Because we only want to provide types for imports that use directives. The problem is though that typescript at the moment only allows one star (*) in a pattern at a time, so using two stars will result in typescript complaining.
I know it's not ideal and I will raise an issue with the typescript folks at some point (its on my backlog) but for now there is no real solution for this :/

from imagetools.

lunacd avatar lunacd commented on August 26, 2024 1

Thanks for the quick update on things! And of course thanks so much for this awesome project I've come to depend on daily. I'll follow up under TS to hopefully get this to work.

from imagetools.

tedmeftah avatar tedmeftah commented on August 26, 2024 1

One way I'm getting around this is I have this declaration:

declare module '*&img';

then I add the &img to the end of my imports like this:

import image from '$lib/assets/image.png?width=1000&format=webp&img';

from imagetools.

lunacd avatar lunacd commented on August 26, 2024

Is there an issue under TS to track this? I tried to look for one but couldn't. It's probably buried somewhere among the 5k+ issues for TS.

from imagetools.

JonasKruckenberg avatar JonasKruckenberg commented on August 26, 2024

I have not gotten around to follow through on creating an issue (you may have noticed that I have a lot of other projects that have to take priority right now) but feel free to open one on behalf of this project if it really bothers you.

I personally have not much hope they fix this, but who knows.

from imagetools.

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.