Skip to content

Type Only Import Reference #1736

Open
Open
@ChadKillingsworth

Description

@ChadKillingsworth

A key component to avoiding circular dependencies is the option to reference a type without importing the module.

Example:

import ModelEvent from './model-event';

export default class Model extends EventTarget {
  changeItem(item) {
    this.item = item;
    this.dispatchEvent(new ModelEvent('change:'+item.name, this, item));
  }
}
import Model from './model';

export default class ModelEvent extends Event {
   /**
   * @param {string|!goog.events.EventId} type Event Type.
   * @param {!Model} model
   */
  constructor(type, model) {
  }
}

We need a way (without requiring closure-library) to import or reference a type from another module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentationtriage-doneHas been reviewed by someone on triage rotation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions