-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript bindings #8
Comments
Well, we could discuss about type safe. Basically, client and server communication could be abstracted as
So I prefer:
If you have other opinions, I'm all ears. |
The interesting thing about Typescript is that the types can be in a definition file rather than inlined into the source code. Since the definition file is separate, it could be used to define an interface that both the client and server would use, and this file would be shared by the client code and the server code. As Typescript removes the definitions and typing at compile time, the type information is not used in run-time, but the code will have been checked by this point already. In other words, there is no change to your existing NextQL code, it is more of a technique that can be used while writing interfaces. Have a look at DefinitelyTyped repository for thousands of projects that have been typed. |
Yes, I understands how typescript working. I just want figure out how to apply into NextQL. I takes GraphQL as example:
Currently, I busy on a sister project gstate. I hope it could help solve the problem of cache and real time support for nextql. I will back to ts after complete it. |
Yes, I am watching gstate as well. I have client/server through WebSocket and want some communications protocol between them. Server has a large database, the client queries for what it needs. But the client might be offline, so the client side also needs to implement the database too. This is why I find NextQL and gstate so interesting. The client can store updates in the local database, then send the queued updates to the server when it's next online. |
I like the idea of GraphQL without the overhead of typing. As Typescript implements definition files, I'm wondering if interfaces can be specified for type checking messages. On both the client and server, the same definition file would be the reference interface.
So NextQL may achieve an opt-in typing safety same as GraphQL, without the overhead or complexity?
The text was updated successfully, but these errors were encountered: