How to fix this "Type mismatch" in DataStore2?

I’m getting this “Type mismatch” warning in Script Analysis, about the DataStore2 module.
I understand this is a problem in DataStore2 module as I posted here:

But I don’t know when the author will fix this.
In the meantime, what would be the fix I could do directly in the DataStore2 module to get rid of this warning?

Does anyone else use DataStore2 in Studio and have Script Analysis enabled, who is having this same problem?

1 Like

Can you post a screenshot of the error it’s giving you from the output window

Nothing from output window. As I said, it’s a warning from Script Analysis Beta window, as you can see in the GitHub link I posted.

Ah I see, apologies for the misunderstanding.

This may be an issue with Script Analysis or an edge case that Roblox may or may not choose to fix.

DataStore2 is indeed a table (not an array as you claim on GitHub). If you look through the file you see it ends up as a dictionary full of functions, with a __call metamethod that makes it able to look like you call it as a function, to make it nice and simple to use.

It is a table but it can also be called. The problem isn’t in DataStore2.

Stick with your Studio bug report or if the Script Analysis beta has a topic and they’ve asked you to report issues there, then post with this edge case when a table has a __call metamethod.

I already opened a ticket about this bug almost two weeks ago but they haven’t even seen it until today …
Script Analysis is excellent for predicting errors in advance.
The problem is that this warning keeps showing up constantly and it takes attention away from possible new warnings since I have to ignore this warning and so I get used to not looking there …
It would be best to find some way to change the code in DataStore2 so that this warning disappears.
Would you know how?

As mentioned it’s not a problem with DataStore2. You can’t fix it or suppress it without rewriting the way DataStore2 works.

It is far from critical so I’m not surprised it’s been two weeks. A yellow underline caused by a beta feature (i.e., optional, and not expected to work fully) is not going to break your game and therefore doesn’t need urgent attention.

I’m sure they will look into it if you’ve reported the bug before the feature comes out of beta status. In the meantime just ignore the message. Users without the beta feature don’t get warnings at all.