Open NullVoxPopuli opened 9 months ago
I changed my args to my tiny components to be "any" and the issue went away.
Issue present
menu: MenuTypes.Menu;
trigger: ModifierLike;
Issue gone:
menu: MenuTypes.Menu;
trigger: any;
So.. that strongly looks like a bug in how the types for (component)
interact with the ModifierLike type
Just ran in to this with a yielded component type, too
Another repro:
import Component from '@glimmer/component';
import { modifier } from 'ember-modifier';
import type { ModifierLike } from '@glint/template';
class Scroller extends Component<{ Element: HTMLDivElement; Blocks: { default: [scrollToBottom: ModifierLike<{ }>]}}> {
declare withinElement: HTMLDivElement;
ref = modifier(( el: HTMLDivElement ) => {
this.withinElement = el;
});
<template>
<div ...attributes {{this.ref}}>
{{yield (modifier scrollToBottom this.withinElement)}}
</div>
</template>
}
Error:
Diagnostics:
1. glint: Type instantiation is excessively deep and possibly infinite. [2589]
I have another error because scrollToBottom
s usage isn't correct (yet), but the use of a ModifierLike
or any *Like should not cause infinite type evaluation, yeah?
I also meant to not use ModifierLike
in this situation, so ignore that.
For some reason updating to 1.4.0 from 1.3.0 fixed the (only) case I have in my codebase of this issue. I'm not using template-imports (which is the only change according to the changelog) so I'm not sure how that might have had an effect... but that's that. :)
I found this issue when simply trying to conditionally apply a modifier:
<button type="button" {{(if @onClick (modifier on "click" @onClick))}}>
Click
</button>
Repro:
git clone git@github.com:NullVoxPopuli/limber.git
cd limber
git checkout e6088f30e7036fd2bfe096e7a6c2f93c78e0e18b
pnpm build
cd apps/repl
pnpm lint:types
Error:
For this component, Menu, I've specified:
and PlainTrigger is:
and the menu types are:
idk what the solution here is, but this feels undebuggable