Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Broken template typings #1616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hoebbelsB opened this issue Oct 13, 2023 · 15 comments · Fixed by #1694
Closed

Broken template typings #1616

hoebbelsB opened this issue Oct 13, 2023 · 15 comments · Fixed by #1694
Labels
🐞 Bug Bug: Something isn't working </> Template @rx-angular/template related

Comments

@hoebbelsB
Copy link
Member

Description

I think this commit broke our template type support. Before, the types were properly inferred by whatever observable I've provided. I think it has something todo with the way how the TemplateRef is injected into the component. From what I know it has to be part of the constructor.

@edbzn @eneajaho any idea?

image

@hoebbelsB hoebbelsB added 🐞 Bug Bug: Something isn't working </> Template @rx-angular/template related labels Oct 13, 2023
@hoebbelsB
Copy link
Member Author

is it a duplicate of ? #1590

@eneajaho
Copy link
Member

CleanShot 2023-10-13 at 09 27 54@2x
CleanShot 2023-10-13 at 09 29 08@2x

Both vscode and webstorm infer types correctly for RxFor ?

@hoebbelsB
Copy link
Member Author

@eneajaho what is messing up my IDE then? :D

@eneajaho
Copy link
Member

@eneajaho what is messing up my IDE then? :D

Can you try in vscode to see if the issue is the IDE.

@edbzn
Copy link
Member

edbzn commented Oct 15, 2023

On my end, I never get any variable inference in the template, but it's also not working with ngFor. I compared inline HTML and separated file but same issue, not sure why. 😄

@Karnaukhov-kh
Copy link
Member

Just a small note. Example from Julian I assume is not with observable. Example from Enea is. 🧐

I also remember stumbling upon this issue with non-observable values, but wasn't focusing on that before.

@luii
Copy link

luii commented Nov 1, 2023

2023.3 EAP from Webstorm got pushed out with some type inferring fixes in their changelog maybe this could fix it, i dont have any problems in webstorm though and im using *rxFor all the way

@hoebbelsB
Copy link
Member Author

hey @edbzn @eneajaho , I was curious again... so here is the result

TemplateRef injected in ctor
image

TemplateRef injected with inject
image

As u can see, the type is properly derived when the templateRef is injected in the ctor.... I can't explain why this happens, but it does

@eneajaho
Copy link
Member

hey @edbzn @eneajaho , I was curious again... so here is the result

TemplateRef injected in ctor image

TemplateRef injected with inject image

As u can see, the type is properly derived when the templateRef is injected in the ctor.... I can't explain why this happens, but it does

Can you give it a try in vscode? Maybe that's an issue with Webstorm ?

@kkachniarz220
Copy link

kkachniarz220 commented Jan 31, 2024

Any updates?
image
image

WebStorm 2023.3.3

@hoebbelsB
Copy link
Member Author

is it broken for you as well @kkachniarz220 ?

@kkachniarz220
Copy link

yes

@luii
Copy link

luii commented Feb 1, 2024

I honestly think that this is a problem with Webstorms own language service for angular, currently im on NeoVim and im using the Angular LSP with the Language-Server and Service on 17.1.0 and it shows me the correct types.

grafik

there are plenty of problems with their own integration of it if you look into their webstorm issue tracker.

@luii
Copy link

luii commented Feb 1, 2024

Maybe a upgrade to 2024 EAP would resolve your problem. If you take a look into the changelog of the 2024 EAP newest update you'll find this:
grafik

I've also checked in my 2024 EAP Version and it inferres the type correctly

@kkachniarz220
Copy link

Still not working in 2024 EAP
image

hoebbelsB added a commit that referenced this issue Feb 16, 2024
Multiple users reported the issue that their IDE cannot infer the typings from our structural directives due to the `inject` method. Using the constructor based injection solves that issue
hoebbelsB added a commit that referenced this issue Feb 26, 2024
fix(template): use constructor injection for templateRef. fixes #1616
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug Bug: Something isn't working </> Template @rx-angular/template related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants