Skip to content

Instantly share code, notes, and snippets.

@micahgodbolt
Created June 21, 2018 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micahgodbolt/89b175d44738260ad30bfeafbff29e00 to your computer and use it in GitHub Desktop.
Save micahgodbolt/89b175d44738260ad30bfeafbff29e00 to your computer and use it in GitHub Desktop.
interface IMenu {
stuff?: any;
items: string[];
}
interface IButton {
...
menuProps?: IMenu
}
interface IMenuBar {
overflowButtonProps?: IButton // but menuProps should be Partial<IMenu> because IMenuBar provides required items
}
@chriseppstein
Copy link

This isn't super elegant, but it seems to do the trick for the stated use case.

interface IMenu {
  stuff?: any;
  items: string[];
}

interface IButton<IMenuType extends Partial<IMenu> = IMenu> {
  menuProps?: IMenuType
}

interface IMenuBar {
  overflowButtonProps?: IButton<Partial<IMenu>>
}

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