typed-ember / glint

TypeScript powered tooling for Glimmer templates
https://typed-ember.gitbook.io/glint
MIT License
110 stars 52 forks source link

If route is named `components` model types are not inferred #720

Closed aklkv closed 4 months ago

aklkv commented 6 months ago

If we have structure like:

templates/
  components/
    text.hbs
routes/
  components/
    text.ts

and the content of the route.ts:

 import Route from '@ember/routing/route';

export default class ComponentsTextRoute extends Route {
  model() {
    return {
      message: 'Components Text Route',
    };
  }
}

we get the following glint error:

Screenshot 2024-05-17 at 12 17 09 PM

Anything outside of template/components folders works just fine. I am guessing there might be some naming clash.

I can also publish repro if needed

NullVoxPopuli commented 6 months ago

this is an extra troll as well, because templates/components was the folder used for all component hbs files pre-Octane.

It'd be good to drop support for that pattern entirely in Glint so that this bug can be fixed.

ef4 commented 6 months ago

I would be surprised if glint is the only thing that breaks when using a route named "components".

We're planning to drop support for components putting their template files into templates/components/*.hbs at ember 6.0, but before that point components very much might resolve template files there. In your example, if you happen to have a component named "text", ember will probably try to resolve your templates/components/text.hbs as its template.

It would be good to do a review across the whole stack to see what still treats templates/components as special, since those are all places that can get cleaned up at ember 6.0.