#TypeChecker bug or am I doing something wrong?

1 messages · Page 1 of 1 (latest)

keen moth
#
--!strict

local DataAPI = require(game.ServerScriptService.DataAPI)
local dataTree = {}

DataAPI.register(dataTree) --"DataAPI" gets underlined orange from Type Checker
#

I could give DataAPI the type any but im loosing auto complete this way

lime spindle
keen moth
#

I already did that but im searching for a solution or maybe im doing something wrongevilcat

lime spindle
keen moth
#

no

lime spindle
keen moth
#

Ig this but this is likely to be also a bug

lime spindle
#

In the hover

lime spindle
keen moth
#
function API.save(player)
    if not API.dataTree.DataStoreName then return end

    local ds = DataStoreService:GetDataStore(API.dataTree.DataStoreName)
    local saveData = API.logic.collectSaveData(player)

    local success, err = pcall(function()
        ds:SetAsync(player.UserId, saveData)
    end)

    if not success then
        warn("Save failed for", player.Name, err)
    end
end
#

I mean this looks fine to me

#
function API.collectSaveData(player)
    local saveData = {}

    for _, child in player:GetChildren() do
        local folderDef = API.getFolderDefinitionByName(child.Name)
        if not folderDef then continue end

        local valuesToSave = API.getValuesToSave(child, folderDef)
        if not valuesToSave then continue end

        for key, value in valuesToSave do
            saveData[key] = value
        end
    end

    return saveData
end

the collectSaveData() also isnt doing something insane

hidden plover
#

stop using --!strict on everything

#

😭

#

it has a lot of cons

keen moth
keen moth
hidden plover
#

No type checking

#

Second of all

#

Silent Errors

#

Third of all

#

Risk of memory corruption

#

Fourth of all

keen moth
keen moth
hidden plover
#

I think my old man said cons of --!nonstrict

#

lmao

#

mb then

#

but why --!strict on everything bro

#

is it necessary

lime spindle
keen moth
hidden plover
#

enabled --!strict for the first time..

keen moth
#

yeah you need to build a script from ground up if you use —!strict