-
Notifications
You must be signed in to change notification settings - Fork 64
/
components.ts
42 lines (36 loc) · 1005 Bytes
/
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
39
40
41
42
/**
* 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.
*
* From https://github.com/KonstantinSimeonov/tsx-control-statements/blob/master/transformer/components.ts
*/
export function Choose(props: { children?: any }) {
return props.children;
}
export function When(props: { children?: any; condition: boolean }) {
return props.children;
}
export function If(props: { children?: any; condition: boolean }) {
return props.children;
}
type NoBody<T> = {
children?: any;
each: string;
of: Iterable<T>;
index?: string;
};
type WithBody<T> = {
children?: any;
of: Iterable<T>;
body: (x: T, index: number) => any;
};
export function For<T>(props: NoBody<T> | WithBody<T>) {
return props.children;
}
export function Otherwise(props: { children?: any }) {
return props.children;
}
export function With(props: { [id: string]: any }) {
return props.children;
}