@gi-tcg/gts-runtime 0.4.1 → 0.4.3
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/dist/index.d.ts +15 -2
- package/package.json +1 -1
- package/src/view_model.ts +21 -2
package/dist/index.d.ts
CHANGED
|
@@ -217,10 +217,23 @@ interface AttributePositionalReturnBase {
|
|
|
217
217
|
rewriteMeta?: any;
|
|
218
218
|
namedDefinition: AttributeBlockDefinition;
|
|
219
219
|
}
|
|
220
|
-
type
|
|
220
|
+
type OverloadedParameters<T extends (...args: any[]) => any> = T extends {
|
|
221
|
+
(...args: infer A1): any;
|
|
222
|
+
(...args: infer A2): any;
|
|
223
|
+
(...args: infer A3): any;
|
|
224
|
+
(...args: infer A4): any;
|
|
225
|
+
} ? A1 | A2 | A3 | A4 : T extends {
|
|
226
|
+
(...args: infer A1): any;
|
|
227
|
+
(...args: infer A2): any;
|
|
228
|
+
(...args: infer A3): any;
|
|
229
|
+
} ? A1 | A2 | A3 : T extends {
|
|
230
|
+
(...args: infer A1): any;
|
|
231
|
+
(...args: infer A2): any;
|
|
232
|
+
} ? A1 | A2 : T extends ((...args: infer A) => any) ? A : never;
|
|
233
|
+
type AttributeAction<Model, T extends AttributeDefinition> = (model: Model, positional: OverloadedParameters<T>, named: View<ReturnType<T>["namedDefinition"] extends AttributeBlockDefinition ? ReturnType<T>["namedDefinition"] : {
|
|
221
234
|
"~meta": void;
|
|
222
235
|
}>) => void;
|
|
223
|
-
type AttributeBinder<Model, T extends AttributeDefinition> = (model: Model, positional:
|
|
236
|
+
type AttributeBinder<Model, T extends AttributeDefinition> = (model: Model, positional: OverloadedParameters<T>, named: View<ReturnType<T>["namedDefinition"] extends AttributeBlockDefinition ? ReturnType<T>["namedDefinition"] : {
|
|
224
237
|
"~meta": void;
|
|
225
238
|
}>) => T["as"] extends (() => infer U) ? U : void;
|
|
226
239
|
//#endregion
|
package/package.json
CHANGED
package/src/view_model.ts
CHANGED
|
@@ -339,9 +339,28 @@ interface AttributePositionalReturnBase {
|
|
|
339
339
|
namedDefinition: AttributeBlockDefinition;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
+
type OverloadedParameters<T extends (...args: any[]) => any> = T extends {
|
|
343
|
+
(...args: infer A1): any;
|
|
344
|
+
(...args: infer A2): any;
|
|
345
|
+
(...args: infer A3): any;
|
|
346
|
+
(...args: infer A4): any;
|
|
347
|
+
}
|
|
348
|
+
? A1 | A2 | A3 | A4
|
|
349
|
+
: T extends {
|
|
350
|
+
(...args: infer A1): any;
|
|
351
|
+
(...args: infer A2): any;
|
|
352
|
+
(...args: infer A3): any;
|
|
353
|
+
}
|
|
354
|
+
? A1 | A2 | A3
|
|
355
|
+
: T extends { (...args: infer A1): any; (...args: infer A2): any }
|
|
356
|
+
? A1 | A2
|
|
357
|
+
: T extends (...args: infer A) => any
|
|
358
|
+
? A
|
|
359
|
+
: never;
|
|
360
|
+
|
|
342
361
|
export type AttributeAction<Model, T extends AttributeDefinition> = (
|
|
343
362
|
model: Model,
|
|
344
|
-
positional:
|
|
363
|
+
positional: OverloadedParameters<T>,
|
|
345
364
|
named: View<
|
|
346
365
|
ReturnType<T>["namedDefinition"] extends AttributeBlockDefinition
|
|
347
366
|
? ReturnType<T>["namedDefinition"]
|
|
@@ -351,7 +370,7 @@ export type AttributeAction<Model, T extends AttributeDefinition> = (
|
|
|
351
370
|
|
|
352
371
|
export type AttributeBinder<Model, T extends AttributeDefinition> = (
|
|
353
372
|
model: Model,
|
|
354
|
-
positional:
|
|
373
|
+
positional: OverloadedParameters<T>,
|
|
355
374
|
named: View<
|
|
356
375
|
ReturnType<T>["namedDefinition"] extends AttributeBlockDefinition
|
|
357
376
|
? ReturnType<T>["namedDefinition"]
|