How can i convert this code from Godot 3 to 4

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Max_EinDax

I have tried to convert this code to godot 4 but it did not work.
Godot 3 code:

export(Array, Resource) var items = [ null, null, null, null, null, null, null, null, null]

Not working godot 4 code:

@export var items: Array[Resource] = [null, null, null, null, null, null, null, null, null]

It says 'Trying to assign a typed array with an array of different type.

I was wrong in the format.
In fact that format should work.
There is a bug however that the export shows up in the editor as nil

LeslieS | 2022-12-30 05:44

Ive tried it but it is still not working

Max_EinDax | 2022-12-30 19:57

Again your format is correct.
You are probably facing this bug.

LeslieS | 2022-12-30 22:25