-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use it with typescript because module not found #105
Comments
You can always ignore warnings with a Otherwise you can create a type definition. It would indeed be nice if there was a definition available, but so far i haven't found one and i'm too lazy to create one myself, so i use it as |
I use a definition like this (in type ResponsiveImageOutput =
{ src: string
, srcSet: string
, placeholder: string
, images: {path: string, width: number, height: number}[]
, width: number
, height: number
}
declare module '*.jpg' {
const content: ResponsiveImageOutput
export default content;
}
declare module '*.jpeg' {
const content: ResponsiveImageOutput
export default content;
}
declare module '*.png' {
const content: ResponsiveImageOutput
export default content;
} |
@Porges I tried adding these definitions to my |
For each set of query params I use I add another module definition to my global.d.ts eg declare module '*.png' {
const content: any;
export default content;
}
declare module '*.png?placeholder=true&sizes[]=300,sizes[]=600,sizes[]=1024,sizes[]=2048' {
const content: any;
export default content;
} Ideally we could use multiple wildcards and just use declare module '*.png' {
const content: any;
export default content;
} but that would require this issue to be addressed by typescript microsoft/TypeScript#38638 |
I'm getting this error when I check types
To reproduce:
I wonder how all other people are using this library without running into this issue?
The text was updated successfully, but these errors were encountered: