Преглед на файлове

Add declaration file for ColorThief

Include declaration for ColorThief since it is written in JavaScript
only.
pull/1/head
TheoryOfNekomata преди 1 година
родител
ревизия
ac05503e6c
променени са 2 файла, в които са добавени 6 реда и са изтрити 1 реда
  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 Целия файл

@@ -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 Целия файл

@@ -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;


Зареждане…
Отказ
Запис