I was having issues with the typechecker giving me strange warnings for specific scenarios, and so I abstracted the issue from my original code.
If you look at the example below, it seems as though the typechecker is getting confused with my singleton key and arguing that a singleton string… isn’t actually a string?
What confuses me is how specific the conditions need to be for this issue to occur;
This seems to happen specifically when there is a key included in the “ChapterType” table with an Instance value. Removing the “Part” key in the type + variable declaration resolves this issue, but I need this for my usecase.
Eliminating the use of ChapterType and directly describing the value of each string-keyed value in variable “Book1” resolves this issue aswell and is the best solution for my particular usecase but obviously doesn’t let me export ChapterType to other scripts.
Is there a mistake I’m making that I can resolve right now and fix this, or is this a bug with the typechecker?
Felt extremely skeptical but oddly enough this works?
No longer any issues when the “Title” suits the singleton type criteria:
kinda annoying though because all my scripts have their type declarations organised to the bottom of the script…
I’ll leave this post open incase anyone could explain what is causing this difference, and I’m thankful your solution fully works but frankly my preference is holding me back from being entirely satisfied with this solution as it implies that I’ll need to scatter all my type declarations throughout my script/s in the future
As for what you mentioned relating to the “–!strict” flag, this is what enables the typechecker to work more attentively. Obviously I could just remove the strict flag to sedate the typechecker and make it ignore technicalities but I’d prefer to keep the typechecker set to strict so it can still vigilantly warn me of other actual issues like usual.