Ver código fonte

Add declaration file for ColorThief

Include declaration for ColorThief since it is written in JavaScript
only.
pull/1/head
TheoryOfNekomata 1 ano atrás
pai
commit
ac05503e6c
2 arquivos alterados com 6 adições e 1 exclusões
  1. +5
    -0
      packages/web-kitchensink-reactnext/colorthief.d.ts
  2. +1
    -1
      packages/web-kitchensink-reactnext/src/utils/image.ts

+ 5
- 0
packages/web-kitchensink-reactnext/colorthief.d.ts Ver arquivo

@@ -0,0 +1,5 @@
declare module 'colorthief' {
export default class ColorThief {
getPalette(image: HTMLImageElement, colorCount: number): Promise<[number, number, number][]>;
}
}

+ 1
- 1
packages/web-kitchensink-reactnext/src/utils/image.ts Ver arquivo

@@ -1,6 +1,6 @@
import ColorThief from 'colorthief';

export const getImageMetadata = (imageUrl: string) => new Promise<Record<string, string | number>>((resolve, reject) => {
export const getImageMetadata = (imageUrl: string) => new Promise<Record<string, string | number | [number, number, number][]>>((resolve, reject) => {
const image = new Image();
image.addEventListener('load', async (imageLoadEvent) => {
const thisImage = imageLoadEvent.currentTarget as HTMLImageElement;


Carregando…
Cancelar
Salvar