ts-interface-builder icon indicating copy to clipboard operation
ts-interface-builder copied to clipboard

Lookup or indexed access operator doesn't support

Open Crusader4Christ opened this issue 4 years ago • 1 comments

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-1.html

Sorry, maybe I just not found... Does this builder support lookups?

interface i1 {
  field: string
}
interface i2 {
  field: i1["field"]
}

Crusader4Christ avatar Sep 14 '20 01:09 Crusader4Christ

Props inside the iface is array, so only way to implement this lookup like

  private _compileIndexedAccessType(node: ts.IndexedAccessTypeNode): string {
    return `this.${node.objectType.getText()}.props.find(prop => prop.name === ${node.indexType.getText()})`;
  }

Guys I need your help.

Crusader4Christ avatar Sep 14 '20 02:09 Crusader4Christ