Invalid assignment of property or key with value of type Vector2 on a base object of type Node

Godot Version

4.3.stable

Question

I created a VelocityComponent by extending Node class
This component has a Vector2 property :

class_name VelocityComponent
extends Node
var velocity_direction: Vector2 = Vector2.ZERO

My enemy_base class uses this component as a child and I set the velocity_direction value :

tool
extends CharacterBody2D
onready var velocity_component: VelocityComponent = $VelocityComponent
func _ready() → void:
velocity_component.velocity_direction = enemy_definition.initial_direction

This leads to an error in editor
res://entities/character/enemy/enemy_base.gd:39 - Invalid assignment of property or key ‘velocity_direction’ with value of type ‘Vector2’ on a base object of type ‘Node (VelocityComponent)’.

But everything is fine when I run the game

If I do

export var velocity_direction: Vector2 = Vector2.ZERO

in my VelocityComponent, the error disappears.

Do you have an idea what is going wrong ?

PS: I tried to change the base type of VelocityComponent to Node2D but it does not work. I can assign this property from another code in my project and it works (but not in a tool script)

Thanks !

Just found my VelocityComponent was not a tool script …