-
Notifications
You must be signed in to change notification settings - Fork 29
Dedup definitions of TJSON type #440
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
Conversation
|
The 2nd commit of this PR does not type-check in a way that confuses me. The error is: This seems to have nothing to do with removing the Another question is whether |
|
Cc @skiplabsdaniel and @bennostein as this code comes from #425. |
Taking a look now at the main question, but for this one: no, |
And AFAIU "it would be bad" if skjson and skipruntime_api used different/incompatible definitions of TJSON. |
Can you elaborate? I'm trying to determine now whether that's true, as I vaguely recall Daniel saying that the difference was intentional/necessary. |
|
The good definition is the api one, the bigint appears by mistake. |
I have not dug in in great detail, but as far as I have understood, there are uses of TJSON all over and it is unclear (to me) why skjson should support bigint but nothing else should. If there is an intentional/needed difference, one of the two types should be renamed so we can keep track of where bigint is supported and where not. |
Thanks Daniel. This makes the question about the GetResult cast more important since removing the bigint alternative breaks the type-checker. :-/ |
|
Type type checker is right, the result cannot be directly a |
|
I'm not sure we need to deduplicate now, skjson's TJSON corresponds to the wasm chain, skipruntime's TJSON is a typescript chain that will work just as well with wasm chain as with the native chain. So it would be a shame to force dependencies from the wasm chain into the native chain. |
|
Ok, I won't go ahead with this. I did not realize this would impact native dependencies. For my understanding, would the use of the skjson definition in core/src/skipruntime_api.ts be fine since core/package.json already has a dependency on skjson, but it is the use of the skjson definition in client/src/protocol.ts that is a problem since client/package.json does not have a dependency on skjson? I still think it would be good to have the definition (of each type) only once somewhere that is dependency-friendly. |
|
It's true that the current state is confusing because no native chain exist. The PR #443 separates more the packages to manage correctly both chain. But I agree we need to have the definition of each type once. |
No description provided.