-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Typescript Support Early PR #4065
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
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
|
I signed it! |
|
CLAs look good, thanks! |
fixed issues with 'this' not having intellisense, causing issue with generic in test_generated.ts line 220, tsc is dropping the namespace 'flatbuffers' off of 'flatbuffers.Table' and recognizing it as 2 different types
Caused issues all all around including with webpack/browserify
|
Tested the flatbuffers.ts and generated.ts files in our project...worked like a champ |
had initialized local variable with same name c\p bug
Make sure node doesn't grap the ts files
|
Changed the example to be compatible with the one in the flatbuffers/tests area. Both the flatc->generated js file and the flatc->generatedts->tsc->generatedjs files pass the flatbuffers/tests/JavaScriptTest.js suite good first start. |
Had to make the __union method generic so that calling method would know return value
fixed cast when type is boolean
Needs implementation check, just repeated writeIntXX methods
ghost
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally looks like the right direction, just needs a lot of cleanup :)
| return WrapInNameSpace(def.defined_namespace, def.name); | ||
| } | ||
|
|
||
| std::string GetNameSpace(const Definition &def) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use spacing conform https://google.github.io/styleguide/cppguide.html
|
|
||
| std::string GetNameSpace(const Definition &def) { | ||
| const Namespace *ns = def.defined_namespace; | ||
| const std::string &name = def.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this needed? There's already the function FullNamespace
| @@ -0,0 +1,350 @@ | |||
| // Run this using JavaScriptTest.sh | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't see any types in this file, why is there a copy?
tsTest -> ts_test
| @@ -0,0 +1,80 @@ | |||
| // test schema file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please just use all the existing files rather than making copies.
|
|
||
| return SaveFile(GeneratedFileName(path_, file_name_).c_str(), code, false); | ||
| std::string filename = ""; | ||
| if (ts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, all these if-thens can use some cleanup. prefer to stick them in a table (see LanguageParameters in idl_gen_general.cpp for an example) where possible, and otherwise think how to represent the code with as few if-thens as possible by sticking them into functions where needed.
| code += " }\n\n"; | ||
| code += " this.bb.write" + MakeCamel(GenType(field.value.type)) + "(this.bb_pos + offset, value);\n"; | ||
| std::string value = "value"; | ||
| if (GenTypeName(field.value.type, true)=="boolean") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (field.value.type.base_type == BASE_TYPE_BOOL)
|
Thanks yeah it was a late night hackathon style was meant to just see how On Oct 21, 2016 5:07 PM, "Wouter van Oortmerssen" notifications@github.com
|
c65126c to
2616516
Compare
48a7fb3 to
2a7a44b
Compare
|
Status? |
|
Used the ugly version in two projects that have been running in controlled
production with no issues. Haven't had time to go back and do a final
rewrite. On my list (: but it works very well.
…On Jan 4, 2017 5:00 PM, "Wouter van Oortmerssen" ***@***.***> wrote:
Status?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4065 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIZod3KdVfN6T6B7mmPNaxA2A72rZh1jks5rPDKWgaJpZM4Kb6mW>
.
|
|
@sampaioletti is this still on your list? |
|
Yes unless someone else has time to twke it over ive just been slammed
…On Mar 3, 2017 12:02 AM, "gwest7" ***@***.***> wrote:
@sampaioletti <https://github.com/sampaioletti> is this still on your
list?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4065 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIZod1BlKJD-AVuc252nWstlnP8UGyW9ks5rh7sggaJpZM4Kb6mW>
.
|
|
This is probably obsolete now that this was merged: #4232 |
Wouter had to give this a go it was driving me crazy thinking about it. I think for a rough first stab it shows it can work pretty well. I was able to code the FB tutorial with full type support using vscode (it was pretty awesome) and compile it to vanilla js. Didn't have a chance to generate tests or anything, just wanted to see how it would fit in so you could say how you wanted it completed. I'll play with it a little more and actually run a fb encode to see if it works (it should, or at least be close).
A couple notes
Not definitive by any means, I'm neither an expert at FB or TS, but was meant as a way to kick this off. The only time I get mad at FB is when I have to use it without intellisense....but that could be just me (: Let me know how/if you want me to keep going.
-Sam