Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Wrong type definitions when using with Ember #179

Closed
josemarluedke opened this issue Mar 12, 2019 · 6 comments
Closed

Wrong type definitions when using with Ember #179

josemarluedke opened this issue Mar 12, 2019 · 6 comments
Labels

Comments

@josemarluedke
Copy link
Contributor

josemarluedke commented Mar 12, 2019

Using @glimmer/component version 0.14.0-alpha.3 with Ember (canary) brings the wrong type definitions for TypeScript users.

Current behavior

The types that get used are referent to the glimmer.js implementation of the component.

That implementation is not complaint with Glimmer Components RFC. It includes additional hooks and properties such as didInsertElement, bounds, element, didUpdate on the component class.

This gives wrong type errors when writing components in TS as well wrong auto complete suggestions.

Reproduction

  1. Clone this app
  2. Open a tool that has TS lang server such as VS code and play around

Expected

Types that reflect actual implementation of Glimmer Components RFC.

@chriskrycho
Copy link
Contributor

chriskrycho commented Mar 13, 2019

I just checked and the correct info is on master (here); we just need another alpha (or beta?) release cut.

@josemarluedke
Copy link
Contributor Author

I want to clarify that the this issue is referring to the type definitions of the component class.

See following images:

Screen Shot 2019-03-12 at 1 38 48 PM
Screen Shot 2019-03-12 at 1 39 06 PM

Per Glimmer RFC, we should not have didInsertElement or element. The VS Code auto complete suggests the wrong thing because it is pulling the wrong type for the component.

It uses this file instead of this file.

@rwjblue
Copy link
Member

rwjblue commented Mar 18, 2019

Chatted about this a bit in discord, for now the easiest fix is to override in tsconfig.json.

@chriskrycho / @josemarluedke - Could one of y'all paste the snippet?

@chriskrycho
Copy link
Contributor

In your tsconfig.json's compilerOptions hash:

    "paths": {
      "@glimmer/component": [
        "node_modules/@glimmer/component/addon"
      ]
    },

@jamescdavis
Copy link
Contributor

This should be fixed in @glimmer/component 2.0

See : #235

@locks locks added the v1.x label Apr 18, 2020
@locks
Copy link
Contributor

locks commented Apr 18, 2020

PR mentioned above has been merged.

@locks locks closed this as completed Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants