Commit be194cb 1 parent 1616501 commit be194cb Copy full SHA for be194cb
File tree 4 files changed +35
-33
lines changed
4 files changed +35
-33
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ export * from "./math";
5
5
export * from "./misc" ;
6
6
export * from "./SelectorObserver" ;
7
7
export * from "./translation" ;
8
+ export * from "./types" ;
Original file line number Diff line number Diff line change 1
1
import { getUnsafeWindow } from "./dom" ;
2
-
3
- /** Represents any value that is either a string itself or can be converted to one (implicitly and explicitly) because it has a toString() method */
4
- export type Stringifiable = string | { toString ( ) : string } ;
5
-
6
- /**
7
- * A type that offers autocomplete for the passed union but also allows any arbitrary value of the same type to be passed.
8
- * Supports unions of strings, numbers and objects.
9
- */
10
- export type LooseUnion < TUnion extends string | number | object > =
11
- ( TUnion ) | (
12
- TUnion extends string
13
- ? ( string & { } )
14
- : (
15
- TUnion extends number
16
- ? ( number & { } )
17
- : (
18
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
- TUnion extends Record < keyof any , unknown >
20
- ? ( object & { } )
21
- : never
22
- )
23
- )
24
- ) ;
25
-
26
- /**
27
- * A type that allows all strings except for empty ones
28
- * @example
29
- * function foo<T extends string>(bar: NonEmptyString<T>) {
30
- * console.log(bar);
31
- * }
32
- */
33
- export type NonEmptyString < TString extends string > = TString extends "" ? never : TString ;
2
+ import type { Stringifiable } from "./types" ;
34
3
35
4
/**
36
5
* Automatically appends an `s` to the passed {@linkcode word}, if {@linkcode num} is not equal to 1
Original file line number Diff line number Diff line change 1
- import { Stringifiable , insertValues } from "./misc" ;
1
+ import { insertValues } from "./misc" ;
2
+ import type { Stringifiable } from "./types" ;
2
3
3
4
/** Trans rights! 🏳️⚧️ */
4
5
const trans : Record < string , Record < string , string > > = { } ;
Original file line number Diff line number Diff line change
1
+ /** Represents any value that is either a string itself or can be converted to one (implicitly and explicitly) because it has a toString() method */
2
+ export type Stringifiable = string | { toString ( ) : string } ;
3
+
4
+ /**
5
+ * A type that offers autocomplete for the passed union but also allows any arbitrary value of the same type to be passed.
6
+ * Supports unions of strings, numbers and objects.
7
+ */
8
+ export type LooseUnion < TUnion extends string | number | object > =
9
+ ( TUnion ) | (
10
+ TUnion extends string
11
+ ? ( string & { } )
12
+ : (
13
+ TUnion extends number
14
+ ? ( number & { } )
15
+ : (
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ TUnion extends Record < keyof any , unknown >
18
+ ? ( object & { } )
19
+ : never
20
+ )
21
+ )
22
+ ) ;
23
+
24
+ /**
25
+ * A type that allows all strings except for empty ones
26
+ * @example
27
+ * function foo<T extends string>(bar: NonEmptyString<T>) {
28
+ * console.log(bar);
29
+ * }
30
+ */
31
+ export type NonEmptyString < TString extends string > = TString extends "" ? never : TString ;
You can’t perform that action at this time.
0 commit comments