Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stacey-gammon/d3b55b60c731b2bfb037b86144fcc3db to your computer and use it in GitHub Desktop.
Save stacey-gammon/d3b55b60c731b2bfb037b86144fcc3db to your computer and use it in GitHub Desktop.

Corner cases:

  1. Registrar wants to add a migration to every registry item. Specific example: Author of Embeddable api wants to migrate base EmbeddableInput.
  2. Enhancer wants to add a migration to every registry item. Specific example: Author of EnhancedEmbeddableDrilldowns wants to migrate EnhancedEmbeddableInput.
  3. Registrator wants to add a migration to it's specific registry item. Example: Author of Visualize plugin wants to migrate VisualizeEmbeddableInput

Corner case 1 & avoiding clashes.

Solve for:

Base state:

interface EmbeddableInput {
  defaultTitle: string
}

Extended state:

interface VisualizeEmbeddableInput extends EmbeddableInput {
  title: string
}

Embeddable plugin wishes to migrate defaultTitle to title. It shouldn't have to know about VisualizeEmbeddableInput to do so safely (third party developers are out there that we can't collaborate with).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment