-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented exporting of IDL objects along with ts-js target for comb…
…ined TypeScript file with the JavaScript runtime values
- Loading branch information
Showing
7 changed files
with
107 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ pub mod javascript; | |
pub mod motoko; | ||
pub mod rust; | ||
pub mod typescript; | ||
pub mod typescript_and_javascript; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
rust/candid_parser/src/bindings/typescript_and_javascript.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use super::javascript::compile as javascript_compile; | ||
use super::typescript::compile as typescript_compile; | ||
use candid::pretty::utils::*; | ||
use candid::types::{Type, TypeEnv}; | ||
|
||
pub fn compile(env: &TypeEnv, actor: &Option<Type>) -> String { | ||
let ts = typescript_compile(env, actor, true); | ||
let js = javascript_compile(env, actor, true); | ||
|
||
str(&ts.clone()).append(js).pretty(LINE_WIDTH).to_string() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters