s2cfgtojson 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Struct.mts +11 -0
- package/package.json +1 -1
package/Struct.mts
CHANGED
|
@@ -2,6 +2,17 @@ export type Value = Omit<Struct, "toTs"> | string | boolean | number;
|
|
|
2
2
|
type DefaultEntries = { _isArray?: boolean; _useAsterisk?: boolean };
|
|
3
3
|
export type Entries = Record<string | number, Value> & DefaultEntries;
|
|
4
4
|
|
|
5
|
+
export type GetTsType<In extends Struct, E = In["entries"]> = {
|
|
6
|
+
[key in Exclude<keyof E, keyof DefaultEntries>]: E[key] extends Struct
|
|
7
|
+
? GetTsType<E[key]>
|
|
8
|
+
: E[key];
|
|
9
|
+
};
|
|
10
|
+
export type GetStructType<In extends Record<string | number, any>> = Struct<{
|
|
11
|
+
[key in Exclude<keyof In, keyof DefaultEntries>]: In[key] extends In
|
|
12
|
+
? GetStructType<In[key]>
|
|
13
|
+
: In[key];
|
|
14
|
+
}>;
|
|
15
|
+
|
|
5
16
|
/**
|
|
6
17
|
* This file is part of the Stalker 2 Modding Tools project.
|
|
7
18
|
* This is a base class for all structs.
|