### Godot version

4.0.beta17

### System information

windows 10, nvidia graphics

### Issue description

When creating a typed array from another base array, if the base array was gotten from get_tree().get_nodes_in_group(), you cannot create a typed array assigning a script different from null, otherwise the resulting array will be filled with nulls.

![image](https://user-images.githubusercontent.com/5783414/216142311-1eded30c-e8ff-4a2b-aa5a-61ae5cafce13.png)


### Steps to reproduce

See attached video:

https://user-images.githubusercontent.com/5783414/216142187-82af9900-d490-4d6d-b4cc-9d776d8b8cc9.mp4



### Minimal reproduction project

[TypedArrayConstructorDoesntWorkWithScriptsWhenUsingGetNodesInGroup.zip](https://github.com/godotengine/godot/files/10560863/TypedArrayConstructorDoesntWorkWithScriptsWhenUsingGetNodesInGroup.zip)

### WorkAround

Instead of using the output of get_tree().get_nodes_in_group() directly, the user can join it with an empty array
```gdscript
[]+get_tree().get_nodes_in_group()
```
and it will work as expected.
return type != p_type.type || class_name != p_type.class_name || script != p_type.script;
	}
	
	_FORCE_INLINE_ bool validate(Variant &inout_variant, const char *p_operation = "use") const {
		if (type == Variant::NIL) {
			return true;
		}
		if (type != inout_variant.get_type()) {
			if (inout_variant.get_type() == Variant::NIL && type == Variant::OBJECT) {
				return true;
			}
			if (type == Variant::STRING && inout_variant.get_type() == Variant::STRING_NAME) {
				inout_variant = String(inout_variant);
				return true;
			} else if (type == Variant::STRING_NAME && inout_variant.get_type() == Variant::STRING) {
				inout_variant = StringName(inout_variant);
				return true;
			}
			ERR_FAIL_V_MSG(false, "Attempted to " + String(p_operation) + " a variable of type '" + Variant::get_type_name(inout_variant.get_type()) + "' into a " + where + " of type '" + Variant::get_type_name(type) + "'.");
		}
		if (type != Variant::OBJECT) {
			return true;
		}
		return validate_object(inout_variant, p_operation);
	}
	_FORCE_INLINE_ bool validate_object(const Variant &p_variant, const char *p_operation = "use") const {
		ERR_FAIL_COND_V(p_variant.get_type() != Variant::OBJECT, false);
#ifdef DEBUG_ENABLED
		ObjectID object_id = p_variant;