Skip to content

Commit

Permalink
add Glint check for inferred type of and and or helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Astapov committed Sep 2, 2023
1 parent 7b251ea commit 9766373
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
{{log @andArg}}
{{log @orArg}}
</div>
19 changes: 19 additions & 0 deletions packages/modern-test-app/app/components/and-or-type-checking.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import templateOnly from '@ember/component/template-only';

interface Signature {
Element: HTMLDivElement;
Args: {
andArg: object | boolean;
orArg: object | boolean;
};
}

const AndOrTypeChecking = templateOnly<Signature>();

export default AndOrTypeChecking;

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
AndOrTypeChecking: typeof AndOrTypeChecking;
}
}
7 changes: 6 additions & 1 deletion packages/modern-test-app/app/templates/helpers.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@
{{not-eq 6 5}}
{{not true}}
{{or true false}}
{{xor true false}}
{{xor true false}}

<AndOrTypeChecking
@andArg={{or (hash) (array)}}
@orArg={{and (hash) (array)}}
/>

0 comments on commit 9766373

Please sign in to comment.