ソースを参照

Add declaration file for ColorThief

Include declaration for ColorThief since it is written in JavaScript
only.
pull/1/head
コミット
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;


読み込み中…
キャンセル
保存