Repository navigation
@rust JSDoc tags and --annotate side files
#66
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
Open
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6457223
Add @rust JSDoc tags to force a Rust scalar for TS numbers
guybedford 74469bd
Add --annotate: layer @rust and @throws tags from side .d.ts files
guybedford 9e13873
--annotate: a side declaration's type-parameter defaults replace the …
guybedford 2916946
@rust: a tagged leaf inside a generic handle stays a JS number
guybedford 2d0181d
--annotate: a side alias the input lacks fails the run
guybedford e7095b8
--annotate: narrow the type-parameter default docs to alias expansion
guybedford 9dd782e
--annotate: carry over only a side member's ## Errors section
guybedford e9b07ab
CONVENTIONS: a side alias with a type-parameter default is applied
guybedford 452f299
CONVENTIONS: a side class/interface default becomes the Rust default
guybedford File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,36 @@ | ||
| #![cfg(target_arch = "wasm32")] | ||
|
|
||
| use js_sys::{Array, BigInt, Function, JsNullable, Nullable, Number, Promise, Undefined}; | ||
|
|
||
| use ts_gen_integration_tests::rust_tags::*; | ||
|
|
||
| // This fixture has no backing JavaScript module, so it provides compile-only | ||
| // coverage that every `@rust` scalar has a wasm-bindgen ABI, including a | ||
| // tagged leaf inside a generic handle, which stays a JS `Number`. | ||
| #[allow(dead_code)] | ||
| async fn rust_tag_signatures_compile(response: &Response, callback: &Function<fn() -> Undefined>) { | ||
| let _: u16 = response.status(); | ||
| let _: Nullable<u32> = response.content_length(); | ||
| let _: u32 = response.with_status(200); | ||
| let _: u32 = response.with_status_with_reason(200, "OK"); | ||
| let _: u32 = response.count().await.unwrap(); | ||
| let _: Nullable<u32> = response.maybe_count().await.unwrap(); | ||
| response.upload_part(1); | ||
| let _: Vec<u8> = response.bytes(); | ||
| response.listen(&[80, 443]); | ||
| let _: u64 = response.offset(); | ||
|
|
||
| let closed: Promise<Number> = response.closed(); | ||
| let _: Number = response.closed().await.unwrap(); | ||
| let _: BigInt = response.total().await.unwrap(); | ||
| response.when_ready(&closed); | ||
| let matrix: Vec<Array<Number>> = response.matrix(); | ||
| response.set_matrix(&matrix); | ||
| let codes: Vec<JsNullable<Number>> = response.codes(); | ||
| response.set_codes(&codes); | ||
|
|
||
| let init = ResponseInit::builder().status(204).build(); | ||
| let _: Option<u16> = init.status(); | ||
| let _: i32 = set_timeout(callback); | ||
| let _: i32 = set_timeout_with_ms(callback, 10u32); | ||
| } |
This file contains hidden or 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,41 @@ | ||
| //! @ts-gen --experimental-generic-mono | ||
|
|
||
| #![cfg(target_arch = "wasm32")] | ||
|
|
||
| use js_sys::{Array, BigInt, Function, JsNullable, Nullable, Number, Promise, Undefined}; | ||
|
|
||
| use ts_gen_integration_tests::rust_tags_mono::*; | ||
|
|
||
| // This fixture has no backing JavaScript module, so it provides compile-only | ||
| // coverage that every `@rust` scalar has a wasm-bindgen ABI, including a | ||
| // tagged leaf inside a generic handle, which stays a JS `Number`. | ||
| #[allow(dead_code)] | ||
| async fn rust_tag_mono_signatures_compile( | ||
| response: &Response, | ||
| callback: &Function<fn() -> Undefined>, | ||
| ) { | ||
| let _: u16 = response.status(); | ||
| let _: Nullable<u32> = response.content_length(); | ||
| let _: u32 = response.with_status(200); | ||
| let _: u32 = response.with_status_with_reason(200, "OK"); | ||
| let _: u32 = response.count().await.unwrap(); | ||
| let _: Nullable<u32> = response.maybe_count().await.unwrap(); | ||
| response.upload_part(1); | ||
| let _: Vec<u8> = response.bytes(); | ||
| response.listen(&[80, 443]); | ||
| let _: u64 = response.offset(); | ||
|
|
||
| let closed: Promise<Number> = response.closed(); | ||
| let _: Number = response.closed().await.unwrap(); | ||
| let _: BigInt = response.total().await.unwrap(); | ||
| response.when_ready(&closed); | ||
| let matrix: Vec<Array<Number>> = response.matrix(); | ||
| response.set_matrix(&matrix); | ||
| let codes: Vec<JsNullable<Number>> = response.codes(); | ||
| response.set_codes(&codes); | ||
|
|
||
| let init = ResponseInit::builder().status(204).build(); | ||
| let _: Option<u16> = init.status(); | ||
| let _: i32 = set_timeout(callback); | ||
| let _: i32 = set_timeout_with_ms(callback, 10u32); | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.