color is a string that defaults to primary
but when passed into the Colors array as an index I’m promptly informed that it’s an any type because a string can’t be used as an index on type ‘{…etc}’
if I change it to the colon’s the IDE doesn’t like it… I think the difference is the parathesis around it passing it up to be called in a functional component.
oh, okay… it’s… a function definition, that expects an object, that has default values… I get it now… syntax makes my head hurt, but… sure… i guess? I’m not sure how it translates the object into a set of variables available to the output function, maybe thats a TypeScript thing.
I assume that you’re seeing a valid value for title where it should be?
yes, the default values seem to come through, even the color is functional, I’m just new to TypeScript and trying to trace down all the red squiggles, and thought that this would be an easier one. I mean the button is still drawing the default text and color and I can pass new settings for each, so it’s functional. But it’s also a base component. I thought getting all the typescript warnings now would save me headaches using it in larger components later.
I notice the Color object will only take light or dark for the theming, so I’m wondering if I should come on the Expo forum and try to track down where they are setting the type for the constant Color. It seems to be a Global they are using for theming. I may just need to duplicate such an interface for the palette as a separate object https://stackoverflow.com/questions/67847573/what-type-should-i-assign-to-an-index
Yet another option would be to define an actual interface for the Colors object… if this is based on / using a 3rd oarty library, such an interface might already exist.
the layered nesting still seemed to be an issue…
so I went ahead and separated palette as it’s on object.
but it seems to be working perfectly. I should probably start a new thread for this but any advice on how to pass a function, (any) is what I’m getting so far?