Skip to content
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

Feature Request: Name space type names as needed rather than change them #2859

Closed
kensodemann opened this issue Mar 19, 2021 · 1 comment
Closed
Labels

Comments

@kensodemann
Copy link
Member

Stencil version:

I'm submitting a:

[ ] bug report
[x] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:
When components import types specific to them, sometimes exposed in public APIs, if any of these types happen to have a duplicate name, the generated types will rename conflicting imports successfully, but will only refer to one type in all component APIs that use the duplicate-named type.

For example, the following two components have a local same-named type Name used in a public method (boilerplate component code omitted):

// my-person.tsx
import { Name } from './resources';

@Method()
saySomething(name: Name): void {
  console.log(name);
  }

// my-pupper.tsx
import { Name } from './resources';

@Method()
saySomething(name: Name): void {
  console.log(name);
}

Which produces the following in components.d.ts

import { Name } from "./components/my-person/resources";
import { Name as Name1 } from "./components/my-pupper/resources";
export namespace Components {
  interface MyPerson {
    "saySomething": (name: Name) => Promise<void>;
  }
  interface MyPupper {
    "saySomething": (name: Name) => Promise<void>;
  }
}

Expected behavior:
Can the compiler use namespacing, inline the types or something else to avoid having to rename the types unnecessarily?

Related code:
Repo for repro case: https://github.com/jcfranco/stencil-duplicate-types-not-assigned-correctly-in-component-typings

@rwaskiewicz
Copy link
Contributor

@kensodemann A fix for this issue has been released as a part of Stencil v2.15.2. I'm going to close this issue as a result. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants