Skip to content

Commit f5239c7

Browse files
authored
🤖 Merge PR DefinitelyTyped#73320 [elm] refactor into an ESM .d.ts by @lishaduck
1 parent 1cedcfa commit f5239c7

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

types/elm/elm-tests.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import { ElmApp, ElmInstance, ElmMain, ElmModule, PortFromElm, PortToElm } from "elm";
2+
13
declare global {
24
var Elm: ElmInstance<{}, {}>;
35
}
46

5-
Elm.Main.init();
7+
(Elm.Main satisfies ElmMain<{}, {}>).init() satisfies ElmApp<{}>;
68

79
// https://gist.github.com/evancz/8521339
810
declare var Shanghai: ElmModule<

types/elm/index.d.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
interface ElmModule<
1+
export interface ElmModule<
22
P,
33
F,
44
Entrypoints extends string[] =
@@ -8,7 +8,7 @@ interface ElmModule<
88
Elm: ElmInstance<P, F, Entrypoints>;
99
}
1010

11-
type ElmInstance<
11+
export type ElmInstance<
1212
P,
1313
F,
1414
// eslint-disable-next-line @definitelytyped/no-single-element-tuple-type
@@ -21,19 +21,21 @@ type NestedEntrypoints<Entrypoints extends string[], P, F> = Entrypoints extends
2121
] ? { [K in First]: NestedEntrypoints<Rest, P, F> }
2222
: ElmMain<P, F>;
2323

24-
interface ElmMain<P, F> {
24+
export interface ElmMain<P, F> {
2525
init(options?: { node?: Node | undefined; flags: F } | undefined): ElmApp<P>;
2626
}
2727

28-
interface ElmApp<P> {
28+
export interface ElmApp<P> {
2929
ports: P;
3030
}
3131

32-
interface PortToElm<V> {
32+
export interface PortToElm<V> {
3333
send(value: V): void;
3434
}
3535

36-
interface PortFromElm<V> {
36+
export interface PortFromElm<V> {
3737
subscribe(handler: (value: V) => void): void;
3838
unsubscribe(handler: (value: V) => void): void;
3939
}
40+
41+
export {};

types/elm/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"private": true,
33
"name": "@types/elm",
44
"version": "0.19.9999",
5+
"type": "module",
56
"projects": [
67
"http://elm-lang.org"
78
],

0 commit comments

Comments
 (0)