22 Commits

Author SHA1 Message Date
003dc45d76 add: docs for typescript_type 2020-03-04 15:32:40 +08:00
84f5fe2c00 add: tests for typescript_type attribute 2020-03-04 14:17:53 +08:00
7ffb5ed70c Add skip_typescript attribute to prevent .d.ts emit (#2016)
* Add skip_typescript attribute to prevent .d.ts emit

* Add guide page for typescript attribute
2020-03-03 09:34:28 -06:00
381660c49b Run rustfmt and keep it running on CI (#2023)
Thought we did this awhile back, but looks like we forgot to do so!
2020-03-02 11:44:14 -06:00
93cb6cb65d Symlink LICENSE files in crates (#2018) 2020-02-28 17:41:28 -06:00
ec1b9453c9 Allow web-sys to emit correct typescript declarations from webidl (#1998)
* Update to emit typescript names

* Update to use NamedAnyref

* Update incoming / outgoing

* Remove added space

* Remove comment

* Add basic typescript tests for web-sys
2020-02-19 09:14:32 -06:00
b6190700c9 Reflect optional struct fields in typescript (#1990)
* reflect option struct fields in typescript

* optional fields: move type checker to getter

* infer optional fields from ts_args
2020-02-18 09:15:37 -06:00
f66d83ff70 Store richer adapter types, don't use instructions for TypeScript (#1945)
This commit updates how TypeScript signature are generated from adapters
in wasm-bindgen. A richer set of `AdapterType` types are now stored
which record information about optional types and such. These direct
`AdapterType` values are then used to calculate the TypeScript
signature, rather than following the instructions in an adapter function
(which only works anyway for wasm-bindgen generated adapters).

This should be more robust since it reads the actual true signature of
the adapter to generate the TypeScript signature, rather than attempting
to ad-hoc-ly infer it from the various instructions, which was already
broken.

A number of refactorings were involved here, but the main pieces are:

* The `AdapterType` type is a bit more rich now to describe more
  Rust-like types.
* The `TypescriptArg` structure is now gone and instead return values
  are directly inferred from type signatures of adapters.
* The `typescript_{required,optional}` methods are no longer needed.
* The return of `JsBuilder::process` was enhanced to return more values,
  rather than storing some return values on the structure itself.

Closes #1926
2020-01-07 11:34:02 -06:00
6c27376ac2 Run rustfmt 2020-01-07 08:16:25 -08:00
620212dff8 bool -> boolean in generated TypeScript code (#1933)
* bool -> boolean in generated TypeScript code

* Add a test for booleans

Co-authored-by: Alex Crichton <alex@alexcrichton.com>
2020-01-06 13:17:19 -06:00
6cb659d5ac Fix warning about dead code when testing on non-wasm32 targets
There are functions that are only used on wasm32 targets, but `cfg`ing them is
more work than just making the modules public, and this is just a testing crate.
2019-07-09 13:17:52 -07:00
83a3f5d44a Run cargo fmt --all 2019-06-13 08:30:06 -07:00
e7e8ae1877 Fix getter and setter 2019-06-06 16:11:51 -03:00
ad68436cc9 Looks like webassembly-js-api package no longer needed!
Closes #1565
2019-05-30 07:40:26 -07:00
827810fa1b Merge pull request #1483 from dbrgn/typescript-optional-args
Fix optional arguments in TypeScript
2019-05-14 12:39:35 -05:00
9b5de9f88d update init test 2019-05-09 11:12:45 -07:00
608a819c0b fixup! Fix optional arguments in TypeScript
Update tests
2019-05-09 18:36:47 +02:00
2384af21c1 Fix optional arguments in TypeScript 2019-05-09 18:09:29 +02:00
b6317e3f24 Add TS type for init fn 2019-04-01 19:45:53 -03:00
a6fe0cefa8 Migrate all crates to the 2018 edition
Most of the CLI crates were already in the 2018 edition, and it turns
out that one of the macro crates was already in the 2018 edition so we
may as well move everything to the 2018 edition!

Always nice to remove those `extern crate` statements nowadays!

This commit also does a `cargo fmt --all` to make sure we're conforming
with style again.
2019-03-26 08:10:53 -07:00
dc50a5ab58 Improve TS tests 2019-03-15 22:15:04 -03:00
235bc7c889 Start testing TypeScript output on CI
This commit starts to add some simple tests for our TypeScript output of
the wasm-bindgen CLI, currently just running `tsc` to make sure syntax
looks good and types are emitted as expected. This'll hopefully be able
to get expanded over time with bug reports as they come in as well as
ensure that we don't regress anything in egregious manners!

Closes #922
2019-03-05 08:57:52 -08:00