Skip to content
Merged
1 change: 0 additions & 1 deletion ember-container-query/src/components/container-query.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{! @glint-ignore: ember-element-helper needs to provide Glint signature }}
Copy link
Owner Author

@ijlee2 ijlee2 Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dan on Discord:

it looks like a bug

specifically, if I set noEmitOnError: false, declarations are emitted

I'm guessing it happens to work with --build because that will always emit declarations, regardless of errors (because --build prioritizes having declarations available for your other project references)

ah

it's because of the @glint-ignore here
https://github.com/ijlee2/ember-container-query/blob/4.0.4/ember-container-query/src/components/container-query.hbs#L1

the bug appears to be that TS internally is counting that as an error that triggers noEmitOnError behavior

if I add an entry for element in the registry in unpublished-development-types, everything works

{{#let (element this.tagName) as |Tag|}}
<Tag
class="container-query"
Expand Down
15 changes: 15 additions & 0 deletions ember-container-query/unpublished-development-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,26 @@

import '@glint/environment-ember-loose';

import { ComponentLike, HelperLike } from '@glint/template';

import EmberContainerQueryRegistry from '../src/template-registry';

interface ElementHelperSignature<T extends string> {
Args: {
Positional: [name: T];
};
Return: ComponentLike<{
Blocks: { default: [] };
Element: T extends keyof HTMLElementTagNameMap
? HTMLElementTagNameMap[T]
: Element;
}>;
}
Comment on lines +10 to +20
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


declare module '@glint/environment-ember-loose/registry' {
export default interface Registry extends EmberContainerQueryRegistry {
// Add any registry entries from other addons here that your addon itself uses (in non-strict mode templates)
// See https://typed-ember.gitbook.io/glint/using-glint/ember/using-addons
element: HelperLike<ElementHelperSignature>;
}
}