runem / web-component-analyzer

CLI that analyzes web components and emits documentation
https://runem.github.io/web-component-analyzer
MIT License
506 stars 65 forks source link

Interfaces that extend imported interfaces don't get extended fields #59

Closed rictic closed 5 years ago

rictic commented 5 years ago

Consider a project like:

// base.ts
export interface Checked {
  checked: boolean;
}
// main.ts
import {Checked} from './base';

interface CheckableElement extends HTMLElement, Checked {}

declare global {
  interface HTMLElementTagNameMap {
    'checkable-element': CheckableElement;
  }
}

web-component-analyzer appears not to know that <checkable-element> has a .checked property. The issue seems to be specific to interfaces that extend imported interfaces. Specifically, I checked these cases:

Standalone repro at https://github.com/rictic/repro-wca-import-interface-issue

runem commented 5 years ago

Thank you so much for this issue and the repro. I have now fixed the problem and added test cases to this file so it won't happen again :tada:

rictic commented 5 years ago

Nice! I can confirm that that fixes the bug here.

I think there's something still up with the original code that I reduced this down from, which is that the plugin can't find the checked property on <paper-checkbox>. I'm working on coming up with a minimal repro now.