import type { ComponentLike } from '@glint/template';
import { typeTest } from '@glint/type-test';
typeTest(
{
x: null as any as ComponentLike<{ Args: { required: number } }>,
},
hbs`
{{! @glint-expect-error }}
{{component this.x}}
{{#let (component this.x) as |Component|}}
{{! @glint-expect-error }}
<Component />
{{/let}}
`,
);
The first @glint-expect-error fails, that is, there is no error on the following line, even though the required parameter is not passed. The <Component /> line is correctly marked as problematic.
I was under the impression that the first case will never be supported and one should always use let with component. If so, it would be nice to have an error message when using component in non-block form (as there seems to be an error when using it in a block form). If both ways are supposed to work, then this is a bug.
The first
@glint-expect-error
fails, that is, there is no error on the following line, even though therequired
parameter is not passed. The<Component />
line is correctly marked as problematic.I was under the impression that the first case will never be supported and one should always use
let
withcomponent
. If so, it would be nice to have an error message when usingcomponent
in non-block form (as there seems to be an error when using it in a block form). If both ways are supposed to work, then this is a bug.This is what I mentioned in this comment.
cc @dfreeman