I am trying to save an Array[Switch] to a file using store_var() and FileAccess. However, when loading it back it comes back as an untyped Array.

## Saves switches to the file specified in SAVE_PATH
func save_switches() -> void:
	var file := FileAccess.open(SAVE_PATH, FileAccess.WRITE)
	
	file.store_var(switches)
	file.close()

## Loads switches from the file specified in SAVE_PATH
func load_switches() -> void:
	if (FileAccess.file_exists(SAVE_PATH)):
		var file := FileAccess.open(SAVE_PATH, FileAccess.READ)
		
		var encoded_array : Array = file.get_var()
		
		for encoded_switch : EncodedObjectAsID in encoded_array:
			switches.append(instance_from_id(encoded_switch.object_id))
		
		file.close()
	else: print("Unable to find switches file to load")

DaveTheCoder

I changed my approach to the issue.

Instead of saving and loading it through store_var() I am using store_text() and get_as_text(), to write to the file I map the array into a Dictionary and JSON.stringify() it, and then to read I just JSON.parse_string() on the file data and map it to the Array I need. Which seems to work.