Skip to content

Commit 72123f4

Browse files
authored
🤖 Merge PR DefinitelyTyped#74420 Add type declarations for PrismJS component dependencies and loader by @tcaesvk
1 parent 9a2d6a3 commit 72123f4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

types/prismjs/dependencies.d.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
export interface ComponentEntry {
2+
title?: string;
3+
owner?: string;
4+
noCSS?: boolean;
5+
alias?: string | readonly string[];
6+
aliasTitles?: Readonly<Record<string, string>>;
7+
8+
optional?: string | readonly string[];
9+
require?: string | readonly string[];
10+
modify?: string | readonly string[];
11+
}
12+
13+
export type ComponentCategory = Record<string, string | Readonly<ComponentEntry>>;
14+
15+
export type Components = Record<string, Readonly<ComponentCategory>>;
16+
17+
export interface LoadChainer<T> {
18+
series: (before: T, after: () => T) => T;
19+
parallel: (values: readonly T[]) => T;
20+
}
21+
22+
export type LoadFunction = <T>(loadComponent: (id: string) => T, chainer?: Readonly<LoadChainer<T>>) => T;
23+
24+
export interface Loader {
25+
getIds: () => string[];
26+
load: LoadFunction;
27+
}
28+
29+
function getLoader(
30+
components: Readonly<Components>,
31+
load: readonly string[],
32+
loaded?: readonly string[],
33+
): Loader;
34+
35+
export = getLoader;

0 commit comments

Comments
 (0)