Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit e884c72

Browse files
committed
Fix type tests and comments about EmptyObject
1 parent c50e0e0 commit e884c72

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/types/component-test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { expectTypeOf } from 'expect-type';
22
import * as gc from '@glimmer/component';
33

4+
// Imported from non-public-API so we can check that we are publishing what we
5+
// expect to be -- and this keeps us honest about the fact that if we *change*
6+
// this import location, we've broken any existing declarations published using
7+
// the current type signatures.
8+
import { EmptyObject } from '@glimmer/component/addon/-private/component';
9+
410
const Component = gc.default;
511

612
expectTypeOf(gc).toHaveProperty('default');
@@ -33,9 +39,7 @@ interface ElementOnly {
3339

3440
const componentWithElOnly = new Component<ElementOnly>({}, {});
3541

36-
// We cannot check on toEqualTypeOf here b/c EmptyObject is intentionally not
37-
// public.
38-
expectTypeOf(componentWithElOnly.args).toMatchTypeOf<Readonly<{}>>();
42+
expectTypeOf(componentWithElOnly.args).toEqualTypeOf<Readonly<EmptyObject>>();
3943

4044
interface Blocks {
4145
default: [name: string];
@@ -48,9 +52,7 @@ interface BlockOnlySig {
4852

4953
const componentWithBlockOnly = new Component<BlockOnlySig>({}, {});
5054

51-
// We cannot check on toEqualTypeOf here b/c EmptyObject is intentionally not
52-
// public.
53-
expectTypeOf(componentWithBlockOnly.args).toMatchTypeOf<Readonly<{}>>();
55+
expectTypeOf(componentWithBlockOnly.args).toEqualTypeOf<Readonly<EmptyObject>>();
5456

5557
interface ArgsAndBlocks {
5658
Args: Args;

0 commit comments

Comments
 (0)