Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Nov 24, 2024
1 parent afd1cee commit 008eff2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
4 changes: 2 additions & 2 deletions packages/media/src/test/isAnimatedGif.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('isAnimatedGif', () => {
buffer.byteOffset,
buffer.byteOffset + buffer.byteLength
);
const result = isAnimatedGif(arrayBuffer);
const result = isAnimatedGif(arrayBuffer as unknown as ArrayBuffer);

expect(result).toBeTrue();
});
Expand All @@ -43,7 +43,7 @@ describe('isAnimatedGif', () => {
buffer.byteOffset,
buffer.byteOffset + buffer.byteLength
);
const result = isAnimatedGif(arrayBuffer);
const result = isAnimatedGif(arrayBuffer as unknown as ArrayBuffer);

expect(result).toBeFalse();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ interface CaretPosition {
}

interface SelectionDocument extends Document {
caretPositionFromPoint?: (x: number, y: number) => CaretPosition | null;
caretPositionFromPoint: (
x: number,
y: number,
options?: CaretPositionFromPointOptions
) => CaretPosition | null;
}

// Extend for wider browser support.
Expand Down
8 changes: 4 additions & 4 deletions packages/story-editor/src/app/canvas/useCanvasKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function useCanvasKeys(ref: RefObject<Node>) {
// Position (x/y) key handler.
useGlobalKeyDownEffect(
{ key: ['up', 'down', 'left', 'right'], shift: true },
({ key, shiftKey }) => {
({ key, shiftKey }: KeyboardEvent) => {
if (isEditing || !selectedElements?.length) {
return;
}
Expand All @@ -204,7 +204,7 @@ function useCanvasKeys(ref: RefObject<Node>) {
// Layer up/down.
useGlobalKeyDownEffect(
{ key: ['mod+up', 'mod+down', 'mod+left', 'mod+right'], shift: true },
(evt) => {
(evt: KeyboardEvent) => {
const { key, shiftKey } = evt;

// Cancel the default behavior of the event: it's very jarring to run
Expand Down Expand Up @@ -293,7 +293,7 @@ function useCanvasKeys(ref: RefObject<Node>) {
].includes(animationState);
useGlobalKeyDownEffect(
{ key: ['mod+enter'] },
(evt) => {
(evt: KeyboardEvent) => {
evt.preventDefault();
if (currentPageNumber === 1) {
return;
Expand All @@ -313,7 +313,7 @@ function useCanvasKeys(ref: RefObject<Node>) {

useGlobalKeyDownEffect(
{ key: ['mod+k'] },
(evt) => {
(evt: KeyboardEvent) => {
evt.preventDefault();
if (
!selectedElements.length ||
Expand Down
2 changes: 1 addition & 1 deletion packages/story-editor/src/app/media/utils/heif/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function decodeImage(image: DecodeResult) {
if (!result) {
reject(new Error('HEIF processing error'));
} else {
resolve(result.data.buffer);
resolve(result.data.buffer as ArrayBuffer);
}
}
);
Expand Down
16 changes: 8 additions & 8 deletions packages/story-editor/src/app/media/utils/useFFmpeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function useFFmpeg() {
const data = ffmpeg.FS('readFile', tempFileName);

return blobToFile(
new Blob([data.buffer], { type: MEDIA_POSTER_IMAGE_MIME_TYPE }),
new Blob([data.buffer as BlobPart], { type: MEDIA_POSTER_IMAGE_MIME_TYPE }),

Check failure on line 208 in packages/story-editor/src/app/media/utils/useFFmpeg.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/story-editor/src/app/media/utils/useFFmpeg.ts#L208

[prettier/prettier] Replace `·type:·MEDIA_POSTER_IMAGE_MIME_TYPE` with `⏎············type:·MEDIA_POSTER_IMAGE_MIME_TYPE,⏎·········`
outputFileName,
MEDIA_POSTER_IMAGE_MIME_TYPE
);
Expand Down Expand Up @@ -263,7 +263,7 @@ function useFFmpeg() {
const data = ffmpeg.FS('readFile', tempFileName);

return blobToFile(
new Blob([data.buffer], { type: MEDIA_TRANSCODED_MIME_TYPE }),
new Blob([data.buffer as BlobPart], { type: MEDIA_TRANSCODED_MIME_TYPE }),

Check failure on line 266 in packages/story-editor/src/app/media/utils/useFFmpeg.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/story-editor/src/app/media/utils/useFFmpeg.ts#L266

[prettier/prettier] Replace `·type:·MEDIA_TRANSCODED_MIME_TYPE` with `⏎············type:·MEDIA_TRANSCODED_MIME_TYPE,⏎·········`
outputFileName,
MEDIA_TRANSCODED_MIME_TYPE
);
Expand Down Expand Up @@ -348,7 +348,7 @@ function useFFmpeg() {
.map((outputFile) => {
const data = (ffmpeg as FFmpeg).FS('readFile', outputFile);
return blobToFile(
new Blob([data.buffer], { type }),
new Blob([data.buffer as BlobPart], { type }),
outputFile,
type
);
Expand Down Expand Up @@ -417,7 +417,7 @@ function useFFmpeg() {
const data = ffmpeg.FS('readFile', tempFileName);

return blobToFile(
new Blob([data.buffer], { type }),
new Blob([data.buffer as BlobPart], { type }),
outputFileName,
type
);
Expand Down Expand Up @@ -478,7 +478,7 @@ function useFFmpeg() {
const data = ffmpeg.FS('readFile', tempFileName);

return blobToFile(
new Blob([data.buffer], { type }),
new Blob([data.buffer as BlobPart], { type }),
outputFileName,
type
);
Expand Down Expand Up @@ -538,7 +538,7 @@ function useFFmpeg() {
const data = ffmpeg.FS('readFile', tempFileName);

return blobToFile(
new Blob([data.buffer], { type }),
new Blob([data.buffer as BlobPart], { type }),
outputFileName,
type
);
Expand Down Expand Up @@ -596,7 +596,7 @@ function useFFmpeg() {
const data = ffmpeg.FS('readFile', tempFileName);

return blobToFile(
new Blob([data.buffer], { type: MEDIA_TRANSCODED_MIME_TYPE }),
new Blob([data.buffer as BlobPart], { type: MEDIA_TRANSCODED_MIME_TYPE }),

Check failure on line 599 in packages/story-editor/src/app/media/utils/useFFmpeg.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/story-editor/src/app/media/utils/useFFmpeg.ts#L599

[prettier/prettier] Replace `·type:·MEDIA_TRANSCODED_MIME_TYPE` with `⏎············type:·MEDIA_TRANSCODED_MIME_TYPE,⏎·········`
outputFileName,
MEDIA_TRANSCODED_MIME_TYPE
);
Expand Down Expand Up @@ -651,7 +651,7 @@ function useFFmpeg() {
const data = ffmpeg.FS('readFile', tempFileName);

return blobToFile(
new Blob([data.buffer], { type: 'audio/mpeg' }),
new Blob([data.buffer as BlobPart], { type: 'audio/mpeg' }),
outputFileName,
'audio/mpeg'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function useCarouselKeys({
useKeyDownEffect(
listElement,
{ key: ['up', 'down', 'left', 'right'] },
({ key }) => {
({ key }: KeyboardEvent) => {
// Intercept all keys, but only handle left and right.
const dir = getArrowDir(key, 'ArrowRight', 'ArrowLeft', isRTL);
if (dir === 0) {
Expand Down Expand Up @@ -103,7 +103,7 @@ function useCarouselKeys({
useKeyDownEffect(
listElement,
{ key: ['mod+up', 'mod+down', 'mod+left', 'mod+right'], shift: true },
(evt) => {
(evt: KeyboardEvent) => {
const { key, shiftKey } = evt;

// Cancel the default behavior of the event: it's very jarring to run
Expand Down

0 comments on commit 008eff2

Please sign in to comment.