Use import type whenever possible

This commit is contained in:
DrMint 2024-07-13 13:05:20 +02:00
parent 04ce83b083
commit a5ca1ee9f2
8 changed files with 558 additions and 542 deletions

View File

@ -1,4 +1,4 @@
import { TrackRequestParams } from "./types";
import type { TrackRequestParams } from "./types";
type AnalyticsBody = Record<string, unknown> & {
type: "event" | "request";

View File

@ -1,4 +1,4 @@
import { MeiliDocument, SearchRequest, SearchResponse } from "./types";
import type { MeiliDocument, SearchRequest, SearchResponse } from "./types";
export class MeilisearchSDK {
constructor(

View File

@ -1,5 +1,4 @@
import { Collections } from "../payload/constants";
import {
import type {
EndpointCollectible,
EndpointPage,
EndpointFolder,
@ -9,7 +8,8 @@ import {
EndpointFile,
EndpointRecorder,
EndpointChronologyEvent,
} from "../payload/endpoint-types";
} from "payload/endpoint-types";
import { Collections } from "../payload/constants";
export type MeiliDocument = {
meilid: string;

View File

@ -1,4 +1,4 @@
import { RichTextContent } from "./rich-text";
import type { RichTextContent } from "./rich-text";
export interface TranscriptBlock extends GenericBlock {
lines: (LineBlock | CueBlock)[];

View File

@ -1,5 +1,11 @@
import { AttributeTypes, CollectibleBindingTypes, CollectibleNature, CollectiblePageOrders, Collections } from "./constants";
import { RichTextContent } from "./rich-text";
import type {
Collections,
AttributeTypes,
CollectibleNature,
CollectibleBindingTypes,
CollectiblePageOrders,
} from "./constants";
import type { RichTextContent } from "./rich-text";
export interface EndpointCurrency {
id: string;
@ -207,7 +213,10 @@ export type EndpointFolderPreview = {
};
};
export type EndpointCollectible = Omit<EndpointCollectiblePreview, "translations"> & {
export type EndpointCollectible = Omit<
EndpointCollectiblePreview,
"translations"
> & {
translations: (EndpointCollectiblePreview["translations"][number] & {
description?: RichTextContent;
})[];
@ -408,7 +417,12 @@ export type EndpointFolderPreview = {
export type EndpointSourcePreview = {
id: string;
slug: string;
translations: { language: string; pretitle?: string; title: string; subtitle?: string }[];
translations: {
language: string;
pretitle?: string;
title: string;
subtitle?: string;
}[];
};
export type EndpointSource =
@ -419,7 +433,10 @@ export type EndpointFolderPreview = {
range?:
| { type: "page"; page: number }
| { type: "timestamp"; timestamp: string }
| { type: "custom"; translations: { language: string; note: string }[] };
| {
type: "custom";
translations: { language: string; note: string }[];
};
}
| { type: "page"; page: EndpointSourcePreview }
| { type: "folder"; folder: EndpointSourcePreview }
@ -547,4 +564,3 @@ export type EndpointFolderPreview = {
recorders: { ids: string[] };
chronologyEvents: { ids: string[] };
};

View File

@ -1,17 +1,17 @@
import { Collections } from "./constants";
import {
EndpointAudioPreview,
EndpointImagePreview,
EndpointVideoPreview,
} from "./endpoint-types";
import {
GenericBlock,
SectionBlock,
TranscriptBlock,
BreakBlock,
type GenericBlock,
type SectionBlock,
type TranscriptBlock,
type BreakBlock,
isBlockTranscriptBlock,
isBlockBreakBlock,
} from "./blocks";
import { Collections } from "./constants";
import type {
EndpointImagePreview,
EndpointVideoPreview,
EndpointAudioPreview,
} from "./endpoint-types";
export type RichTextContent = {
root: {

View File

@ -1,24 +1,24 @@
import { Collections } from "./constants";
import {
EndpointAllIds,
EndpointAllSDKUrls,
EndpointAudio,
EndpointChronologyEvent,
import type {
EndpointWebsiteConfig,
EndpointFolder,
EndpointLanguage,
EndpointCurrency,
EndpointWording,
EndpointPage,
EndpointCollectible,
EndpointCollectibleScans,
EndpointCollectibleScanPage,
EndpointCollectibleGallery,
EndpointCollectibleGalleryImage,
EndpointCollectibleScanPage,
EndpointCollectibleScans,
EndpointCurrency,
EndpointFile,
EndpointFolder,
EndpointChronologyEvent,
EndpointImage,
EndpointLanguage,
EndpointPage,
EndpointRecorder,
EndpointAudio,
EndpointVideo,
EndpointWebsiteConfig,
EndpointWording,
EndpointFile,
EndpointRecorder,
EndpointAllSDKUrls,
EndpointAllIds,
} from "./endpoint-types";
export const getSDKEndpoint = {

View File

@ -1,4 +1,4 @@
import { Collections } from "./constants";
import type { Collections } from "./constants";
export type AfterOperationWebHookMessage = {
collection: Collections;