How add particles dynamically using typescript?

 var PAsset = new ParticleAsset("res/Tool_Completion_Particle.plist") ;

 var node = new Node();
 director.getScene().addChild(node);

 var particleSystem = node.addComponent(ParticleSystem2D);
particleSystem.file = PAsset;

I am new on cocos , so tried myself as above to load particles dynamically but it throws error “TypeError: Cannot read properties of null (reading ‘maxParticles’)

Can you help me resolve the issue?

You can open the browser modulation tool to see, this problem is mainly caused by not finding the particle resources, ParticleAsset corresponding resources were not found. In addition, you are not using cocos2d-x, but cocos creator3.x, the tag is filled in wrong.