charmbracelet / bubbles

TUI components for Bubble Tea 🫧

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

List interface bug for downstream packages

mr-joshcrane opened this issue · comments

Describe the bug
Item is intended to be an interface, but it cant actually imported from other packages.

To Reproduce

func TestSetItems(t *testing.T) {
	list := New([]item{}, itemDelegate{}, 10, 10)
	items := []item{item("foo"), item("bar")}
	list.SetItems(items)
	// Does not compile because new takes a slice of Items
	// which is a concrete type, not an interface
	// In your tests you use Items from your imported package
	// not items from your test file, which is hiding this error
}

Short answer is to fix references to []Item 👍
Let me know if you want a PR to fix it