Comments (2)
Hi @5HARK I really need to update the docs on this.
Sender has been omitted from the typescript types by design as it is not really possible to correctly type sender. (I've tried, with no luck)
The use of sender okayish in a dynamically typed actor system, but I actually think in general it's an antipattern.
The recommended approach is to include the sender in the message itself as this allows you to enforce the typing of the sender using typescript types.
This would change your example to the following:
// request
await query(actorX, (sender: Ref<string>) => ({ sender, text: "Let there be light" }), 5000)
// response(In actorX's msg handler)
dispatch(msg.sender, "and there was light")
from nact.
Thank you for your response. It helps me a lot :-)
from nact.
Related Issues (20)
- [7.6.0] configureLogging is not accessible HOT 1
- Notify an actor created by query() when work needs to be cancelled HOT 1
- the website is dead HOT 2
- New .xyz documentation site search points to nact.io HOT 1
- Page on npmjs.com still points to old domain HOT 1
- Build Error on Typescript 4.6.2 HOT 2
- Versions out of Sync HOT 1
- onCrash not called for stateless actors
- Enable Github Discussions HOT 1
- Can't join Discord from nact.xyz/en_uk/community HOT 1
- Stateless Actors won't handle errors HOT 1
- Stateless actors are not concurrent. HOT 3
- Discord URL in README is expired
- onCrash does not provide access to internal message queue
- dispatch has wrong type signature HOT 2
- when trying to compile typescript file with nact, I receive error saying dispatch accepts only 2 arguments HOT 1
- multiple instances support HOT 1
- Deno Support HOT 1
- Scaling? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nact.