-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add support for Typescript in Rust Relay compiler #3182
Changes from 11 commits
1dd9346
bc7292e
6c2fcd6
5840f10
3cf9cab
c7ffa7d
fbce1e7
1fa6191
5ed9225
d40a34a
96e771e
54dd5bf
2520ae5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,26 @@ use fnv::FnvHashMap; | |
use interner::StringKey; | ||
use serde::Deserialize; | ||
|
||
#[derive(Debug, Deserialize)] | ||
#[serde(deny_unknown_fields, rename_all = "camelCase")] | ||
pub enum TypegenLanguage { | ||
Flow, | ||
Typescript, | ||
} | ||
|
||
impl Default for TypegenLanguage { | ||
fn default() -> Self { | ||
Self::Flow | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was even thinking of making Typescript the default, but just realized Maybe we could even make this optional and skip generating types altogether to make the files a bit smaller. |
||
} | ||
} | ||
|
||
#[derive(Debug, Deserialize, Default)] | ||
#[serde(deny_unknown_fields, rename_all = "camelCase")] | ||
pub struct TypegenConfig { | ||
/// The desired output language, "flow" or "typescript". | ||
#[serde(default)] | ||
pub language: TypegenLanguage, | ||
|
||
/// # For Flow type generation | ||
/// When set, enum values are imported from a module with this suffix. | ||
/// For example, an enum Foo and this property set to ".test" would be | ||
|
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.
with react, this has to be
tsx
. So could this be an array perhaps?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.
You're right, I adjusted it! I set it to look at .jsx as well, just in case people use that.
Edit: I committed this on my phone and see that it doesn't compile. I'll have to take a look at that later. I'm on vacation now so a bit limited.
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.
@maraisr Fixed the build now as well.