-
Notifications
You must be signed in to change notification settings - Fork 9
/
components.ts
38 lines (31 loc) · 1.09 KB
/
components.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Stub definitions that will be replaced by the transformer.
* They're used to provide type definitions for the typescript
* compiler and various static analysis tools.
*/
type JsxChild = string | boolean | number | null | undefined | JSX.Element;
type JsxChildren = JsxChild | JsxChild[];
export function Choose(props: { children: JsxChildren }) {
return props.children as any;
}
export function When(props: { children: JsxChildren; condition: unknown }) {
return props.children as any;
}
export function If(props: { children: JsxChildren; condition: unknown }) {
return props.children as any;
}
type NoBody<T> = { children?: JsxChildren; each: string; of: Iterable<T>; index?: string };
type WithBody<T> = {
children?: JsxChildren;
of: Iterable<T>;
body: (x: T, index: number) => JsxChildren;
};
export function For<T>(props: NoBody<T> | WithBody<T>) {
return undefined as any;
}
export function Otherwise(props: { children: JsxChildren }) {
return props.children as any;
}
export function With(props: { children: JsxChildren; [id: string]: any }) {
return props.children as any;
}