@glint/template 0.8.0 → 0.8.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/-private/index.d.ts +5 -5
- package/-private/integration.d.ts +1 -0
- package/package.json +1 -1
package/-private/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
AcceptsBlocks,
|
|
3
3
|
AnyFunction,
|
|
4
4
|
BoundModifier,
|
|
5
|
-
|
|
5
|
+
GuardEmpty,
|
|
6
6
|
FlattenBlockParams,
|
|
7
7
|
Invokable,
|
|
8
8
|
} from './integration';
|
|
@@ -14,12 +14,12 @@ import { ExpandSignature } from '@glimmer/component/-private/component';
|
|
|
14
14
|
* `GlimmerComponent` are examples of `ComponentLike` values, as are
|
|
15
15
|
* the values returned from the `{{component}}` helper.
|
|
16
16
|
*
|
|
17
|
-
* The `S` signature
|
|
17
|
+
* The `S` signature parameter here is of the same form as the one
|
|
18
18
|
* accepted by both the Ember and Glimmer `Component` base classes.
|
|
19
19
|
*/
|
|
20
20
|
export type ComponentLike<S = unknown> = InvokableConstructor<
|
|
21
21
|
(
|
|
22
|
-
named: ExpandSignature<S>['Args']['Named']
|
|
22
|
+
named: GuardEmpty<ExpandSignature<S>['Args']['Named']>,
|
|
23
23
|
...positional: ExpandSignature<S>['Args']['Positional']
|
|
24
24
|
) => AcceptsBlocks<
|
|
25
25
|
FlattenBlockParams<ExpandSignature<S>['Blocks']>,
|
|
@@ -89,7 +89,7 @@ export type WithBoundArgs<
|
|
|
89
89
|
>
|
|
90
90
|
? InvokableConstructor<
|
|
91
91
|
(
|
|
92
|
-
named: Omit<Named, BoundArgs> & Partial<Pick<Named, BoundArgs & keyof Named
|
|
92
|
+
named: GuardEmpty<Omit<Named, BoundArgs> & Partial<Pick<Named, BoundArgs & keyof Named>>>,
|
|
93
93
|
...positional: Positional
|
|
94
94
|
) => Result
|
|
95
95
|
>
|
|
@@ -109,6 +109,6 @@ type Constrain<T, Constraint, Otherwise = Constraint> = T extends Constraint ? T
|
|
|
109
109
|
// different layers of possible shorthand, but modifiers and helpers only have
|
|
110
110
|
// one structure they can specify their args in, so this utility is sufficient.
|
|
111
111
|
type InvokableArgs<S> = [
|
|
112
|
-
named: Get<Get<S, 'Args'>, 'Named'
|
|
112
|
+
named: GuardEmpty<Get<Get<S, 'Args'>, 'Named'>>,
|
|
113
113
|
...positional: Constrain<Get<Get<S, 'Args'>, 'Positional'>, Array<unknown>, []>
|
|
114
114
|
];
|
|
@@ -25,6 +25,7 @@ export type HasContext<T extends AnyContext = AnyContext> = { [Context]: T };
|
|
|
25
25
|
// special-cased in the type system not to trigger EPC.
|
|
26
26
|
declare const EmptyObject: unique symbol;
|
|
27
27
|
export type EmptyObject = { [EmptyObject]?: void };
|
|
28
|
+
export type GuardEmpty<T> = T extends any ? (keyof T extends never ? EmptyObject : T) : never;
|
|
28
29
|
|
|
29
30
|
declare const Element: unique symbol;
|
|
30
31
|
declare const Modifier: unique symbol;
|