This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const someVariable: { | |
prop1: "value1", | |
props2: "value2", | |
nestedType: { | |
nestedProps: "nested value", | |
... | |
}, | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------- Typing Operators ------- | |
// https://github.com/pirix-gh/medium/blob/master/types-curry-ramda/src/index.ts | |
export type Iterator< | |
Index extends number = 0, | |
From extends any[] = [], | |
I extends any[] = [] | |
> = { | |
0: Iterator<Index, Next<From>, Next<I>>; | |
1: From; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SliceTuple< | |
T extends any[], | |
TMaxItem extends number = 2, | |
R extends any[] = [], | |
P extends any[] = [], | |
I extends any[] = [] | |
> = { | |
0: SliceTuple<T, TMaxItem, R, Prepend<T[Pos<I>], P>, Next<I>>; | |
1: Reverse<Prepend<Reverse<P>, R>>; | |
2: SliceTuple<T, TMaxItem, Prepend<Reverse<P>, R>, [T[Pos<I>]], Next<I>>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type TestTuple = [ | |
"key1", | |
"union type 1" | "union type 2" | "union type 3", | |
"key2", | |
string, | |
"key3", | |
number, | |
"key4", | |
[string, number, null | string] | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... import types | |
type ComponentProps: { | |
EnvironmentVariable: TestListToUnion // [] | ["key1", "union type 1" | "union type 2" | "union type 3"] | ["key2", string] | ["key3", number] ... | |
EnvironmentVariables: TestListToTypeAlias // {key4: "type of string";} & {key3: number;} ... | |
SelectedEnvironmentVariableKey: TestKeys // "key1" | "key2" | "key3" | "key4" | undefined | |
... | |
} | |
function Component(props: ComponentProps) { |
OlderNewer